Browse Source

restyle AddServiceReferenceDialog.xaml

pull/23/head
PeterForstmeier 14 years ago
parent
commit
20fb4fc2c1
  1. 163
      src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/AddServiceReferenceDialog.xaml
  2. 1
      src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/AddServiceReferenceDialog.xaml.cs
  3. 92
      src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/AddServiceReferenceViewModel.cs
  4. 23
      src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/Commands/ReferenceFolderNodeCommands.cs

163
src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/AddServiceReferenceDialog.xaml

@ -9,106 +9,121 @@ @@ -9,106 +9,121 @@
xmlns:web="clr-namespace:System.Web.Services.Description;assembly=System.Web.Services"
WindowStartupLocation="CenterOwner"
Style="{x:Static core:GlobalStyles.DialogWindowStyle}"
Height="425"
Width="500"
Height="570"
Width="700"
Title="{Binding Title}">
<!--
http://blogs.msdn.com/b/chkoenig/archive/2008/05/24/hierarchical-databinding-in-wpf.aspx
http://www.codeproject.com/KB/WPF/TreeViewWithViewModel.aspx?msg=3663052
-->
<Window.Resources>
<HierarchicalDataTemplate x:Key="HeaderTemplate"
ItemsSource="{Binding SubItems}">
<TextBlock Grid.Row="0" Text="{Binding Path=Name}" />
</HierarchicalDataTemplate>
</Window.Resources>
<Grid
Name="grid"
ShowGridLines="True">
<Grid.RowDefinitions>
<RowDefinition
Height="1*" />
<RowDefinition
Height="3*"></RowDefinition>
<RowDefinition
Height="Auto" />
</Grid.RowDefinitions>
<Grid
Grid.Row="0">
<Grid.RowDefinitions>
<RowDefinition
Height="40"></RowDefinition>
<RowDefinition
Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<TextBox
Grid.Row="0"
TextWrapping="Wrap"
Text="To see a list of available services on an specific Server,&#xD;&#xA;&#x9;&#x9;&#x9;enter a service URL and click Go.To browse for available services cklick Discover"></TextBox>
<Grid
Grid.Row="1"
ShowGridLines="True">
<!-- Style="{x:Static core:GlobalStyles.ButtonStyle}" -->
<Grid>
<Grid.RowDefinitions>
<RowDefinition
Height="Auto"></RowDefinition>
<RowDefinition Height="2*" />
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="7*"></RowDefinition>
<RowDefinition Height="2*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition
Width="300"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition Width="200"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBox Grid.ColumnSpan="3"
Margin="4,0,4,0"
TextWrapping="Wrap"
Text="To see a list of available services on an specific Server,&#xD;&#xA;&#x9;&#x9;&#x9;enter a service URL and click Go.To browse for available services cklick Discover"></TextBox>
<TextBlock Grid.Row="1" Text="Address:" Margin="4,0,4,0"></TextBlock>
<ComboBox
Grid.Column="0"
Margin="0,4,12,12"
Grid.Row="2"
Grid.ColumnSpan="2"
Margin="4,0,4,0"
IsEditable="True"
ItemsSource="{Binding MruServices}"
IsSynchronizedWithCurrentItem="True"
LostFocus="Cbo_LostFocus"
SelectedItem="{Binding SelectedService, UpdateSourceTrigger=PropertyChanged}"></ComboBox>
<widgets:UniformGridWithSpacing
Columns="2"
Grid.Column="1"
Margin="0,4,12,12"
HorizontalAlignment="Center">
SelectedItem="{Binding SelectedService, UpdateSourceTrigger=PropertyChanged}">
</ComboBox>
<StackPanel Grid.Column="2"
Grid.Row="2"
Margin="4,0,4,0"
Orientation="Horizontal">
<Button
Content="Go"
Width="30"
Margin="4,0,2,0"
HorizontalContentAlignment="Center"
Command="{Binding GoCommand}"
Style="{x:Static core:GlobalStyles.ButtonStyle}" />
Style="{x:Static core:GlobalStyles.ButtonStyle}"/>
<Button
Content="Discover"
Margin="2,0,0,0"
HorizontalContentAlignment="Center"
Command="{Binding DiscoverCommand}"
Style="{x:Static core:GlobalStyles.ButtonStyle}" />
</widgets:UniformGridWithSpacing>
</Grid>
</Grid>
<!-- Main Area -->
<Grid
Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition
Width="100" />
<ColumnDefinition
Width="*" />
</Grid.ColumnDefinitions>
Style="{x:Static core:GlobalStyles.ButtonStyle}"/>
</StackPanel>
<TextBlock Grid.Row="3" Text="Service:" Margin="4,0,4,0"></TextBlock>
<TreeView
Grid.Row="4" Margin="4"
Name="tree"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
ItemsSource="{Binding Path=Items}"
ItemsSource="{Binding Path=ServiceItems}"
ItemTemplate="{StaticResource HeaderTemplate}"
SelectedItemChanged="Tree_SelectedItemChanged"></TreeView>
SelectedItemChanged="Tree_SelectedItemChanged">
</TreeView>
<GridSplitter
Grid.Column="0"
Width="2"
Background="Black" />
<ListView Grid.Column="1"></ListView>
</Grid>
Grid.Row="4"
Width="2"/>
<ListView
Grid.Column="1" Grid.Row="4" Grid.ColumnSpan="2" Margin="4"
ItemsSource="{Binding Path=TwoValues}">
<ListView.View>
<GridView>
<GridViewColumn Header="Poperty" Width="150" DisplayMemberBinding="{Binding LeftValue}"></GridViewColumn>
<GridViewColumn Header="Value" Width="150" DisplayMemberBinding="{Binding RightValue}"></GridViewColumn>
</GridView>
</ListView.View>
</ListView>
<Border Grid.Row="5" Grid.ColumnSpan="3" Margin="4,0,4,0" BorderThickness="2" BorderBrush="LightGray">
<TextBlock></TextBlock>
</Border>
<TextBlock Grid.Row="6" Text="NameSpace:" Margin="4,0,4,0"></TextBlock>
<TextBox Grid.Row="7" Grid.ColumnSpan="3" Margin="4"></TextBox>
<widgets:UniformGridWithSpacing
Columns="2"
Grid.Column="0"
Grid.Row="2"
Grid.Column="2"
Grid.Row="8"
HorizontalAlignment="Right"
Margin="0,4,12,12">
<Button
@ -124,5 +139,25 @@ http://www.codeproject.com/KB/WPF/TreeViewWithViewModel.aspx?msg=3663052 @@ -124,5 +139,25 @@ http://www.codeproject.com/KB/WPF/TreeViewWithViewModel.aspx?msg=3663052
Style="{x:Static core:GlobalStyles.ButtonStyle}"
Click="cancelButtonClick" />
</widgets:UniformGridWithSpacing>
<!--
<widgets:UniformGridWithSpacing Background="Green"
Columns="3"
Grid.Column="2"
Margin="4,4,12,12"
HorizontalAlignment="Center">
<Button
Content="Go" HorizontalContentAlignment="Center"
Command="{Binding GoCommand}" />
<Button
Content="Discover" HorizontalContentAlignment="Center"
Command="{Binding DiscoverCommand}" />
</widgets:UniformGridWithSpacing>
</Grid>
</Grid>
-->
</Grid>
</Window>

