Skip to content

Commit 36153fd

Browse files
author
WTDT
committed
Started working on the new Service Initialization process, stubbing out the new UI and some of the first calls to the underlying services. Updated the service refs and urls and VS made a whole bunch of changes to the underlying service files making a mess.
1 parent 7ebfcb7 commit 36153fd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+882
-406
lines changed

Applications/Scutex.ManagerWpf/Commands.cs

Lines changed: 11 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ public class Commands
112112
private static NewProductWindow _newProductWindow;
113113
private static UpdateProductWindow _updateProductWindow;
114114
private static FeaturesWindow _featuresWindow;
115+
private static ServiceInitializationWindow _serviceInitializationWindow;
115116
#endregion Windows
116117

117118
#region Constructor
@@ -664,102 +665,21 @@ private static void InitializeService(object sender, ExecutedRoutedEventArgs e)
664665
{
665666
if (mainWindow.ServicesScreen.SelectedService != null)
666667
{
667-
BackgroundWorker worker = new BackgroundWorker();
668-
mainWindow.ServicesScreen.StartSpinner();
669-
670-
Service service = mainWindow.ServicesScreen.SelectedService;
671-
672-
worker.DoWork += delegate(object s, DoWorkEventArgs args)
668+
if (_serviceInitializationWindow == null)
673669
{
674-
object[] data = args.Argument as object[];
675-
int resultCode = 0;
676-
677-
IServicesService _servicesService = ObjectLocator.GetInstance<IServicesService>();
678-
bool result;
679-
680-
try
681-
{
682-
result = _servicesService.InitializeService(service);
683-
}
684-
catch (System.ServiceModel.EndpointNotFoundException enf)
685-
{
686-
resultCode = 50;
687-
result = false;
688-
}
689-
catch
690-
{
691-
throw;
692-
}
693-
694-
if (!result)
695-
resultCode = 10;
696-
697-
bool testResult = false;
698-
699-
try
700-
{
701-
service.Initialized = true;
702-
_servicesService.SaveService(service);
703-
testResult = _servicesService.TestService(service);
704-
}
705-
catch (System.ServiceModel.EndpointNotFoundException enf)
706-
{
707-
resultCode = 50;
708-
result = false;
709-
}
710-
catch
711-
{
712-
throw;
713-
}
714-
715-
if (!testResult)
716-
{
717-
resultCode = 20;
718-
}
719-
else
720-
{
721-
service.Tested = true;
722-
_servicesService.SaveService(service);
723-
}
724-
725-
args.Result = resultCode;
726-
};
727-
728-
worker.RunWorkerCompleted += delegate(object s, RunWorkerCompletedEventArgs args)
670+
_serviceInitializationWindow = new ServiceInitializationWindow(mainWindow, mainWindow.ServicesScreen.SelectedService);
671+
_serviceInitializationWindow.Show();
672+
}
673+
else
729674
{
730-
int resultCode = (int)args.Result;
731-
732-
if (resultCode == 50)
733-
{
734-
MessageBox.Show("Cannot locate one or more of the services at the supplied urls. Please check the urls and try again.");
735-
}
736-
else if (resultCode == 20)
737-
{
738-
MessageBox.Show("Failed to test the service.");
739-
}
740-
else if (resultCode == 10)
741-
{
742-
MessageBox.Show("Failed to initialize the service.");
743-
}
744-
else
745-
{
746-
MessageBox.Show("Service has successfully been initialized and tested.");
747-
}
748-
749-
IEventAggregator eventAggregator = ObjectLocator.GetInstance<IEventAggregator>();
750-
eventAggregator.SendMessage<ServicesUpdatedEvent>();
751-
752-
mainWindow.ServicesScreen.StopSpinner();
753-
};
754-
755-
worker.RunWorkerAsync(new object[]
756-
{
757-
service
758-
});
675+
_serviceInitializationWindow.Close();
676+
_serviceInitializationWindow = new ServiceInitializationWindow(mainWindow, mainWindow.ServicesScreen.SelectedService);
677+
_serviceInitializationWindow.Show();
678+
}
759679
}
760680
else
761681
{
762-
MessageBox.Show("You must select a product first.");
682+
MessageBox.Show("You must select a service first.");
763683
}
764684
}
765685
}

