Example #1
0
        private void ServersList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                ServerInfo sinfoSelected = serversList.SelectedItem as ServerInfo;
                if (sinfoSelected == null)
                {
                    return;
                }
                ServerInfo sinfoNow = new ServerInfo {
                    Host = conn.HostName, Port = conn.Port
                };

                if (sinfoSelected.Equals(sinfoNow))
                {
                    return;
                }

                ConnectionController.Instance.ResetConnection(conn, sinfoSelected);
                objectViewTreeHelper.UpdateObjectViewItem(conn, objectViewItemSource);
            }
            catch (Exception ex)
            {
                AddinViewController.ShowErrorDialog(ex);
            }
        }
Example #2
0
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                ServerInfo sinfo = ServerInfo.FromString(serverItemTxt.Text);
                AddServerItemToFirstAndSelected(sinfo);
                DBConnection conn = new DBConnection();

                string username = UsernameInputBox.Text;
                string password = PasswordInputBox.Password;
                if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
                {
                    ConnectionController.Instance.ResetConnection(conn, sinfo);
                }
                else
                {
                    ConnectionController.Instance.ResetConnection(conn, sinfo, username, password);
                }

                ConnectionController.Instance.SaveServerInfos(servers.ToList());

                InputFinishHandler(conn);
            }
            catch (Exception ex)
            {
                AddinViewController.ShowErrorDialog(ex);
            }
        }
Example #3
0
 private void ApplyAndSaveCfg()
 {
     ApplyCfg();
     try
     {
         EnviromentCfg.SaveConfigToDefaultFile();
     }
     catch (Exception e)
     {
         AddinViewController.ShowErrorDialog(e);
     }
 }
Example #4
0
 private void NewServerButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         DBConnection c = AddinViewController.Instance.ShowLoginDialog();
         if (c != null)
         {
             conn = c;
             ResetServers();
         }
     }
     catch (Exception ex)
     {
         AddinViewController.ShowErrorDialog(ex);
     }
 }
Example #5
0
        private void OkButton_Click(object sender, RoutedEventArgs e)
        {
            if (!Double.TryParse(FontSizeBox.Text, out double fontSize) || fontSize <= 0)
            {
                AddinViewController.ShowErrorDialog("Invalid font size", "Invalid font size");
                return;
            }
            if (!Double.TryParse(LineHeightBox.Text, out double lineHeight) || lineHeight <= 0)
            {
                AddinViewController.ShowErrorDialog("Invalid line height", "Invalid line height");
                return;
            }

            if (AutolimitTableRowsCheckBox.IsChecked == true)
            {
                if (!int.TryParse(maxRowsToLoadIntoExcelBox.Text, out int maxRowsToLoadInto) || maxRowsToLoadInto < 0)
                {
                    AddinViewController.ShowErrorDialog("Invalid rows", "Invalid rows");
                    return;
                }
            }

            InputFinishHandler?.Invoke();
        }