示例#1
0
 private void IPTextBox_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == (char)Keys.Enter)
     {
         PortTextBox.Focus();
     }
 }
示例#2
0
 private void IPAddressTextBox_KeyUp(object sender, Windows.UI.Xaml.Input.KeyRoutedEventArgs e)
 {
     if (e.Key == Windows.System.VirtualKey.Enter && PortTextBox.IsEnabled)
     {
         PortTextBox.Focus(FocusState.Programmatic);
     }
 }
        private async void OnClosing(object sender, CancelEventArgs cancelEventArgs)
        {
            var languageSelection = (ILateBindable)LanguageSelection.DataContext;

            languageSelection.AcceptChanges();
            var subtitleLanguagesSelection = (ILateBindable)SubtitleLanguagesSelection.DataContext;

            subtitleLanguagesSelection.AcceptChanges();

            // ReSharper disable PossibleNullReferenceException
            MovieDirectorySelection.GetBindingExpression(DirectorySelectUserControl.TextProperty).UpdateSource();
            TvShowDirectorySelection.GetBindingExpression(DirectorySelectUserControl.TextProperty).UpdateSource();
            UserNameTextBox.GetBindingExpression(TextBox.TextProperty).UpdateSource();
            PasswordTextBox.GetBindingExpression(TextBox.TextProperty).UpdateSource();
            PortTextBox.GetBindingExpression(NumericUpDown.ValueProperty).UpdateSource();
            // ReSharper restore PossibleNullReferenceException

            await _engine.SaveSettings(_configurableEngine.SettingName, _configurableEngine.SerializeSettings());

            if (_downloader != null)
            {
                await _engine.SaveSettings(_downloader.SettingName, _downloader.SerializeSettings());
            }

            await AddDirectories(_engine.MovieDirectory, _initialMovieDir);
            await AddDirectories(_engine.TvShowDirectory, _initialTvShowDir);
        }
示例#4
0
 public void Hide()
 {
     HostLabel.Hide();
     PortLabel.Hide();
     HostTextBox.Hide();
     PortTextBox.Hide();
     StartStopWaitingConnectionBtn.Hide();
     ReturnToMenuBtn2.Hide();
 }
示例#5
0
        public bool Validate()
        {
            ServernameTextBox.GetBindingExpression(TextBox.TextProperty).UpdateSource();
            ServerAddressTextBox.GetBindingExpression(TextBox.TextProperty).UpdateSource();
            PortTextBox.GetBindingExpression(TextBox.TextProperty).UpdateSource();
            PasswordTextBox.GetBindingExpression(PasswordHelper.PasswordProperty).UpdateSource();
            DescriptionTextBox.GetBindingExpression(TextBox.TextProperty).UpdateSource();

            return(IsValid());
        }
示例#6
0
        //【<<】按鈕事件
        private void TakeButton_Click(object sender, EventArgs e)
        {
            list_index = IpPortListBox.SelectedIndex;
            if (list_index == -1)
            {
                return;
            }

            IpTextBox.Text   = target_list[list_index].ip;
            PortTextBox.Text = target_list[list_index].port;

            target_list.GoRemove(list_index);

            IpTextBox.Refresh();
            PortTextBox.Refresh();
            UpdateList();
        }
示例#7
0
 private void FocusFirstEmptyLoginCredential()
 {
     if (Address == string.Empty)
     {
         AddressTextBox.Focus();
     }
     else if (Port == string.Empty)
     {
         PortTextBox.Focus();
     }
     else if (Username == string.Empty)
     {
         UsernameTextBox.Focus();
     }
     else
     {
         PasswordBox.Focus();
     }
 }
示例#8
0
 public void Show(bool isServerSide)
 {
     HostLabel.Show();
     PortLabel.Show();
     HostTextBox.Show();
     PortTextBox.Show();
     StartStopWaitingConnectionBtn.Show();
     ReturnToMenuBtn2.Show();
     StartStopWaitingConnectionBtn.Text = "Waiting for connection";
     HostTextBox.ReadOnly = isServerSide;
     if (isServerSide)
     {
         HostTextBox.Text = "127.0.0.1";
         PortTextBox.Text = "20";
     }
     else
     {
         HostTextBox.Text = "localhost";
         PortTextBox.Text = "20";
     }
 }