1
src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/AddServiceReferenceDialog.xaml.cs

@ -60,6 +60,5 @@ namespace ICSharpCode.SharpDevelop.Gui.Dialogs.ReferenceDialog @@ -60,6 +60,5 @@ namespace ICSharpCode.SharpDevelop.Gui.Dialogs.ReferenceDialog
dc.ServiceItem = myItem;
}
}
}
}

92
src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/AddServiceReferenceViewModel.cs

@ -19,6 +19,7 @@ using System.Runtime.Remoting.Messaging; @@ -19,6 +19,7 @@ using System.Runtime.Remoting.Messaging;
using System.Web.Services.Description;
using System.Web.Services.Discovery;
using System.Windows;
using System.Windows.Data;
using System.Windows.Input;
using ICSharpCode.Core;
@ -52,6 +53,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Dialogs.ReferenceDialog @@ -52,6 +53,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Dialogs.ReferenceDialog
GoCommand = new RelayCommand(ExecuteGo,CanExecuteGo);
DiscoverCommand = new RelayCommand(ExecuteDiscover,CanExecuteDiscover);
TwoValues = new ObservableCollection<TwoValue>();
}
private string art;
@ -95,6 +97,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Dialogs.ReferenceDialog @@ -95,6 +97,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Dialogs.ReferenceDialog
}
}
#region Create List of services
private List<string> mruServices = new List<string>();
@ -117,6 +120,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Dialogs.ReferenceDialog @@ -117,6 +120,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Dialogs.ReferenceDialog
#endregion
#region Go
public System.Windows.Input.ICommand GoCommand {get; private set;}
@ -137,6 +141,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Dialogs.ReferenceDialog @@ -137,6 +141,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Dialogs.ReferenceDialog
#endregion
#region Discover
public System.Windows.Input.ICommand DiscoverCommand {get;private set;}
@ -335,20 +340,22 @@ namespace ICSharpCode.SharpDevelop.Gui.Dialogs.ReferenceDialog @@ -335,20 +340,22 @@ namespace ICSharpCode.SharpDevelop.Gui.Dialogs.ReferenceDialog
#endregion
#region new binding
List<ServiceItem> items = new List <ServiceItem>();
public List <ServiceItem> Items {
public List <ServiceItem> ServiceItems {
get {return items; }
set {
items = value;
base.RaisePropertyChanged(() =>Items);
base.RaisePropertyChanged(() =>ServiceItems);
}
}
ServiceItem myItem;
public ServiceItem ServiceItem {
@ -359,10 +366,73 @@ namespace ICSharpCode.SharpDevelop.Gui.Dialogs.ReferenceDialog @@ -359,10 +366,73 @@ namespace ICSharpCode.SharpDevelop.Gui.Dialogs.ReferenceDialog
}
}
void UpdateListView ()
private ObservableCollection<TwoValue> twoValues;
public ObservableCollection<TwoValue> TwoValues {
get { return twoValues; }
set {
twoValues = value;
base.RaisePropertyChanged(() =>TwoValues);
}
}
public void UpdateListView ()
{
TwoValues.Clear();
string l;
string r;
if(ServiceItem.Tag is ServiceDescription) {
ServiceDescription desc = (ServiceDescription)ServiceItem.Tag;
l = StringParser.Parse("${res:ICSharpCode.SharpDevelop.Gui.Dialogs.AddWebReferenceDialog.RetrievalUriProperty}");
r = desc.RetrievalUrl;
var tv = new TwoValue(l,r);
TwoValues.Add(tv);
}
else if(ServiceItem.Tag is Service) {
Service service = (Service)ServiceItem.Tag;
l = StringParser.Parse("${res:ICSharpCode.SharpDevelop.Gui.Dialogs.AddWebReferenceDialog.DocumentationProperty}");
r =service.Documentation;
var tv1 = new TwoValue(l,r);
TwoValues.Add(tv1);
}
else if(ServiceItem.Tag is Port) {
Port port = (Port)ServiceItem.Tag;
l = StringParser.Parse("${res:ICSharpCode.SharpDevelop.Gui.Dialogs.AddWebReferenceDialog.DocumentationProperty}");
r = port.Documentation;
var tv2 = new TwoValue(l,r);
TwoValues.Add(tv2);
l = StringParser.Parse("${res:ICSharpCode.SharpDevelop.Gui.Dialogs.AddWebReferenceDialog.BindingProperty}");
r = port.Binding.Name;
var tv3 = new TwoValue(l,r);
TwoValues.Add(tv3);
l = StringParser.Parse("${res:ICSharpCode.SharpDevelop.Gui.Dialogs.AddWebReferenceDialog.ServiceNameProperty}");
r = port.Service.Name;
var tv4 = new TwoValue(l,r);
TwoValues.Add(tv4);
}
else if(ServiceItem.Tag is Operation) {
Operation operation = (Operation)ServiceItem.Tag;
l = StringParser.Parse("${res:ICSharpCode.SharpDevelop.Gui.Dialogs.AddWebReferenceDialog.DocumentationProperty}");
r = operation.Documentation;
var tv5 = new TwoValue(l,r);
TwoValues.Add(tv5);
l = StringParser.Parse("${res:ICSharpCode.SharpDevelop.Gui.Dialogs.AddWebReferenceDialog.ParametersProperty}");
r = operation.ParameterOrderString;
var tv6 = new TwoValue(l,r);
TwoValues.Add(tv6);
}
}
void FillItems (ServiceDescriptionCollection descriptions)
{
@ -407,7 +477,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Dialogs.ReferenceDialog @@ -407,7 +477,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Dialogs.ReferenceDialog
}
}
}
Items = l;
ServiceItems = l;
}
@ -430,6 +500,20 @@ namespace ICSharpCode.SharpDevelop.Gui.Dialogs.ReferenceDialog @@ -430,6 +500,20 @@ namespace ICSharpCode.SharpDevelop.Gui.Dialogs.ReferenceDialog
}
public class TwoValue
{
public TwoValue(string left,string right)
{
LeftValue = left;
RightValue = right;
}
public string LeftValue {get;set;}
public string RightValue {get;set;}
}
public class ServiceItem
{
public ServiceItem (string name)

23
src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/Commands/ReferenceFolderNodeCommands.cs

@ -243,29 +243,6 @@ namespace ICSharpCode.SharpDevelop.Project.Commands @@ -243,29 +243,6 @@ namespace ICSharpCode.SharpDevelop.Project.Commands
o.DataContext = vm;
o.Owner = WorkbenchSingleton.MainWindow;
var b = o.ShowDialog();
if (b == true) {
/*
AbstractProjectBrowserTreeNode node = ProjectBrowserPad.Instance.SelectedNode;
var f = CompilableProject.GetAppConfigFile(node.Project,false);
// IProject project = (node != null) ? node.Project : ProjectService.CurrentProject;
CompilableProject project = ProjectService.CurrentProject as CompilableProject;
var wpo = WebProjectsOptions.Instance.GetWebProjectOptions(ProjectService.CurrentProject.Name);
var s1 = project.AssemblyName;
var s2 = project.CreateStartInfo();
var ss = s1 + s2;
*/
}
}
}

Loading…
Cancel
Save