コード例 #1
0
        void btnBakaBTTest_Click(object sender, EventArgs e)
        {
            try
            {
                SaveSettings();


                if (string.IsNullOrEmpty(BaseConfig.Settings.BakaBTUsername))
                {
                    MessageBox.Show("Please enter a username first");
                    txtBakaBTUsername.Focus();
                    return;
                }

                if (string.IsNullOrEmpty(BaseConfig.Settings.BakaBTPassword))
                {
                    MessageBox.Show("Please enter a password first");
                    txtBakaBTPassword.Focus();
                    return;
                }

                this.Cursor = Cursors.WaitCursor;

                TorrentsBakaBT bakaBT = new TorrentsBakaBT();
                BaseConfig.Settings.BakaBTCookieHeader = bakaBT.Login(BaseConfig.Settings.BakaBTUsername, BaseConfig.Settings.BakaBTPassword);



                if (!string.IsNullOrEmpty(BaseConfig.Settings.BakaBTCookieHeader))
                {
                    this.Cursor = Cursors.Arrow;
                    MessageBox.Show("Connected sucessfully", "Sucess", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    this.Cursor = Cursors.Arrow;
                    MessageBox.Show("Connected FAILED", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtBakaBTUsername.Focus();
                    return;
                }
            }
            catch (Exception ex)
            {
                this.Cursor = Cursors.Arrow;
                MessageBox.Show(ex.Message);
            }
        }
コード例 #2
0
        void btnTest_Click(object sender, RoutedEventArgs e)
        {
            UserSettingsVM.Instance.BakaBTCookieHeader = "";

            if (string.IsNullOrEmpty(txtUsername.Text))
            {
                MessageBox.Show(Properties.Resources.Downloads_BakaBTDetails, Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
                txtUsername.Focus();
                return;
            }

            UserSettingsVM.Instance.BakaBTUsername = txtUsername.Text.Trim();

            Window parentWindow = Window.GetWindow(this);

            parentWindow.Cursor = Cursors.Wait;
            this.IsEnabled      = false;

            TorrentsBakaBT bakaBT = new TorrentsBakaBT();

            UserSettingsVM.Instance.BakaBTCookieHeader = bakaBT.Login(UserSettingsVM.Instance.BakaBTUsername, UserSettingsVM.Instance.BakaBTPassword);


            parentWindow.Cursor = Cursors.Arrow;
            this.IsEnabled      = true;

            if (!string.IsNullOrEmpty(UserSettingsVM.Instance.BakaBTCookieHeader))
            {
                MessageBox.Show(Properties.Resources.Downloads_Connected, Properties.Resources.Success, MessageBoxButton.OK, MessageBoxImage.Information);
            }
            else
            {
                MessageBox.Show(Properties.Resources.Downloads_Failed, Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
                txtUsername.Focus();
                return;
            }
        }
コード例 #3
0
        void btnTest_Click(object sender, RoutedEventArgs e)
        {
            UserSettingsVM.Instance.BakaBTCookieHeader = "";

            if (string.IsNullOrEmpty(txtUsername.Text))
            {
                MessageBox.Show("Please enter BakaBT login details", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                txtUsername.Focus();
                return;
            }

            UserSettingsVM.Instance.BakaBTUsername = txtUsername.Text.Trim();

            Window parentWindow = Window.GetWindow(this);

            parentWindow.Cursor = Cursors.Wait;
            this.IsEnabled      = false;

            TorrentsBakaBT bakaBT = new TorrentsBakaBT();

            UserSettingsVM.Instance.BakaBTCookieHeader = bakaBT.Login(UserSettingsVM.Instance.BakaBTUsername, UserSettingsVM.Instance.BakaBTPassword);


            parentWindow.Cursor = Cursors.Arrow;
            this.IsEnabled      = true;

            if (!string.IsNullOrEmpty(UserSettingsVM.Instance.BakaBTCookieHeader))
            {
                MessageBox.Show("Connected sucessfully", "Sucess", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            else
            {
                MessageBox.Show("Failed! See log for more details if needed", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                txtUsername.Focus();
                return;
            }
        }