示例#9
0
        private void AddAndAddAnotherButton_Click(object sender, EventArgs e)
        {
            try
            {
                XMLHelper helper = new XMLHelper();

                MailServer NewServer = new MailServer()
                {
                    ID          = helper.LastElementUniqueID(XMLDataStorage.Location + "MailServers.xml", "Server") + 1,
                    Name        = NameTextBox.Text,
                    Description = DescriptionTextBox.Text,
                    Host        = HostTextBox.Text,
                    Port        = Convert.ToInt32(PortTextBox.Text),
                    Username    = UsernameTextBox.Text,
                    Password    = PasswordTextBox.Text,
                    FromAddress = FromAddressTextBox.Text,
                    IsSecured   = IsSecuredCheckbox.Checked
                };

                mailServerManager.Add(NewServer);

                MessageBox.Show("Mail Server is successfully added");

                NameTextBox.Clear();
                DescriptionTextBox.Clear();
                HostTextBox.Clear();
                PortTextBox.Clear();
                UsernameTextBox.Clear();
                PasswordTextBox.Clear();
                FromAddressTextBox.Clear();
                IsSecuredCheckbox.Checked = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to add new mail server", ex.Message);
            }
        }
        private void OKLinkLabel_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
        {
            if (0 == HostnameComboBox.Text.Length)
            {
                MessageBox.Show("Please enter a hostname.", "Missing information");
                HostnameComboBox.Focus();
            }
            else if (0 == PortTextBox.Text.Length)
            {
                MessageBox.Show("Please enter a port.", "Missing information");
                PortTextBox.Text = "443";
                PortTextBox.Focus();
            }
            else if (0 == EndpointTextBox.Text.Length)
            {
                MessageBox.Show("Please enter a endpoint (default of /iControl/iControlPortal.cgi).", "Missing information");
                EndpointTextBox.Text = "/iControl/iControlPortal.cgi";
                EndpointTextBox.Focus();
            }
            else if (0 == UsernameTextBox.Text.Length)
            {
                MessageBox.Show("Please enter a username.", "Missing information");
                UsernameTextBox.Focus();
            }
            else if (0 == PasswordTextBox.Text.Length)
            {
                MessageBox.Show("Please enter a password.", "Missing information");
                PasswordTextBox.Focus();
            }
            else if (UseProxyCheckBox.Checked && (ProxyAddressTextBox.Text.Length == 0))
            {
                MessageBox.Show("If you are using a proxy server, please specify the address");
                ProxyAddressTextBox.Focus();
            }
            else if (UseProxyCheckBox.Checked && (ProxyPortTextBox.Text.Length == 0))
            {
                MessageBox.Show("If you are using a proxy server, please specify the port");
                ProxyPortTextBox.Focus();
            }
            else
            {
                bool bInitialized = false;
                Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;

                m_ci.setEndpoint(HostnameComboBox.Text, Convert.ToInt32(PortTextBox.Text), EndpointTextBox.Text);
                m_ci.setCredentials(UsernameTextBox.Text, PasswordTextBox.Text);

                // Now verify if we can connect to the host
                if (null == m_interfaces)
                {
                    m_interfaces = new iControl.Interfaces();
                }

                if (UseProxyCheckBox.Checked)
                {
                    bInitialized = m_interfaces.initialize(HostnameComboBox.Text, Convert.ToUInt32(PortTextBox.Text), UsernameTextBox.Text, PasswordTextBox.Text, ProxyAddressTextBox.Text, Convert.ToInt32(ProxyPortTextBox.Text), ProxyUserTextBox.Text, ProxyPassTextBox.Text, m_ci.useHttps);
                }
                else
                {
                    bInitialized = m_interfaces.initialize(HostnameComboBox.Text, Convert.ToUInt32(PortTextBox.Text), UsernameTextBox.Text, PasswordTextBox.Text, m_ci.useHttps);
                }

                if (bInitialized)
                {
                    try
                    {
                        //sysInfo.Url = m_ci.buildURL();
                        iControl.SystemProductInformation prodInfo = m_interfaces.SystemSystemInfo.get_product_information();
                        if (null != prodInfo.product_code)
                        {
                            m_ci.setHostType(prodInfo.product_code);
                        }

                        // Check for GTM Support
                        bool bGTMLicensed = false;
                        for (int i = 0; i < prodInfo.product_features.Length; i++)
                        {
                            if (prodInfo.product_features[i].Equals("GTM Rules"))
                            {
                                bGTMLicensed = true;
                                break;
                            }
                        }
                        m_ci.setGTMLicensed(bGTMLicensed);

                        //sysInfo.Dispose();
                        Cursor.Current    = System.Windows.Forms.Cursors.Default;
                        this.DialogResult = DialogResult.OK;

                        // Update proxy info in connection info class
                        if (UseProxyCheckBox.Checked)
                        {
                            m_ci.setWebProxy(ProxyAddressTextBox.Text, Convert.ToInt32(ProxyPortTextBox.Text),
                                             ProxyUserTextBox.Text, ProxyPortTextBox.Text);
                        }

                        if (SaveConfigCheckBox.Checked)
                        {
                            m_ci.saveToRegistry(HostnameComboBox.Text);
                        }

                        if (UseProxyCheckBox.Checked)
                        {
                            m_ci.setWebProxy(ProxyAddressTextBox.Text, Convert.ToInt32(ProxyPortTextBox.Text), ProxyUserTextBox.Text, ProxyPassTextBox.Text);
                        }

                        this.DialogResult = DialogResult.OK;
                        this.Close();
                    }
                    catch (System.Net.WebException)
                    {
                        MessageBox.Show(this, "Connection could not be established to specified host", "Error");
                    }
                    catch (System.UriFormatException)
                    {
                        MessageBox.Show(this, "Connection could not be established to specified host", "Error");
                    }
                }
                else
                {
                    MessageBox.Show(this, "Invalid Connection Information...", "Error");
                }

                //sysInfo.Dispose();
                Cursor.Current = System.Windows.Forms.Cursors.Default;
            }
        }
