コード例 #1
0
ファイル: SharedFunc.cs プロジェクト: dvmu/MyRapid
 public static void ShowProcess(Form parent, int process, int max = 100)
 {
     try
     {
         if (progressWindow == null || progressWindow.IsDisposed)
         {
             progressWindow = new ProgressWindow();
             progressWindow.ShowMdiChildCaptionInParentTitle = true;
             progressWindow.DisableCancel();
             progressWindow.reProgress.Properties.Maximum = max;
             progressWindow.reProgress.EditValue          = process;
             progressWindow.ShowCenter(parent);
         }
         if (process < progressWindow.reProgress.Properties.Maximum)
         {
             progressWindow.Text = string.Format("{0}/{1}", process, progressWindow.reProgress.Properties.Maximum);
             progressWindow.reProgress.EditValue = process;
             progressWindow.Refresh();
         }
         else
         {
             progressWindow.Dispose();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #2
0
        public override void OnPageEnter(WizardDirection fromdirection)
        {
            var progress = new ProgressWindow(this.FindParentWindow(), "Extracting column information from data source...", true);

            _fields = _fieldSource();
            lvwFields.ItemsSource = _fields;

            CollectionView           myView           = (CollectionView)CollectionViewSource.GetDefaultView(lvwFields.ItemsSource);
            PropertyGroupDescription groupDescription = new PropertyGroupDescription("Category");

            myView.GroupDescriptions.Add(groupDescription);
            var model = new List <ImportFieldMapping>();

            JobExecutor.QueueJob(() => {
                List <String> columns = null;
                columns = ImportContext.Importer.GetColumnNames();

                var existingMappings = ImportContext.FieldMappings;
                if (existingMappings != null && existingMappings.Count() > 0)
                {
                    foreach (ImportFieldMapping mapping in existingMappings)
                    {
                        model.Add(mapping);
                    }
                }
                else
                {
                    foreach (string columnName in columns)
                    {
                        var mapping = new ImportFieldMapping {
                            SourceColumn = columnName
                        };
                        model.Add(mapping);
                    }
                }

                _model = new ObservableCollection <ImportFieldMappingViewModel>(model.Select((m) => {
                    return(new ImportFieldMappingViewModel(m));
                }));

                lvwMappings.InvokeIfRequired(() => {
                    lvwMappings.ItemsSource = _model;
                });

                progress.InvokeIfRequired(() => {
                    progress.Dispose();
                });
            });
        }
コード例 #3
0
        /// <summary>
        ///     Invoked when the login button is clicked.
        /// </summary>
        /// <param name="sender">Object that caused this event to be triggered.</param>
        /// <param name="e">Arguments explaining why this event occured.</param>
        private void loginButton_Click(object sender, EventArgs e)
        {
            string password = passwordTextBox.Text;
            string username = usernameTextBox.Text;
            if (password == null || password.Length < 6 ||
                username == null || username.Length < 6)
            {
                MessageBox.Show("A password and username must be entered. Both must be equal to or longer than 6 characters", "Invalid Login", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                ProgressWindow progressWindow = new ProgressWindow("Logging in", "Verifying login");
                progressWindow.Marquee = true;
                progressWindow.Show();
                this.Enabled = false;

                FileDownloader downloader = new FileDownloader("http://www.binaryphoenix.com/index.php?action=fusionverifylogin&username="******"&password="******"")
                    {
                        MessageBox.Show("An error occured while connecting to the server. Please try again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    Application.DoEvents();
                }

                this.Enabled = true;
                progressWindow.Dispose();

                ASCIIEncoding encoding = new ASCIIEncoding();
                string response = encoding.GetString(downloader.FileData);
                if (response.ToLower() == "invalid")
                    MessageBox.Show("The login given was invalid. If you have lost your password please click the password reset link.", "Invalid Login", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                else if (response.ToLower() == "valid")
                {
                    MessageBox.Show("Your login was successfull.", "Valid Login", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    // Place the password / username in the config file if we are to remember them.
                    Fusion.GlobalInstance.CurrentUsername = username;
                    Fusion.GlobalInstance.CurrentPassword = password;
                    Fusion.GlobalInstance.RememberUser = rememberMeCheckBox.Checked;

                    Close();
                }
                else
                    MessageBox.Show("Unexpected value returned from server. Please try again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #4
0
        private void NewScanButton_Click(object sender, EventArgs e)
        {
            // Clear all the controls from the panel
            FoundDataPanel.Controls.Clear();

            // Format the dump base file name
            string OutFileName = Application.StartupPath + "\\Dumps\\dmp_";

            // Check to see if we have a dumps directory, if not, make one
            if (!Directory.Exists(Application.StartupPath + "\\Dumps"))
                Directory.CreateDirectory(Application.StartupPath + "\\Dumps");

            // Remove all of the files in the directory
            foreach (string fi in Directory.GetFiles(Application.StartupPath + "\\Dumps"))
            {
                File.Delete(fi);
            }

            // Check for the very last dump made
            int i;
            for (i = 0; ; i++)
            {
                if (!File.Exists(OutFileName + i.ToString()))
                    break;
            }

            // Create a new progress bar window
            ProgressWindow dmpw = new ProgressWindow();

            // Dump to a file
            dmpw.XboxDebugCommunicator = this.XboxDebugCommunicator;
            dmpw.Address = Convert.ToUInt32(StartScanCBox.Text, 16);
            dmpw.Length = Convert.ToUInt32(StopScanTextBox.Text, 16);

            dmpw.ProgressType = ProgressWindowType.Dumping;

            dmpw.Text = "Dumping, Please Wait";

            dmpw.OutDumpFileName = OutFileName + i.ToString();

            dmpw.ShowDialog();

            // Search for the data in the file
            dmpw.SearchingBuffer = File.ReadAllBytes(OutFileName + i.ToString());
            dmpw.ToSearch = ConvertValueFromDataBox();

            dmpw.ProgressType = ProgressWindowType.Scanning;

            dmpw.Text = "Searching, Please Wait";

            dmpw.ShowDialog();

            LastScan = dmpw.DataFound;

            if (LastScan.Count > 1000)
            {
                MessageBox.Show("Too many values, do another scan to narrow it down", "Warning");
                return;
            }

            // Put all the found values in the panel provided there is less than 1000
            foreach (uint FoundValues in dmpw.DataFound)
            {
                MemoryAddress m = new MemoryAddress();
                m.Address = Convert.ToUInt32(StartScanCBox.Text, 16) + FoundValues;

                FoundDataPanel.Controls.Add(m);
            }

            // Dispose it or we freeze next time we make a dump
            dmpw.Dispose();
        }
コード例 #5
0
ファイル: Form1.cs プロジェクト: Red-EyeX32/PublicXboxStuff
        private void DumpMemoryButton_Click(object sender, EventArgs e)
        {
            try
            {
                ProgressWindow dmpw = new ProgressWindow();

                dmpw.XboxDebugCommunicator = this.XboxDebugCommunicator;
                dmpw.Address = Convert.ToUInt32(MemoryAddressBox.Text, 16);
                dmpw.Length = Convert.ToUInt32(LengthBox.Text, 16);

                dmpw.ProgressType = ProgressWindowType.Dumping;

                dmpw.Text = "Dumping, Please Wait";

                dmpw.ShowDialog();

                dmpw.Dispose();
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message, "Error");
            }
        }
コード例 #6
0
 public void Dispose()
 {
     _ProgressWindow.Dispose();
 }
コード例 #7
0
        /// <summary>
        ///     Invoked when the reset button is clicked.
        /// </summary>
        /// <param name="sender">Object that caused this event to be triggered.</param>
        /// <param name="e">Arguments explaining why this event occured.</param>
        private void resetButton_Click(object sender, EventArgs e)
        {
            string email = emailTextBox.Text;
            if (email == null || !email.Contains("@"))
            {
                MessageBox.Show("A valid email must be entered.", "Invalid Email", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                ProgressWindow progressWindow = new ProgressWindow("Reseting Password", "Contacting server");
                progressWindow.Marquee = true;
                progressWindow.Show();
                this.Enabled = false;

                FileDownloader downloader = new FileDownloader("http://www.binaryphoenix.com/index.php?action=fusionresetpassword&email=" + System.Web.HttpUtility.UrlEncode(email));
                downloader.Start();
                while (downloader.Complete == false)
                {
                    if (downloader.Error != "")
                    {
                        MessageBox.Show("An error occured while connecting to the server. Please try again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    Application.DoEvents();
                }

                this.Enabled = true;
                progressWindow.Dispose();

                ASCIIEncoding encoding = new ASCIIEncoding();
                string response = encoding.GetString(downloader.FileData);
                if (response.ToLower() == "noaccount")
                    MessageBox.Show("No account exists with the email that your provided.", "Invalid Email", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                else if (response.ToLower() == "invalid")
                    MessageBox.Show("The email you provided was invalid.", "Invalid Email", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                else if (response.ToLower() == "valid")
                {
                    MessageBox.Show("An email has been sent to the email account we have in our database. It contains a link to a webpage you can reset your password at.", "Password Reset", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    DialogResult = DialogResult.OK;
                    Close();
                    return;
                }
                else
                    MessageBox.Show("Unexpected value returned from server. Please try again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            DialogResult = DialogResult.Cancel;
            Close();
        }
コード例 #8
0
        /// <summary>
        ///     Invoked when the register button is clicked.
        /// </summary>
        /// <param name="sender">Object that caused this event to be triggered.</param>
        /// <param name="e">Arguments explaining why this event occured.</param>
        private void registerButton_Click(object sender, EventArgs e)
        {
            string email = emailTextBox.Text;
            string displayName = displaynameTextBox.Text;
            string username = usernameTextBox.Text;
            string password = passwordTextBox.Text;
            string confirmPassword = confirmPasswordTextBox.Text;

            if (email == null || !email.Contains("@"))
            {
                MessageBox.Show("A valid email must be entered.", "Invalid Email", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else if (username == null || username.Length < 6)
            {
                MessageBox.Show("A valid username must be entered.", "Invalid Username", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else if (password.ToLower() != confirmPassword.ToLower())
            {
                MessageBox.Show("Your passwords do not match.", "Invalid Password", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else if (password.Length < 6)
            {
                MessageBox.Show("A valid password must be entered.", "Invalid Password", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                ProgressWindow progressWindow = new ProgressWindow("Registering", "Contacting server");
                progressWindow.Marquee = true;
                progressWindow.Show();
                this.Enabled = false;

                FileDownloader downloader = new FileDownloader("http://www.binaryphoenix.com/index.php?action=fusionregister&email=" + System.Web.HttpUtility.UrlEncode(email) + "&username="******"&password="******"" ? ("&displayname=" + System.Web.HttpUtility.UrlEncode(displayName)) : ""));
                downloader.Start();
                while (downloader.Complete == false)
                {
                    if (downloader.Error != "")
                    {
                        MessageBox.Show("An error occured while connecting to the server. Please try again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    Application.DoEvents();
                }

                this.Enabled = true;
                progressWindow.Dispose();

                ASCIIEncoding encoding = new ASCIIEncoding();
                string response = encoding.GetString(downloader.FileData);
                if (response.ToLower() == "usernameinuse")
                    MessageBox.Show("An account already exists with the username that your provided.", "Invalid Register", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                else if (response.ToLower() == "emailinuse")
                    MessageBox.Show("An account already exists with the email that your provided.", "Invalid Register", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                else if (response.ToLower() == "valid")
                {
                    MessageBox.Show("Your account has successfully been registered with the server and you have been logged in. We hope you like being a member of Binary Phoenix's community.", "Registration Successfull", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    DialogResult = DialogResult.OK;
                    Close();
                    Fusion.GlobalInstance.CurrentUsername = username;
                    Fusion.GlobalInstance.CurrentPassword = password;
                    return;
                }
                else
                    MessageBox.Show("Unexpected value returned from server. Please try again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }