private async void ConnectButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                // get selected endpoint.
                ConfiguredEndpoint endpoint = SelectedEndpoint;

                if (endpoint == null)
                {
                    return;
                }

                // raise event.
                if (m_ConnectEndpoint != null)
                {
                    ConnectEndpointEventArgs args = new ConnectEndpointEventArgs(endpoint, true);

                    await m_ConnectEndpoint(this, args);

                    // save endpoint in drop down.
                    if (args.UpdateControl)
                    {
                        // must update the control because the display text may have changed.
                        Initialize(m_endpoints, m_configuration);
                        SelectedEndpoint = endpoint;
                    }
                }
            }
            catch (Exception exception)
            {
                GuiUtils.HandleException(String.Empty, GuiUtils.CallerName(), exception);
            }
        }
Beispiel #2
0
        private async void ConfigureMI_Click(object sender, EventArgs e)
        {
            try
            {
                ConfiguredEndpoint endpoint = SelectedTag as ConfiguredEndpoint;

                if (endpoint == null)
                {
                    return;
                }

                endpoint = await new ConfiguredServerDlg().ShowDialog(endpoint, m_configuration);

                if (endpoint == null)
                {
                    return;
                }

                UpdateItem((ListViewItem)ItemsLV.SelectedItems[0], endpoint);
            }
            catch (Exception exception)
            {
                GuiUtils.HandleException(String.Empty, GuiUtils.CallerName(), exception);
            }
        }
        private void ConnectBTN_Click(object sender, EventArgs e)
        {
            try
            {
                int index = HostsCB.SelectedIndex;
                if (index == 0)
                {
                    return;
                }

                if (m_HostConnected != null)
                {
                    if (index == -1)
                    {
                        if (!String.IsNullOrEmpty(HostsCB.SelectedItem.ToString()))
                        {
                            m_HostConnected(this, new SelectHostCtrlEventArgs(HostsCB.SelectedItem.ToString()));
                        }

                        m_selectedIndex = HostsCB.Items.IndexOf(HostsCB.SelectedIndex);
                        return;
                    }

                    m_HostConnected(this, new SelectHostCtrlEventArgs((string)HostsCB.SelectedItem));
                }
            }
            catch (Exception exception)
            {
                GuiUtils.HandleException(String.Empty, GuiUtils.CallerName(), exception);
            }
        }
Beispiel #4
0
        private async void NewMI_Click(object sender, EventArgs e)
        {
            try
            {
                ApplicationDescription server = new DiscoveredServerListDlg().ShowDialog(null, m_configuration);

                if (server == null)
                {
                    return;
                }

                ConfiguredEndpoint endpoint = await new ConfiguredServerDlg().ShowDialog(server, m_configuration);

                if (endpoint == null)
                {
                    return;
                }

                AddItem(endpoint);
            }
            catch (Exception exception)
            {
                GuiUtils.HandleException(String.Empty, GuiUtils.CallerName(), exception);
            }
        }
 private void ItemsLV_DoubleClick(object sender, System.EventArgs e)
 {
     try
     {
         PickItems();
     }
     catch (Exception exception)
     {
         GuiUtils.HandleException(String.Empty, GuiUtils.CallerName(), exception);
     }
 }
 private void ItemsLV_SelectedIndexChanged(object sender, System.EventArgs e)
 {
     try
     {
         SelectItems();
     }
     catch (Exception exception)
     {
         GuiUtils.HandleException(String.Empty, GuiUtils.CallerName(), exception);
     }
 }
 private void DomainNameCTRL_HostConnected(object sender, SelectHostCtrlEventArgs e)
 {
     try
     {
         m_domain = e.Hostname;
         HostsCTRL.Initialize(m_domain);
         m_hostname      = null;
         OkBTN.IsEnabled = false;
     }
     catch (Exception exception)
     {
         GuiUtils.HandleException(String.Empty, GuiUtils.CallerName(), exception);
     }
 }
 private void HostNameCTRL_HostConnected(object sender, SelectHostCtrlEventArgs e)
 {
     try
     {
         m_hostname = e.Hostname;
         ServersCTRL.Initialize(m_hostname, m_configuration);
         m_server        = null;
         OkBTN.IsEnabled = false;
     }
     catch (Exception exception)
     {
         GuiUtils.HandleException(String.Empty, GuiUtils.CallerName(), exception);
     }
 }
        private void EndpointCB_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                if (EndpointCB.SelectedIndex != 0)
                {
                    m_selectedIndex = EndpointCB.SelectedIndex;
                    return;
                }

                // modify configuration.
                ConfiguredEndpoint endpoint = new ConfiguredServerListDlg().ShowDialog(m_configuration, true);

                if (endpoint == null)
                {
                    EndpointCB.SelectedIndex = m_selectedIndex;
                    if (EndpointCB.SelectedIndex == 0)
                    {
                        EndpointCB_PointerPressed(null, null);
                    }
                    return;
                }

                m_endpoints.Add(endpoint);

                // raise notification.
                if (m_EndpointsChanged != null)
                {
                    m_EndpointsChanged(this, null);
                }

                // update dropdown.
                Initialize(m_endpoints, m_configuration);

                // update selection.
                for (int ii = 0; ii < m_endpoints.Endpoints.Count; ii++)
                {
                    if (Object.ReferenceEquals(endpoint, m_endpoints.Endpoints[ii]))
                    {
                        EndpointCB.SelectedIndex = ii + 1;
                        break;
                    }
                }
            }
            catch (Exception exception)
            {
                GuiUtils.HandleException(String.Empty, GuiUtils.CallerName(), exception);
            }
        }
