Ejemplo n.º 1
0
 void Initialize()
 {
     m_duplexClient = ProxyClient.GetDuplexServiceProxyClient();
     m_duplexClient.SendToServiceCompleted += new EventHandler <System.ComponentModel.AsyncCompletedEventArgs>(m_duplexClient_SendToServiceCompleted);
     m_duplexClient.SendToClientReceived   += new EventHandler <SendToClientReceivedEventArgs>(m_duplexClient_SendToClientReceived);
     m_numberOfMessagesOnMonitor            = IsolatedStorageManager.LoadFromIsolatedStorage("NumberOfMessagesOnMonitor") == null ? 50 : Convert.ToInt32(IsolatedStorageManager.LoadFromIsolatedStorage("NumberOfMessagesOnMonitor"));
 }
Ejemplo n.º 2
0
 void LoadSettingsFromIsolatedStorage()
 {
     TextBoxDefaultWidth.Text              = IsolatedStorageManager.LoadFromIsolatedStorage("DefaultWidth").ToString();
     TextBoxDefaultHeight.Text             = IsolatedStorageManager.LoadFromIsolatedStorage("DefaultHeight").ToString();
     TextBoxMinimumWidth.Text              = IsolatedStorageManager.LoadFromIsolatedStorage("MinimumWidth").ToString();
     TextBoxMinimumHeight.Text             = IsolatedStorageManager.LoadFromIsolatedStorage("MinimumHeight").ToString();
     TextBoxNumberOfMessagesOnMonitor.Text = IsolatedStorageManager.LoadFromIsolatedStorage("NumberOfMessagesOnMonitor").ToString();
     CheckboxResizeWithBrowser.IsChecked   = (bool)IsolatedStorageManager.LoadFromIsolatedStorage("ResizeWithBrowser");
     CheckboxMaintainAspectRatio.IsChecked = (bool)IsolatedStorageManager.LoadFromIsolatedStorage("MaintainAspectRatio");
     CheckboxForceIPv4.IsChecked           = (bool)IsolatedStorageManager.LoadFromIsolatedStorage("ForceIPv4");
 }
Ejemplo n.º 3
0
        void ScaleContent(double height, double width)
        {
            if ((bool)IsolatedStorageManager.LoadFromIsolatedStorage("MaintainAspectRatio"))
            {
                StackPanelRoot.HorizontalAlignment = HorizontalAlignment.Center;
            }
            else
            {
                StackPanelRoot.HorizontalAlignment = HorizontalAlignment.Left;
            }

            double defaultHeight = IsolatedStorageManager.LoadFromIsolatedStorage("DefaultHeight") == null ? layoutRootHeight : Convert.ToDouble(IsolatedStorageManager.LoadFromIsolatedStorage("DefaultHeight"));
            double defaultWidth  = IsolatedStorageManager.LoadFromIsolatedStorage("DefaultWidth") == null ? layoutRootWidth : Convert.ToDouble(IsolatedStorageManager.LoadFromIsolatedStorage("DefaultWidth"));
            double minimumHeight = IsolatedStorageManager.LoadFromIsolatedStorage("MinimumHeight") == null ? 600 : Convert.ToDouble(IsolatedStorageManager.LoadFromIsolatedStorage("MinimumHeight"));
            double minimumWidth  = IsolatedStorageManager.LoadFromIsolatedStorage("MinimumWidth") == null ? 800 : Convert.ToDouble(IsolatedStorageManager.LoadFromIsolatedStorage("MinimumWidth"));

            if (height == 0)
            {
                height = defaultHeight;                          //If for some reason, we dont get actual height and width then use default values.
            }
            if (width == 0)
            {
                width = defaultWidth;
            }

            //if set to resize with browser then use actual height and width of the browser passed in the method parameters.
            if (IsolatedStorageManager.LoadFromIsolatedStorage("ResizeWithBrowser") != null && (bool)IsolatedStorageManager.LoadFromIsolatedStorage("ResizeWithBrowser"))
            {
                if (IsolatedStorageManager.LoadFromIsolatedStorage("MaintainAspectRatio") != null && (bool)IsolatedStorageManager.LoadFromIsolatedStorage("MaintainAspectRatio"))
                {
                    if (height / layoutRootHeight <= width / layoutRootWidth)
                    {
                        if (height < minimumHeight)
                        {
                            height = minimumHeight;
                        }
                        LayoutRootScale.ScaleX = 0.98 * (height / layoutRootHeight);
                        LayoutRootScale.ScaleY = 0.98 * (height / layoutRootHeight);
                    }
                    else
                    {
                        if (width < minimumWidth)
                        {
                            width = minimumWidth;
                        }
                        LayoutRootScale.ScaleX = 0.98 * (width / layoutRootWidth);
                        LayoutRootScale.ScaleY = 0.98 * (width / layoutRootWidth);
                    }
                }
                else
                {
                    if (height < minimumHeight)
                    {
                        height = minimumHeight;
                    }
                    if (width < minimumWidth)
                    {
                        width = minimumWidth;
                    }
                    LayoutRootScale.ScaleX = 0.98 * (width / layoutRootWidth);
                    LayoutRootScale.ScaleY = 0.98 * (height / layoutRootHeight);
                }
            }
            else                // if set not to resize with browser then, use default height and width to scale
            {
                if (defaultWidth < minimumWidth)
                {
                    defaultWidth = minimumWidth;
                }
                if (defaultHeight < minimumHeight)
                {
                    defaultHeight = minimumHeight;
                }

                LayoutRootScale.ScaleX = 0.98 * (defaultWidth / layoutRootWidth);
                LayoutRootScale.ScaleY = 0.98 * (defaultHeight / layoutRootHeight);
            }
        }