Applications/Scutex.ManagerWpf/Scutex.ManagerWpf.csproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,9 @@
254254
<Compile Include="Windows\ProductsWindow.xaml.cs">
255255
<DependentUpon>ProductsWindow.xaml</DependentUpon>
256256
</Compile>
257+
<Compile Include="Windows\ServiceInitializationWindow.xaml.cs">
258+
<DependentUpon>ServiceInitializationWindow.xaml</DependentUpon>
259+
</Compile>
257260
<Compile Include="Windows\ServiceLogWindow.xaml.cs">
258261
<DependentUpon>ServiceLogWindow.xaml</DependentUpon>
259262
</Compile>
@@ -380,6 +383,10 @@
380383
<SubType>Designer</SubType>
381384
<Generator>MSBuild:Compile</Generator>
382385
</Page>
386+
<Page Include="Windows\ServiceInitializationWindow.xaml">
387+
<SubType>Designer</SubType>
388+
<Generator>MSBuild:Compile</Generator>
389+
</Page>
383390
<Page Include="Windows\ServiceLogWindow.xaml">
384391
<SubType>Designer</SubType>
385392
<Generator>MSBuild:Compile</Generator>

Applications/Scutex.ManagerWpf/Windows/FeaturesWindow.xaml

Lines changed: 81 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
<Window
2-
x:Class="WaveTech.Scutex.Manager.Windows.FeaturesWindow"
3-
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5-
xmlns:themes="clr-namespace:WPF.Themes;assembly=WPF.Themes"
6-
xmlns:Controls="clr-namespace:WaveTech.Scutex.Manager.Controls" xmlns:Forms="clr-namespace:WaveTech.Scutex.Manager.Forms"
7-
x:Name="productFeaturesWindow"
8-
xmlns:dg="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit" Title="Product Features" Height="450" Width="450" WindowStartupLocation="CenterOwner">
1+
<Window x:Class="WaveTech.Scutex.Manager.Windows.FeaturesWindow"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:Controls="clr-namespace:WaveTech.Scutex.Manager.Controls"
5+
xmlns:dg="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit"
6+
xmlns:Forms="clr-namespace:WaveTech.Scutex.Manager.Forms"
7+
xmlns:themes="clr-namespace:WPF.Themes;assembly=WPF.Themes"
8+
x:Name="productFeaturesWindow"
9+
Title="Product Features"
10+
Width="450"
11+
Height="450"
12+
WindowStartupLocation="CenterOwner">
913
<Window.Resources>
1014
<ResourceDictionary>
1115
<ResourceDictionary.MergedDictionaries>
@@ -23,13 +27,33 @@
2327
<ColumnDefinition />
2428
</Grid.ColumnDefinitions>
2529

26-
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Row="0" Grid.Column="0" Orientation="Horizontal" >
30+
<StackPanel Grid.Row="0"
31+
Grid.Column="0"
32+
HorizontalAlignment="Left"
33+
VerticalAlignment="Center"
34+
Orientation="Horizontal">
2735
<TextBlock Width="10" />
28-
<TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="Black" Grid.Row="0" Grid.Column="0" Text="Features for Product: " />
29-
<TextBlock x:Name="lblProductName" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="Black" FontWeight="Bold" Grid.Row="0" Grid.Column="0" Text="" />
36+
<TextBlock Grid.Row="0"
37+
Grid.Column="0"
38+
HorizontalAlignment="Left"
39+
VerticalAlignment="Center"
40+
Foreground="Black"
41+
Text="Features for Product: " />
42+
<TextBlock x:Name="lblProductName"
43+
Grid.Row="0"
44+
Grid.Column="0"
45+
HorizontalAlignment="Left"
46+
VerticalAlignment="Center"
47+
FontWeight="Bold"
48+
Foreground="Black"
49+
Text="" />
3050
</StackPanel>
3151

32-
<GroupBox Grid.Row="1" Grid.Column="0" Header="Add New Feature" Foreground="Black" Margin="4,4,4,4">
52+
<GroupBox Grid.Row="1"
53+
Grid.Column="0"
54+
Margin="4,4,4,4"
55+
Foreground="Black"
56+
Header="Add New Feature">
3357
<Grid>
3458
<Grid.RowDefinitions>
3559
<RowDefinition Height="25" />
@@ -42,16 +66,31 @@
4266
<ColumnDefinition />
4367
</Grid.ColumnDefinitions>
4468