Beispiel #10
0
        private void button_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            Popup p = this.Parent as Popup;

            p.IsOpen = false;

            try
            {
                localValue = Parse(this.textBox.Text);
            }
            catch (Exception exception)
            {
                GuiUtils.HandleException(this.textBox.Text, GuiUtils.CallerName(), exception);
            }
        }
 private void InputTB_KeyDown(object sender, KeyRoutedEventArgs e)
 {
     try
     {
         if (e.Key == VirtualKey.Enter)
         {
             InputTB.Visibility    = Visibility.Collapsed;
             EndpointCB.Visibility = Visibility.Visible;
         }
     }
     catch (Exception exception)
     {
         GuiUtils.HandleException(String.Empty, GuiUtils.CallerName(), exception);
     }
 }
        private void HostsCTRL_ItemsPicked(object sender, ListItemActionEventArgs e)
        {
            try
            {
                m_hostname = null;

                foreach (string hostname in e.Items)
                {
                    m_hostname = hostname;
                    break;
                }
            }
            catch (Exception exception)
            {
                GuiUtils.HandleException(String.Empty, GuiUtils.CallerName(), exception);
            }
        }
        private void ServersCTRL_ItemsPicked(object sender, ListItemActionEventArgs e)
        {
            try
            {
                m_server = null;

                foreach (ApplicationDescription server in e.Items)
                {
                    m_server = server;
                    break;
                }
            }
            catch (Exception exception)
            {
                GuiUtils.HandleException(String.Empty, GuiUtils.CallerName(), exception);
            }
        }
Beispiel #14
0
        private void DeleteMI_Click(object sender, EventArgs e)
        {
            try
            {
                ConfiguredEndpoint endpoint = SelectedTag as ConfiguredEndpoint;

                if (endpoint == null)
                {
                    return;
                }

                ItemsLV.Items.Remove(ItemsLV.SelectedItems[0]);
            }
            catch (Exception exception)
            {
                GuiUtils.HandleException(String.Empty, GuiUtils.CallerName(), exception);
            }
        }