Ejemplo n.º 4
0
        void ConnectionStringBuilder_Loaded(object sender, RoutedEventArgs e)
        {
            if (m_connectionType == ConnectionType.CommandChannel)
            {
                TabItemTCP.Visibility              = Visibility.Visible;
                TabItemUDP.Visibility              = Visibility.Collapsed;
                TabItemSerial.Visibility           = Visibility.Collapsed;
                TabItemFile.Visibility             = Visibility.Collapsed;
                TabItemUdpServer.Visibility        = Visibility.Collapsed;
                TextBlockHostIP.Visibility         = Visibility.Collapsed;
                TextBoxHostIP.Visibility           = Visibility.Collapsed;
                CheckboxEstablishServer.Visibility = Visibility.Collapsed;
            }
            else if (m_connectionType == ConnectionType.AlternateCommandChannel)
            {
                TabItemTCP.Visibility       = Visibility.Visible;
                TabItemUDP.Visibility       = Visibility.Collapsed;
                TabItemSerial.Visibility    = Visibility.Collapsed;
                TabItemFile.Visibility      = Visibility.Collapsed;
                TabItemUdpServer.Visibility = Visibility.Collapsed;
            }
            else if (m_connectionType == ConnectionType.DataChannel)
            {
                TabControlOptions.SelectedIndex = 4;
                TabItemTCP.Visibility           = Visibility.Collapsed;
                TabItemUDP.Visibility           = Visibility.Collapsed;
                TabItemSerial.Visibility        = Visibility.Collapsed;
                TabItemFile.Visibility          = Visibility.Collapsed;
                TabItemUdpServer.Visibility     = Visibility.Visible;
            }
            else
            {
                TabItemTCP.Visibility       = Visibility.Visible;
                TabItemUDP.Visibility       = Visibility.Visible;
                TabItemSerial.Visibility    = Visibility.Visible;
                TabItemFile.Visibility      = Visibility.Visible;
                TabItemUdpServer.Visibility = Visibility.Collapsed;
            }

            keyvaluepairs = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase);

            m_client.GetParitiesAsync();
            m_client.GetStopBitsAsync();
            //m_client.GetPortsAsync();

            ComboboxPort.Items.Add("COM1");
            ComboboxPort.Items.Add("COM2");
            ComboboxPort.Items.Add("COM3");
            ComboboxPort.Items.Add("COM4");
            ComboboxPort.Items.Add("COM5");
            ComboboxPort.Items.Add("COM6");
            ComboboxPort.Items.Add("COM7");
            ComboboxPort.Items.Add("COM8");
            ComboboxPort.Items.Add("COM9");
            ComboboxPort.Items.Add("COM10");
            ComboboxPort.SelectedIndex = 0;

            // Populate Baud Rate Dropdown in Serial Tab
            ComboboxBaudRate.Items.Add(115200);
            ComboboxBaudRate.Items.Add(57600);
            ComboboxBaudRate.Items.Add(38400);
            ComboboxBaudRate.Items.Add(19200);
            ComboboxBaudRate.Items.Add(9600);
            ComboboxBaudRate.Items.Add(4800);
            ComboboxBaudRate.Items.Add(2400);
            ComboboxBaudRate.Items.Add(1200);
            ComboboxBaudRate.SelectedIndex = 0;

            if (IsolatedStorageManager.LoadFromIsolatedStorage("ForceIPv4") != null && (bool)IsolatedStorageManager.LoadFromIsolatedStorage("ForceIPv4"))
            {
                CheckboxForceIPv4.IsChecked = true;
            }
            else
            {
                CheckboxForceIPv4.IsChecked = false;
            }

            // populate connection info	if already provided from the parent window
            ParseConnectionString();
        }