summaryrefslogtreecommitdiff
path: root/cs/demo/Ice/wpf
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2010-02-11 05:10:43 +0100
committerJose <jose@zeroc.com>2010-02-11 05:10:43 +0100
commitd3e520a951ced49d836e94936451a529d301e562 (patch)
tree366f383dbc98a8fb3c2e2744c6581736aa4cd034 /cs/demo/Ice/wpf
parentbug 4380: stringToProxy docu (diff)
downloadice-d3e520a951ced49d836e94936451a529d301e562.tar.bz2
ice-d3e520a951ced49d836e94936451a529d301e562.tar.xz
ice-d3e520a951ced49d836e94936451a529d301e562.zip
4651 - Inconsistent line endings
Diffstat (limited to 'cs/demo/Ice/wpf')
-rw-r--r--cs/demo/Ice/wpf/App.xaml36
-rw-r--r--cs/demo/Ice/wpf/App.xaml.cs50
-rw-r--r--cs/demo/Ice/wpf/HelloWindow.xaml182
-rw-r--r--cs/demo/Ice/wpf/HelloWindow.xaml.cs588
-rwxr-xr-xcs/demo/Ice/wpf/Properties/AssemblyInfo.cs110
-rwxr-xr-xcs/demo/Ice/wpf/Properties/Resources.Designer.cs142
-rwxr-xr-xcs/demo/Ice/wpf/Properties/Resources.resx2
-rwxr-xr-xcs/demo/Ice/wpf/Properties/Settings.Designer.cs60
-rwxr-xr-xcs/demo/Ice/wpf/Properties/Settings.settings2
9 files changed, 586 insertions, 586 deletions
diff --git a/cs/demo/Ice/wpf/App.xaml b/cs/demo/Ice/wpf/App.xaml
index a72bc4d3452..be5bee38505 100644
--- a/cs/demo/Ice/wpf/App.xaml
+++ b/cs/demo/Ice/wpf/App.xaml
@@ -1,18 +1,18 @@
-<!--
-// **********************************************************************
-//
-// Copyright (c) 2003-2010 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
--->
-<Application x:Class="Ice.wpf.client.App"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- StartupUri="HelloWindow.xaml">
- <Application.Resources>
-
- </Application.Resources>
-</Application>
+<!--
+// **********************************************************************
+//
+// Copyright (c) 2003-2010 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+-->
+<Application x:Class="Ice.wpf.client.App"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ StartupUri="HelloWindow.xaml">
+ <Application.Resources>
+
+ </Application.Resources>
+</Application>
diff --git a/cs/demo/Ice/wpf/App.xaml.cs b/cs/demo/Ice/wpf/App.xaml.cs
index 67609070928..e1067676eeb 100644
--- a/cs/demo/Ice/wpf/App.xaml.cs
+++ b/cs/demo/Ice/wpf/App.xaml.cs
@@ -1,25 +1,25 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2010 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-using System;
-using System.Collections.Generic;
-using System.Configuration;
-using System.Data;
-using System.Linq;
-using System.Windows;
-
-namespace Ice.wpf.client
-{
- /// <summary>
- /// Interaction logic for App.xaml
- /// </summary>
- public partial class App : System.Windows.Application
- {
- }
-}
+// **********************************************************************
+//
+// Copyright (c) 2003-2010 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Data;
+using System.Linq;
+using System.Windows;
+
+namespace Ice.wpf.client
+{
+ /// <summary>
+ /// Interaction logic for App.xaml
+ /// </summary>
+ public partial class App : System.Windows.Application
+ {
+ }
+}
diff --git a/cs/demo/Ice/wpf/HelloWindow.xaml b/cs/demo/Ice/wpf/HelloWindow.xaml
index 1285e27485d..eca181199d1 100644
--- a/cs/demo/Ice/wpf/HelloWindow.xaml
+++ b/cs/demo/Ice/wpf/HelloWindow.xaml
@@ -1,91 +1,91 @@
-<!--
-// **********************************************************************
-//
-// Copyright (c) 2003-2010 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
--->
-<Window x:Class="Ice.wpf.client.HelloWindow"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- Title="Ice - Hello World!" SizeToContent="WidthAndHeight" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
- Loaded="Window_Loaded" Closed="Window_Closed" Width="300" Height="190" MinWidth="300" MinHeight="190">
- <Grid Margin="10">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*"/>
- </Grid.ColumnDefinitions>
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="Auto"/>
- </Grid.RowDefinitions>
-
- <Grid Grid.Row="0" Grid.Column="0">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*"/>
- <ColumnDefinition Width="2*"/>
- </Grid.ColumnDefinitions>
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" MinHeight="23" />
- <RowDefinition Height="Auto" MinHeight="23" />
- <RowDefinition Height="Auto" MinHeight="28" />
- <RowDefinition Height="Auto" MinHeight="23" />
- </Grid.RowDefinitions>
- <Label Grid.Row="0" Grid.Column="0" Name="label4" VerticalAlignment="Top" HorizontalAlignment="Left" Width="70" >Hostname</Label>
- <Label Grid.Row="1" Grid.Column="0" Name="label2" VerticalAlignment="Top" HorizontalAlignment="Left" Width="70">Mode</Label>
- <Label Grid.Row="2" Grid.Column="0" Name="label1" Height="28" HorizontalAlignment="Left" VerticalAlignment="Top" Width="70">Timeout</Label>
- <Label Grid.Row="3" Grid.Column="0" Name="label3" VerticalAlignment="Top" HorizontalAlignment="Left" Width="70">Delay</Label>
-
- <TextBox Grid.Row="0" Grid.Column="1" Name="hostname" VerticalAlignment="Top">127.0.0.1</TextBox>
- <ComboBox Grid.Row="1" Grid.Column="1" Name="deliveryMode" VerticalAlignment="Top" IsReadOnly="True" SelectedIndex="0">
- <ComboBoxItem>Twoway</ComboBoxItem>
- <ComboBoxItem>Twoway Secure</ComboBoxItem>
- <ComboBoxItem>Oneway</ComboBoxItem>
- <ComboBoxItem>Oneway Batch</ComboBoxItem>
- <ComboBoxItem>Oneway Secure</ComboBoxItem>
- <ComboBoxItem>Oneway Secure Batch</ComboBoxItem>
- <ComboBoxItem>Datagram</ComboBoxItem>
- <ComboBoxItem>Datagram Batch</ComboBoxItem>
- </ComboBox>
- <Grid Grid.Row="2" Grid.Column="1">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="4*"/>
- <ColumnDefinition Width="*"/>
- </Grid.ColumnDefinitions>
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto"/>
- </Grid.RowDefinitions>
- <Slider Grid.Row="0" Grid.Column="0" Name="timeoutSlider" VerticalAlignment="Top" Maximum="5000" Height="22" ValueChanged="timeoutSlider_ValueChanged" />
- <Label Grid.Row="0" Grid.Column="1" Name="timeoutLabel" VerticalAlignment="Top" HorizontalAlignment="Left">0.0</Label>
- </Grid>
- <Grid Grid.Row="3" Grid.Column="1">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="4*"/>
- <ColumnDefinition Width="*"/>
- </Grid.ColumnDefinitions>
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto"/>
- </Grid.RowDefinitions>
- <Slider Grid.Row="0" Grid.Column="0" Name="delaySlider" VerticalAlignment="Top" Maximum="5000" Height="22" ValueChanged="delaySlider_ValueChanged" />
- <Label Grid.Row="0" Grid.Column="1" Name="delayLabel" VerticalAlignment="Top" HorizontalAlignment="Left">0.0</Label>
- </Grid>
- </Grid>
- <Grid Grid.Row="1" Grid.Column="0" Margin="0 10 0 5">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*"/>
- <ColumnDefinition Width="*"/>
- <ColumnDefinition Width="*"/>
- </Grid.ColumnDefinitions>
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto"/>
- </Grid.RowDefinitions>
- <Button Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Center" Name="sayHello" Click="sayHello_Click">Hello World!</Button>
- <Button Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center" Name="shutdown" Click="shutdown_Click">Shutdown</Button>
- <Button Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Center" Name="flush" Click="flush_Click">Flush</Button>
- </Grid>
- <Label Grid.Row="2" Grid.Column="0" Name="status">Ready</Label>
- </Grid>
-</Window>
+<!--
+// **********************************************************************
+//
+// Copyright (c) 2003-2010 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+-->
+<Window x:Class="Ice.wpf.client.HelloWindow"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ Title="Ice - Hello World!" SizeToContent="WidthAndHeight" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
+ Loaded="Window_Loaded" Closed="Window_Closed" Width="300" Height="190" MinWidth="300" MinHeight="190">
+ <Grid Margin="10">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="*"/>
+ </Grid.ColumnDefinitions>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto"/>
+ <RowDefinition Height="Auto"/>
+ <RowDefinition Height="Auto"/>
+ </Grid.RowDefinitions>
+
+ <Grid Grid.Row="0" Grid.Column="0">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="*"/>
+ <ColumnDefinition Width="2*"/>
+ </Grid.ColumnDefinitions>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" MinHeight="23" />
+ <RowDefinition Height="Auto" MinHeight="23" />
+ <RowDefinition Height="Auto" MinHeight="28" />
+ <RowDefinition Height="Auto" MinHeight="23" />
+ </Grid.RowDefinitions>
+ <Label Grid.Row="0" Grid.Column="0" Name="label4" VerticalAlignment="Top" HorizontalAlignment="Left" Width="70" >Hostname</Label>
+ <Label Grid.Row="1" Grid.Column="0" Name="label2" VerticalAlignment="Top" HorizontalAlignment="Left" Width="70">Mode</Label>
+ <Label Grid.Row="2" Grid.Column="0" Name="label1" Height="28" HorizontalAlignment="Left" VerticalAlignment="Top" Width="70">Timeout</Label>
+ <Label Grid.Row="3" Grid.Column="0" Name="label3" VerticalAlignment="Top" HorizontalAlignment="Left" Width="70">Delay</Label>
+
+ <TextBox Grid.Row="0" Grid.Column="1" Name="hostname" VerticalAlignment="Top">127.0.0.1</TextBox>
+ <ComboBox Grid.Row="1" Grid.Column="1" Name="deliveryMode" VerticalAlignment="Top" IsReadOnly="True" SelectedIndex="0">
+ <ComboBoxItem>Twoway</ComboBoxItem>
+ <ComboBoxItem>Twoway Secure</ComboBoxItem>
+ <ComboBoxItem>Oneway</ComboBoxItem>
+ <ComboBoxItem>Oneway Batch</ComboBoxItem>
+ <ComboBoxItem>Oneway Secure</ComboBoxItem>
+ <ComboBoxItem>Oneway Secure Batch</ComboBoxItem>
+ <ComboBoxItem>Datagram</ComboBoxItem>
+ <ComboBoxItem>Datagram Batch</ComboBoxItem>
+ </ComboBox>
+ <Grid Grid.Row="2" Grid.Column="1">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="4*"/>
+ <ColumnDefinition Width="*"/>
+ </Grid.ColumnDefinitions>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto"/>
+ </Grid.RowDefinitions>
+ <Slider Grid.Row="0" Grid.Column="0" Name="timeoutSlider" VerticalAlignment="Top" Maximum="5000" Height="22" ValueChanged="timeoutSlider_ValueChanged" />
+ <Label Grid.Row="0" Grid.Column="1" Name="timeoutLabel" VerticalAlignment="Top" HorizontalAlignment="Left">0.0</Label>
+ </Grid>
+ <Grid Grid.Row="3" Grid.Column="1">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="4*"/>
+ <ColumnDefinition Width="*"/>
+ </Grid.ColumnDefinitions>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto"/>
+ </Grid.RowDefinitions>
+ <Slider Grid.Row="0" Grid.Column="0" Name="delaySlider" VerticalAlignment="Top" Maximum="5000" Height="22" ValueChanged="delaySlider_ValueChanged" />
+ <Label Grid.Row="0" Grid.Column="1" Name="delayLabel" VerticalAlignment="Top" HorizontalAlignment="Left">0.0</Label>
+ </Grid>
+ </Grid>
+ <Grid Grid.Row="1" Grid.Column="0" Margin="0 10 0 5">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="*"/>
+ <ColumnDefinition Width="*"/>
+ <ColumnDefinition Width="*"/>
+ </Grid.ColumnDefinitions>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto"/>
+ </Grid.RowDefinitions>
+ <Button Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Center" Name="sayHello" Click="sayHello_Click">Hello World!</Button>
+ <Button Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center" Name="shutdown" Click="shutdown_Click">Shutdown</Button>
+ <Button Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Center" Name="flush" Click="flush_Click">Flush</Button>
+ </Grid>
+ <Label Grid.Row="2" Grid.Column="0" Name="status">Ready</Label>
+ </Grid>
+</Window>
diff --git a/cs/demo/Ice/wpf/HelloWindow.xaml.cs b/cs/demo/Ice/wpf/HelloWindow.xaml.cs
index 88c42f6bd67..542e873b4c2 100644
--- a/cs/demo/Ice/wpf/HelloWindow.xaml.cs
+++ b/cs/demo/Ice/wpf/HelloWindow.xaml.cs
@@ -1,294 +1,294 @@
-// **********************************************************************
-//
-// Copyright(c) 2003-2010 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
-using System.Windows.Threading;
-using System.Diagnostics;
-
-namespace Ice.wpf.client
-{
- /// <summary>
- /// Interaction logic for HelloWindow.xaml
- /// </summary>
- public partial class HelloWindow : Window
- {
- public HelloWindow()
- {
- InitializeComponent();
- locateOnScreen(this);
- }
-
- static String TWOWAY = "Twoway";
- static String TWOWAY_SECURE = "Twoway Secure";
- static String ONEWAY = "Oneway";
- static String ONEWAY_BATCH = "Oneway Batch";
- static String ONEWAY_SECURE = "Oneway Secure";
- static String ONEWAY_SECURE_BATCH = "Oneway Secure Batch";
- static String DATAGRAM = "Datagram";
- static String DATAGRAM_BATCH = "Datagram Batch";
-
- private void Window_Loaded(object sender, EventArgs e)
- {
- try
- {
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties();
- initData.properties.load("config.client");
- initData.dispatcher = delegate(System.Action action, Ice.Connection connection)
- {
- Dispatcher.BeginInvoke(DispatcherPriority.Normal, action);
- };
- _communicator = Ice.Util.initialize(initData);
- }
- catch(Ice.LocalException ex)
- {
- handleException(ex);
- }
- }
-
- private void Window_Closed(object sender, EventArgs e)
- {
- if(_communicator == null)
- {
- return;
- }
-
- _communicator.destroy();
- _communicator = null;
- }
-
- private bool deliveryModeIsBatch()
- {
- return deliveryMode.Text.Equals(ONEWAY_BATCH) ||
- deliveryMode.Text.Equals(ONEWAY_SECURE_BATCH) ||
- deliveryMode.Text.Equals(DATAGRAM_BATCH);
- }
-
- private Ice.ObjectPrx deliveryModeApply(Ice.ObjectPrx prx)
- {
- if(deliveryMode.Text.Equals(TWOWAY))
- {
- prx = prx.ice_twoway();
- }
- else if(deliveryMode.Text.Equals(TWOWAY_SECURE))
- {
- prx = prx.ice_twoway().ice_secure(true);
- }
- else if(deliveryMode.Text.Equals(ONEWAY))
- {
- prx = prx.ice_oneway();
- }
- else if(deliveryMode.Text.Equals(ONEWAY_BATCH))
- {
- prx = prx.ice_batchOneway();
- }
- else if(deliveryMode.Text.Equals(ONEWAY_SECURE))
- {
- prx = prx.ice_oneway().ice_secure(true);
- }
- else if(deliveryMode.Text.Equals(ONEWAY_SECURE_BATCH))
- {
- prx = prx.ice_batchOneway().ice_secure(true);
- }
- else if(deliveryMode.Text.Equals(DATAGRAM))
- {
- prx = prx.ice_datagram();
- }
- else if(deliveryMode.Text.Equals(DATAGRAM_BATCH))
- {
- prx = prx.ice_batchDatagram();
- }
-
- return prx;
- }
-
- class SayHelloCB
- {
- public SayHelloCB(HelloWindow window)
- {
- _window = window;
- }
-
- public void response()
- {
- lock(this)
- {
- Debug.Assert(!_response);
- _response = true;
- _window.status.Content = "Ready";
- }
- }
-
- public void exception(Exception ex)
- {
- lock(this)
- {
- Debug.Assert(!_response);
- _response = true;
- _window.handleException(ex);
- }
- }
-
- public void sent(bool sentSynchronously)
- {
- lock(this)
- {
- if(_response)
- {
- return;
- }
- if(_window.deliveryMode.Text.Equals(TWOWAY) || _window.deliveryMode.Text.Equals(TWOWAY_SECURE))
- {
- _window.status.Content = "Waiting for response";
- }
- else
- {
- _window.status.Content = "Ready";
- }
- }
- }
-
- private bool _response = false;
- private HelloWindow _window;
- }
-
- private void sayHello_Click(object sender, RoutedEventArgs e)
- {
- Demo.HelloPrx hello = createProxy();
- if(hello == null)
- {
- return;
- }
-
- int delay =(int)delaySlider.Value;
- try
- {
- if(!deliveryModeIsBatch())
- {
- status.Content = "Sending request";
- SayHelloCB cb = new SayHelloCB(this);
- hello.begin_sayHello(delay).whenCompleted(cb.response, cb.exception).whenSent(cb.sent);
- }
- else
- {
- flush.IsEnabled = true;
- hello.sayHello(delay);
- status.Content = "Queued sayHello request";
- }
- }
- catch(Ice.LocalException ex)
- {
- handleException(ex);
- }
- }
-
- private void handleException(Exception ex)
- {
- status.Content = ex.GetType();
- }
-
- private void shutdown_Click(object sender, RoutedEventArgs e)
- {
- Demo.HelloPrx hello = createProxy();
- if(hello == null)
- {
- return;
- }
-
- int delay =(int)delaySlider.Value;
-
- try
- {
- if(!deliveryModeIsBatch())
- {
- AsyncResult<Demo.Callback_Hello_shutdown> result = hello.begin_shutdown();
- status.Content = "Sending request";
- result.whenCompleted(delegate()
- {
- status.Content = "Ready";
- },
- delegate(Exception ex)
- {
- handleException(ex);
- });
- }
- else
- {
- flush.IsEnabled = true;
- hello.shutdown();
- status.Content = "Queued shutdown request";
- }
- }
- catch(Ice.LocalException ex)
- {
- handleException(ex);
- }
- }
-
- private void flush_Click(object sender, RoutedEventArgs e)
- {
- Ice.AsyncResult r = _communicator.begin_flushBatchRequests();
- r.whenCompleted(handleException);
-
- flush.IsEnabled = false;
- status.Content = "Flushed batch requests";
- }
-
- Demo.HelloPrx
- createProxy()
- {
- String host = hostname.Text.Trim();
- if(host.Length == 0)
- {
- status.Content = "No hostname";
- return null;
- }
-
- String s = "hello:tcp -h " + host + " -p 10000:ssl -h " + host + " -p 10001:udp -h " + host + " -p 10000";
- Ice.ObjectPrx prx = _communicator.stringToProxy(s);
- prx = deliveryModeApply(prx);
- int timeout =(int)timeoutSlider.Value;
- if(timeout != 0)
- {
- prx = prx.ice_timeout(timeout);
- }
- return Demo.HelloPrxHelper.uncheckedCast(prx);
- }
-
- private void timeoutSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
- {
- timeoutLabel.Content =(timeoutSlider.Value / 1000.0).ToString("F1");
- }
-
- private void delaySlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
- {
- delayLabel.Content =(delaySlider.Value / 1000.0).ToString("F1");
- }
-
- static private void locateOnScreen(System.Windows.Window window)
- {
- window.Left =(System.Windows.SystemParameters.PrimaryScreenWidth - window.Width) / 2;
- window.Top =(System.Windows.SystemParameters.PrimaryScreenHeight - window.Height) / 2;
- }
-
- private Ice.Communicator _communicator = null;
- }
-}
+// **********************************************************************
+//
+// Copyright(c) 2003-2010 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using System.Windows.Threading;
+using System.Diagnostics;
+
+namespace Ice.wpf.client
+{
+ /// <summary>
+ /// Interaction logic for HelloWindow.xaml
+ /// </summary>
+ public partial class HelloWindow : Window
+ {
+ public HelloWindow()
+ {
+ InitializeComponent();
+ locateOnScreen(this);
+ }
+
+ static String TWOWAY = "Twoway";
+ static String TWOWAY_SECURE = "Twoway Secure";
+ static String ONEWAY = "Oneway";
+ static String ONEWAY_BATCH = "Oneway Batch";
+ static String ONEWAY_SECURE = "Oneway Secure";
+ static String ONEWAY_SECURE_BATCH = "Oneway Secure Batch";
+ static String DATAGRAM = "Datagram";
+ static String DATAGRAM_BATCH = "Datagram Batch";
+
+ private void Window_Loaded(object sender, EventArgs e)
+ {
+ try
+ {
+ Ice.InitializationData initData = new Ice.InitializationData();
+ initData.properties = Ice.Util.createProperties();
+ initData.properties.load("config.client");
+ initData.dispatcher = delegate(System.Action action, Ice.Connection connection)
+ {
+ Dispatcher.BeginInvoke(DispatcherPriority.Normal, action);
+ };
+ _communicator = Ice.Util.initialize(initData);
+ }
+ catch(Ice.LocalException ex)
+ {
+ handleException(ex);
+ }
+ }
+
+ private void Window_Closed(object sender, EventArgs e)
+ {
+ if(_communicator == null)
+ {
+ return;
+ }
+
+ _communicator.destroy();
+ _communicator = null;
+ }
+
+ private bool deliveryModeIsBatch()
+ {
+ return deliveryMode.Text.Equals(ONEWAY_BATCH) ||
+ deliveryMode.Text.Equals(ONEWAY_SECURE_BATCH) ||
+ deliveryMode.Text.Equals(DATAGRAM_BATCH);
+ }
+
+ private Ice.ObjectPrx deliveryModeApply(Ice.ObjectPrx prx)
+ {
+ if(deliveryMode.Text.Equals(TWOWAY))
+ {
+ prx = prx.ice_twoway();
+ }
+ else if(deliveryMode.Text.Equals(TWOWAY_SECURE))
+ {
+ prx = prx.ice_twoway().ice_secure(true);
+ }
+ else if(deliveryMode.Text.Equals(ONEWAY))
+ {
+ prx = prx.ice_oneway();
+ }
+ else if(deliveryMode.Text.Equals(ONEWAY_BATCH))
+ {
+ prx = prx.ice_batchOneway();
+ }
+ else if(deliveryMode.Text.Equals(ONEWAY_SECURE))
+ {
+ prx = prx.ice_oneway().ice_secure(true);
+ }
+ else if(deliveryMode.Text.Equals(ONEWAY_SECURE_BATCH))
+ {
+ prx = prx.ice_batchOneway().ice_secure(true);
+ }
+ else if(deliveryMode.Text.Equals(DATAGRAM))
+ {
+ prx = prx.ice_datagram();
+ }
+ else if(deliveryMode.Text.Equals(DATAGRAM_BATCH))
+ {
+ prx = prx.ice_batchDatagram();
+ }
+
+ return prx;
+ }
+
+ class SayHelloCB
+ {
+ public SayHelloCB(HelloWindow window)
+ {
+ _window = window;
+ }
+
+ public void response()
+ {
+ lock(this)
+ {
+ Debug.Assert(!_response);
+ _response = true;
+ _window.status.Content = "Ready";
+ }
+ }
+
+ public void exception(Exception ex)
+ {
+ lock(this)
+ {
+ Debug.Assert(!_response);
+ _response = true;
+ _window.handleException(ex);
+ }
+ }
+
+ public void sent(bool sentSynchronously)
+ {
+ lock(this)
+ {
+ if(_response)
+ {
+ return;
+ }
+ if(_window.deliveryMode.Text.Equals(TWOWAY) || _window.deliveryMode.Text.Equals(TWOWAY_SECURE))
+ {
+ _window.status.Content = "Waiting for response";
+ }
+ else
+ {
+ _window.status.Content = "Ready";
+ }
+ }
+ }
+
+ private bool _response = false;
+ private HelloWindow _window;
+ }
+
+ private void sayHello_Click(object sender, RoutedEventArgs e)
+ {
+ Demo.HelloPrx hello = createProxy();
+ if(hello == null)
+ {
+ return;
+ }
+
+ int delay =(int)delaySlider.Value;
+ try
+ {
+ if(!deliveryModeIsBatch())
+ {
+ status.Content = "Sending request";
+ SayHelloCB cb = new SayHelloCB(this);
+ hello.begin_sayHello(delay).whenCompleted(cb.response, cb.exception).whenSent(cb.sent);
+ }
+ else
+ {
+ flush.IsEnabled = true;
+ hello.sayHello(delay);
+ status.Content = "Queued sayHello request";
+ }
+ }
+ catch(Ice.LocalException ex)
+ {
+ handleException(ex);
+ }
+ }
+
+ private void handleException(Exception ex)
+ {
+ status.Content = ex.GetType();
+ }
+
+ private void shutdown_Click(object sender, RoutedEventArgs e)
+ {
+ Demo.HelloPrx hello = createProxy();
+ if(hello == null)
+ {
+ return;
+ }
+
+ int delay =(int)delaySlider.Value;
+
+ try
+ {
+ if(!deliveryModeIsBatch())
+ {
+ AsyncResult<Demo.Callback_Hello_shutdown> result = hello.begin_shutdown();
+ status.Content = "Sending request";
+ result.whenCompleted(delegate()
+ {
+ status.Content = "Ready";
+ },
+ delegate(Exception ex)
+ {
+ handleException(ex);
+ });
+ }
+ else
+ {
+ flush.IsEnabled = true;
+ hello.shutdown();
+ status.Content = "Queued shutdown request";
+ }
+ }
+ catch(Ice.LocalException ex)
+ {
+ handleException(ex);
+ }
+ }
+
+ private void flush_Click(object sender, RoutedEventArgs e)
+ {
+ Ice.AsyncResult r = _communicator.begin_flushBatchRequests();
+ r.whenCompleted(handleException);
+
+ flush.IsEnabled = false;
+ status.Content = "Flushed batch requests";
+ }
+
+ Demo.HelloPrx
+ createProxy()
+ {
+ String host = hostname.Text.Trim();
+ if(host.Length == 0)
+ {
+ status.Content = "No hostname";
+ return null;
+ }
+
+ String s = "hello:tcp -h " + host + " -p 10000:ssl -h " + host + " -p 10001:udp -h " + host + " -p 10000";
+ Ice.ObjectPrx prx = _communicator.stringToProxy(s);
+ prx = deliveryModeApply(prx);
+ int timeout =(int)timeoutSlider.Value;
+ if(timeout != 0)
+ {
+ prx = prx.ice_timeout(timeout);
+ }
+ return Demo.HelloPrxHelper.uncheckedCast(prx);
+ }
+
+ private void timeoutSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
+ {
+ timeoutLabel.Content =(timeoutSlider.Value / 1000.0).ToString("F1");
+ }
+
+ private void delaySlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
+ {
+ delayLabel.Content =(delaySlider.Value / 1000.0).ToString("F1");
+ }
+
+ static private void locateOnScreen(System.Windows.Window window)
+ {
+ window.Left =(System.Windows.SystemParameters.PrimaryScreenWidth - window.Width) / 2;
+ window.Top =(System.Windows.SystemParameters.PrimaryScreenHeight - window.Height) / 2;
+ }
+
+ private Ice.Communicator _communicator = null;
+ }
+}
diff --git a/cs/demo/Ice/wpf/Properties/AssemblyInfo.cs b/cs/demo/Ice/wpf/Properties/AssemblyInfo.cs
index 477b3052629..a4393ba1e71 100755
--- a/cs/demo/Ice/wpf/Properties/AssemblyInfo.cs
+++ b/cs/demo/Ice/wpf/Properties/AssemblyInfo.cs
@@ -1,55 +1,55 @@
-using System.Reflection;
-using System.Resources;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Windows;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("Ice.wpf.client")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Ice.wpf.client")]
-[assembly: AssemblyCopyright("Copyright © 2010")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-//In order to begin building localizable applications, set
-//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
-//inside a <PropertyGroup>. For example, if you are using US english
-//in your source files, set the <UICulture> to en-US. Then uncomment
-//the NeutralResourceLanguage attribute below. Update the "en-US" in
-//the line below to match the UICulture setting in the project file.
-
-//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
-
-
-[assembly: ThemeInfo(
- ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
- //(used if a resource is not found in the page,
- // or application resource dictionaries)
- ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
- //(used if a resource is not found in the page,
- // app, or any theme specific resource dictionaries)
-)]
-
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+using System.Reflection;
+using System.Resources;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Windows;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Ice.wpf.client")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Ice.wpf.client")]
+[assembly: AssemblyCopyright("Copyright © 2010")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+//In order to begin building localizable applications, set
+//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
+//inside a <PropertyGroup>. For example, if you are using US english
+//in your source files, set the <UICulture> to en-US. Then uncomment
+//the NeutralResourceLanguage attribute below. Update the "en-US" in
+//the line below to match the UICulture setting in the project file.
+
+//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
+
+
+[assembly: ThemeInfo(
+ ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+ //(used if a resource is not found in the page,
+ // or application resource dictionaries)
+ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+ //(used if a resource is not found in the page,
+ // app, or any theme specific resource dictionaries)
+)]
+
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/cs/demo/Ice/wpf/Properties/Resources.Designer.cs b/cs/demo/Ice/wpf/Properties/Resources.Designer.cs
index f40e7d965b2..4ffd3bcc16d 100755
--- a/cs/demo/Ice/wpf/Properties/Resources.Designer.cs
+++ b/cs/demo/Ice/wpf/Properties/Resources.Designer.cs
@@ -1,71 +1,71 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:2.0.50727.1433
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace Ice.wpf.client.Properties
-{
-
-
- /// <summary>
- /// A strongly-typed resource class, for looking up localized strings, etc.
- /// </summary>
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resources
- {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Resources()
- {
- }
-
- /// <summary>
- /// Returns the cached ResourceManager instance used by this class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager
- {
- get
- {
- if ((resourceMan == null))
- {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Ice.wpf.client.Properties.Resources", typeof(Resources).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- /// <summary>
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture
- {
- get
- {
- return resourceCulture;
- }
- set
- {
- resourceCulture = value;
- }
- }
- }
-}
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.1433
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Ice.wpf.client.Properties
+{
+
+
+ /// <summary>
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ /// </summary>
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources
+ {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources()
+ {
+ }
+
+ /// <summary>
+ /// Returns the cached ResourceManager instance used by this class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager
+ {
+ get
+ {
+ if ((resourceMan == null))
+ {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Ice.wpf.client.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ /// <summary>
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture
+ {
+ get
+ {
+ return resourceCulture;
+ }
+ set
+ {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/cs/demo/Ice/wpf/Properties/Resources.resx b/cs/demo/Ice/wpf/Properties/Resources.resx
index ffecec851ab..2b64efaf5df 100755
--- a/cs/demo/Ice/wpf/Properties/Resources.resx
+++ b/cs/demo/Ice/wpf/Properties/Resources.resx
@@ -114,4 +114,4 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
-</root> \ No newline at end of file
+</root>
diff --git a/cs/demo/Ice/wpf/Properties/Settings.Designer.cs b/cs/demo/Ice/wpf/Properties/Settings.Designer.cs
index f3bff7a3a95..93df3f41bc1 100755
--- a/cs/demo/Ice/wpf/Properties/Settings.Designer.cs
+++ b/cs/demo/Ice/wpf/Properties/Settings.Designer.cs
@@ -1,30 +1,30 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:2.0.50727.1433
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace Ice.wpf.client.Properties
-{
-
-
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")]
- internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
- {
-
- private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
-
- public static Settings Default
- {
- get
- {
- return defaultInstance;
- }
- }
- }
-}
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.1433
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Ice.wpf.client.Properties
+{
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+ {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default
+ {
+ get
+ {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/cs/demo/Ice/wpf/Properties/Settings.settings b/cs/demo/Ice/wpf/Properties/Settings.settings
index 8f2fd95d626..1dc1197a474 100755
--- a/cs/demo/Ice/wpf/Properties/Settings.settings
+++ b/cs/demo/Ice/wpf/Properties/Settings.settings
@@ -4,4 +4,4 @@
<Profile Name="(Default)" />
</Profiles>
<Settings />
-</SettingsFile> \ No newline at end of file
+</SettingsFile>