45-
<TextBlock Grid.Row="0" Text="Feature Name:" Foreground="Black" VerticalAlignment="Bottom" />
46-
<TextBox Grid.Row="1" x:Name="txtFeatureName" />
47-
<TextBlock Grid.Row="2" Text="Feature Description:" Foreground="Black" VerticalAlignment="Bottom" />
48-
<TextBox Grid.Row="3" x:Name="txtFeatureDescription" />
69+
<TextBlock Grid.Row="0"
70+
VerticalAlignment="Bottom"
71+
Foreground="Black"
72+
Text="Feature Name:" />
73+
<TextBox x:Name="txtFeatureName" Grid.Row="1" />
74+
<TextBlock Grid.Row="2"
75+
VerticalAlignment="Bottom"
76+
Foreground="Black"
77+
Text="Feature Description:" />
78+
<TextBox x:Name="txtFeatureDescription" Grid.Row="3" />
4979

50-
<Button Grid.Row="4" x:Name="btnAddFeature" Content="Add Feature" Margin="4,4,4,4" HorizontalAlignment="Right" Click="btnAddFeature_Click" />
80+
<Button x:Name="btnAddFeature"
81+
Grid.Row="4"
82+
Margin="4,4,4,4"
83+
HorizontalAlignment="Right"
84+
Click="btnAddFeature_Click"
85+
Content="Add Feature" />
5186
</Grid>
5287
</GroupBox>
5388

54-
<GroupBox Grid.Row="2" Grid.Column="0" Header="Features" Foreground="Black" Margin="4,4,4,4">
89+
<GroupBox Grid.Row="2"
90+
Grid.Column="0"
91+
Margin="4,4,4,4"
92+
Foreground="Black"
93+
Header="Features">
5594
<Grid>
5695
<Grid.RowDefinitions>
5796
<RowDefinition Height="*" />
@@ -60,19 +99,34 @@
6099
<Grid.ColumnDefinitions>
61100
<ColumnDefinition />
62101
</Grid.ColumnDefinitions>
63-
<DataGrid x:Name="gridFeatures" Grid.Row="0" ItemsSource="{Binding SelectedProduct.Features, ElementName=productFeaturesWindow, Mode=TwoWay}" AutoGenerateColumns="False"
64-
CanUserAddRows="False" CanUserDeleteRows="False" SelectionMode="Single" VerticalAlignment="Stretch">
102+
<DataGrid x:Name="gridFeatures"
103+
Grid.Row="0"
104+
VerticalAlignment="Stretch"
105+
AutoGenerateColumns="False"
106+
CanUserAddRows="False"
107+
CanUserDeleteRows="False"
108+
ItemsSource="{Binding SelectedProduct.Features,
109+
ElementName=productFeaturesWindow,
110+
Mode=TwoWay}"
111+
SelectionMode="Single">
65112
<DataGrid.Columns>
66-
<DataGridTextColumn
67-
Header="Name" Width="1*" IsReadOnly="True"
68-
Binding="{Binding Path=Name}"/>
69-
<DataGridTextColumn
70-
Header="Description" Width="2*" IsReadOnly="True"
71-
Binding="{Binding Path=Description}"/>
113+
<DataGridTextColumn Width="1*"
114+
Binding="{Binding Path=Name}"
115+
Header="Name"
116+
IsReadOnly="True" />
117+
<DataGridTextColumn Width="2*"
118+
Binding="{Binding Path=Description}"
119+
Header="Description"
120+
IsReadOnly="True" />
72121
</DataGrid.Columns>
73122
</DataGrid>
74123

75-
<Button Grid.Row="1" x:Name="btnRemoveSelected" Margin="4,4,4,4" Content="Remove Selected" HorizontalAlignment="Right" Click="btnRemoveSelected_Click" />
124+
<Button x:Name="btnRemoveSelected"
125+
Grid.Row="1"
126+
Margin="4,4,4,4"
127+
HorizontalAlignment="Right"
128+
Click="btnRemoveSelected_Click"
129+
Content="Remove Selected" />
76130
</Grid>
77131
</GroupBox>
78132
</Grid>

0 commit comments

Comments
 (0)