Beispiel #15
0
        private void ServersCTRL_ItemsSelected(object sender, ListItemActionEventArgs e)
        {
            try
            {
                m_endpoint = null;

                foreach (ConfiguredEndpoint server in e.Items)
                {
                    m_endpoint = server;
                    break;
                }

                OkBTN.IsEnabled = m_endpoint != null;
            }
            catch (Exception exception)
            {
                GuiUtils.HandleException(String.Empty, GuiUtils.CallerName(), exception);
            }
        }
        private void HostsCTRL_ItemsSelected(object sender, ListItemActionEventArgs e)
        {
            try
            {
                m_hostname = null;

                foreach (string hostname in e.Items)
                {
                    m_hostname = hostname;
                    break;
                }

                OkBTN.IsEnabled = !String.IsNullOrEmpty(m_hostname);
            }
            catch (Exception exception)
            {
                GuiUtils.HandleException(String.Empty, GuiUtils.CallerName(), exception);
            }
        }
 private void InputTB_LostFocus(object sender, RoutedEventArgs e)
 {
     try
     {
         InputTB.Visibility    = Visibility.Collapsed;
         EndpointCB.Visibility = Visibility.Visible;
         ConfiguredEndpoint endpoint = EndpointCB.SelectedValue as ConfiguredEndpoint;
         if (endpoint == null ||
             InputTB.Text != endpoint.ToString())
         {
             endpoint         = m_endpoints.Create(InputTB.Text);
             SelectedEndpoint = endpoint;
         }
     }
     catch (Exception exception)
     {
         GuiUtils.HandleException(String.Empty, GuiUtils.CallerName(), exception);
     }
 }
        private void ReferenceTypesCB_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (m_referenceSelectionChanged != null)
                {
                    NodeId referenceTypeId = SelectedTypeId;

                    if (referenceTypeId != null)
                    {
                        m_referenceSelectionChanged(this, new ReferenceSelectedEventArgs(referenceTypeId));
                    }
                }
            }
            catch (Exception exception)
            {
                GuiUtils.HandleException(String.Empty, GuiUtils.CallerName(), exception);
            }
        }
        private void HostsCB_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (HostsCB.SelectedIndex != 0)
                {
                    if (m_HostSelected != null)
                    {
                        m_HostSelected(this, new SelectHostCtrlEventArgs((string)HostsCB.SelectedItem));
                    }

                    m_selectedIndex = HostsCB.SelectedIndex;
                    return;
                }

                if (!m_selectDomains)
                {
                    // prompt user to select a host.
                    string hostname = new HostListDlg().ShowDialog(null);

                    if (hostname == null)
                    {
                        HostsCB.SelectedIndex = m_selectedIndex;
                        return;
                    }

                    // set the current selection.
                    m_selectedIndex = HostsCB.Items.IndexOf(hostname);
                    if (m_selectedIndex == -1)
                    {
                        HostsCB.Items.Add(hostname);
                        m_selectedIndex = HostsCB.SelectedIndex;
                    }
                }

                HostsCB.SelectedIndex = m_selectedIndex;
            }
            catch (Exception exception)
            {
                GuiUtils.HandleException(String.Empty, GuiUtils.CallerName(), exception);
            }
        }
        private async void EndpointCB_KeyDown(object sender, KeyRoutedEventArgs e)
        {
            try
            {
                if (e.Key == VirtualKey.Delete)
                {
                    // ignore "New"
                    if (m_selectedIndex == 0)
                    {
                        return;
                    }

                    ConfiguredEndpoint endpoint = SelectedEndpoint;
                    MessageDlg         dialog   = new MessageDlg(
                        "Delete Endpoint?\r\n" + endpoint.EndpointUrl,
                        MessageDlgButton.Yes, MessageDlgButton.No);
                    if (await dialog.ShowAsync() == MessageDlgButton.Yes)
                    {
                        int oldIndex = m_selectedIndex;
                        m_endpoints.Remove(endpoint);
                        EndpointCB.Items.Remove(endpoint);
                        if (oldIndex > 0)
                        {
                            EndpointCB.SelectedIndex = m_selectedIndex = oldIndex - 1;
                        }

                        // raise notification.
                        if (m_EndpointsChanged != null)
                        {
                            m_EndpointsChanged(this, null);
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                GuiUtils.HandleException(String.Empty, GuiUtils.CallerName(), exception);
            }
        }