示例#11
0
        private void InitializeComponent()
        {
            _addressLabel     = new Label();
            _portLabel        = new Label();
            _colonLabel       = new Label();
            _loginLabel       = new Label();
            _passwordLabel    = new Label();
            _addressTextBox   = new IPTextBox();
            _portTextBox      = new PortTextBox();
            _loginTextBox     = new HidenTextBox();
            _passwordTextBox  = new HidenTextBox();
            _saveProxyButton  = new Button();
            _resetProxyButton = new Button();
            _helpToolTip      = new HelpToolTip();

            _addressLabel.Location = new Point(3, 1);
            _addressLabel.Size     = new Size(100, 15);

            _addressTextBox.Location     = new Point(5, 17);
            _addressTextBox.Size         = new Size(100, 25);
            _addressTextBox.DefaultHost  = @"127.0.0.1";
            _addressTextBox.TextChanged += (sender, args) => CheckAddressValid();

            _colonLabel.Location  = new Point(101, 16);
            _colonLabel.Size      = new Size(10, 25);
            _colonLabel.Font      = new Font(Font.Name, Font.Size + 4);
            _colonLabel.TextAlign = ContentAlignment.TopLeft;
            _colonLabel.Text      = @":";

            _portLabel.Location = new Point(107, 1);
            _portLabel.Size     = new Size(100, 15);

            _portTextBox.Location     = new Point(110, 17);
            _portTextBox.Size         = new Size(36, 25);
            _portTextBox.DefaultPort  = 3128;
            _portTextBox.TextChanged += (sender, args) => CheckAddressValid();

            _loginLabel.Location = new Point(3, 39);
            _loginLabel.Size     = new Size(140, 15);

            _loginTextBox.Location = new Point(5, 54);
            _loginTextBox.Size     = new Size(140, 25);

            _passwordLabel.Location = new Point(3, 75);
            _passwordLabel.Size     = new Size(140, 15);

            _passwordTextBox.Location = new Point(5, 90);
            _passwordTextBox.Size     = new Size(140, 25);

            _saveProxyButton.Location  = new Point(3, 115);
            _saveProxyButton.Size      = new Size(120, 25);
            _saveProxyButton.TextAlign = ContentAlignment.MiddleCenter;
            _saveProxyButton.Click    += SaveProxyButtonClickAsync;

            _resetProxyButton.Location = new Point(123, 114);
            _resetProxyButton.Size     = new Size(_saveProxyButton.Size.Height, _saveProxyButton.Size.Height);
            _resetProxyButton.Image    = new Bitmap(Images.Fill.ResetGear, new Size(_resetProxyButton.Size.Height / 2, _resetProxyButton.Size.Height / 2));
            _resetProxyButton.Click   += ResetProxyButtonClick;

            MinimizeBox         = false;
            MaximizeBox         = false;
            ShowInTaskbar       = false;
            AutoScaleDimensions = new SizeF(7F, 15F);
            ClientSize          = new Size(150, 145);
            AutoScaleMode       = AutoScaleMode.Font;
            FormBorderStyle     = FormBorderStyle.FixedDialog;
            Controls.Add(_addressLabel);
            Controls.Add(_addressTextBox);
            Controls.Add(_portLabel);
            Controls.Add(_portTextBox);
            Controls.Add(_loginLabel);
            Controls.Add(_loginTextBox);
            Controls.Add(_passwordLabel);
            Controls.Add(_passwordTextBox);
            Controls.Add(_saveProxyButton);
            Controls.Add(_resetProxyButton);
            Controls.Add(_colonLabel);
            Icon = ImageUtils.IconFromImage(Images.Others.Proxy);
        }
示例#12
0
        private void OKLinkLabel_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
        {
            if (0 == HostnameComboBox.Text.Length)
            {
                MessageBox.Show("Please enter a hostname.", "Missing information");
                HostnameComboBox.Focus();
            }
            else if (0 == PortTextBox.Text.Length)
            {
                MessageBox.Show("Please enter a port.", "Missing information");
                PortTextBox.Text = "443";
                PortTextBox.Focus();
            }
            else if (0 == EndpointTextBox.Text.Length)
            {
                MessageBox.Show("Please enter a endpoint (default of /iControl/iControlPortal.cgi).", "Missing information");
                EndpointTextBox.Text = "/iControl/iControlPortal.cgi";
                EndpointTextBox.Focus();
            }
            else if (0 == UsernameTextBox.Text.Length)
            {
                MessageBox.Show("Please enter a username.", "Missing information");
                UsernameTextBox.Focus();
            }
            else if (0 == PasswordTextBox.Text.Length)
            {
                MessageBox.Show("Please enter a password.", "Missing information");
                PasswordTextBox.Focus();
            }
            else
            {
                Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;

                Clients.ConnectionInfo.setEndpoint(HostnameComboBox.Text, Convert.ToInt32(PortTextBox.Text), EndpointTextBox.Text);
                Clients.ConnectionInfo.setCredentials(UsernameTextBox.Text, PasswordTextBox.Text);

                // Now verify if we can connect to the host
                iControl.SystemSystemInfo sysInfo = new iControl.SystemSystemInfo();
                sysInfo.Credentials     = Clients.ConnectionInfo.creds;
                sysInfo.PreAuthenticate = true;

                try
                {
                    sysInfo.Url = Clients.ConnectionInfo.buildURL();
                    iControl.SystemProductInformation prodInfo = sysInfo.get_product_information();
                    if (null != prodInfo.product_code)
                    {
                        Clients.ConnectionInfo.setHostType(prodInfo.product_code);
                    }

                    // Check for GTM Support
                    bool bGTMLicensed = false;
                    for (int i = 0; i < prodInfo.product_features.Length; i++)
                    {
                        if (prodInfo.product_features[i].Equals("GTM Rules"))
                        {
                            bGTMLicensed = true;
                            break;
                        }
                    }
                    Clients.ConnectionInfo.setGTMLicensed(bGTMLicensed);

                    sysInfo.Dispose();
                    Cursor.Current    = System.Windows.Forms.Cursors.Default;
                    this.DialogResult = DialogResult.OK;

                    if (SaveConfigCheckBox.Checked)
                    {
                        Clients.ConnectionInfo.saveToRegistry(HostnameComboBox.Text);
                    }

                    this.Close();
                }
                catch (System.Net.WebException)
                {
                    MessageBox.Show(this, "Connection could not be established to specified host", "Error");
                }
                catch (System.UriFormatException)
                {
                    MessageBox.Show(this, "Connection could not be established to specified host", "Error");
                }

                sysInfo.Dispose();
                Cursor.Current = System.Windows.Forms.Cursors.Default;
            }
        }
示例#13
0
 // Event handlers
 private void PortLabel_Click(object sender, EventArgs e)
 {
     PortTextBox.Focus();
 }