Example #1
0
        private void SetLocalVersion(string version)
        {
            string file_path = Path.Combine(Application.StartupPath, file);

            try
            {
                if (File.Exists(file))
                {
                    using (StreamWriter sw = new StreamWriter(file))
                    {
                        sw.Write(version);
                    }
                }
                else
                {
                    File.Create(file_path);
                    using (StreamWriter sw = new StreamWriter(file))
                    {
                        sw.Write(version);
                    }
                }
            }
            catch (Exception e)
            {
                MetroSetMessageBox.Show(this, "Error catched : " + e.Message, "Error");
            }
        }
Example #2
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (!tbWaitInMills.IsValid || !tbSpeed.IsValid)
            {
                //MessageBox.Show("Please input valid value");
                MetroSetMessageBox.Show(this, "请输入合理的值");
                return;
            }

            changeSpeedCmdLine.Speed       = tbSpeed.Value;
            changeSpeedCmdLine.WaitInMills = tbWaitInMills.Value;

            if (isCreating)
            {
                MsgCenter.Broadcast(Constants.MSG_FINISH_ADDING_CMD_LINE, this, changeSpeedCmdLine);
            }
            else
            {
                MsgCenter.Broadcast(Constants.MSG_FINISH_EDITING_CMD_LINE, this, changeSpeedCmdLine);
            }

            if (!this.isCreating)
            {
                if (this.changeSpeedCmdLine != null && this.changeSpeedCmdLineBackUp != null)
                {
                    CompareObj.CompareProperty(this.changeSpeedCmdLine, this.changeSpeedCmdLineBackUp, null, this.GetType().Name, true);
                }
            }
        }
Example #3
0
 private void btnOk_Click(object sender, System.EventArgs e)
 {
     if (!tbStart.IsValid || !tbEnd.IsValid)
     {
         //MessageBox.Show("Please input valid values.");
         MetroSetMessageBox.Show(this, "请输入正确的值");
         return;
     }
     if (tbStart.Value > tbEnd.Value)
     {
         //MessageBox.Show("Start value can not be bigger than end value.");
         MetroSetMessageBox.Show(this, "起始点不可以大于结束点.");
         return;
     }
     loopPassCmdLine.Start = tbStart.Value;
     loopPassCmdLine.End   = tbEnd.Value;
     if (isCreating)
     {
         MsgCenter.Broadcast(Constants.MSG_FINISH_ADDING_CMD_LINE, this, loopPassCmdLine, new NextLoopCmdLine());
     }
     else
     {
         MsgCenter.Broadcast(Constants.MSG_FINISH_EDITING_CMD_LINE, this, loopPassCmdLine);
     }
     if (!this.isCreating)
     {
         if (this.loopPassCmdLine != null && this.loopPassCmdLineBackUp != null)
         {
             CompareObj.CompareField(this.loopPassCmdLine, this.loopPassCmdLineBackUp, null, this.GetType().Name, true);
         }
     }
 }
Example #4
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(tbName.Text))
            {
                //MessageBox.Show("Please input name.");
                MetroSetMessageBox.Show(this, "请输入点名称.");
                return;
            }
            string name = tbName.Text.Trim();

            if (this.program.UserPositions.Find(x => x.Name == name) != null)
            {
                //MessageBox.Show("Name " + name + " has already existed!");
                MetroSetMessageBox.Show(this, "名称 " + name + " 已经存在!");
                return;
            }
            if (!tbX.IsValid || !tbY.IsValid)
            {
                //MessageBox.Show("Please input valid values.");
                MetroSetMessageBox.Show(this, "请输入正确的参数.");
                return;
            }
            PointD       pos = new PointD(tbX.Value, tbY.Value);
            UserPosition up  = new UserPosition(name, pos);

            up.MoveType = this.getMoveType();

            this.program.UserPositions.Add(up);
            listBoxDefs.Items.Add(up);
            changed = true;
            string msg = string.Format("Add userPosition {0}:[{1},{2}]", name, pos.X, pos.Y);

            Logger.DEFAULT.Info(LogCategory.MANUAL | LogCategory.SETTING, this.GetType().Name, msg);
        }
Example #5
0
 private void btnOk_Click(object sender, System.EventArgs e)
 {
     if (!tbZ.IsValid)
     {
         //MessageBox.Show("Please input a double number for z.");
         MetroSetMessageBox.Show(this, "请输入小数.");
         return;
     }
     moveAbsZCmdLine.Z = tbZ.Value;
     if (isCreating)
     {
         MsgCenter.Broadcast(Constants.MSG_FINISH_ADDING_CMD_LINE, this, moveAbsZCmdLine);
     }
     else
     {
         MsgCenter.Broadcast(Constants.MSG_FINISH_EDITING_CMD_LINE, this, moveAbsZCmdLine);
     }
     if (!this.isCreating)
     {
         if (this.moveAbsZCmdLine != null && this.moveAbsZCmdLineBackUp != null)
         {
             CompareObj.CompareField(this.moveAbsZCmdLine, this.moveAbsZCmdLineBackUp, null, this.GetType().Name, true);
         }
     }
 }
Example #6
0
        private void btnOk_Click(object sender, System.EventArgs e)
        {
            if (!tbWaitInMills.IsValid)
            {
                //MessageBox.Show("Please input valid value.");
                MetroSetMessageBox.Show(this, "请输入正确的值");
                return;
            }
            timerCmdLine.WaitInMills = tbWaitInMills.Value;
            if (isCreating)
            {
                MsgCenter.Broadcast(Constants.MSG_FINISH_ADDING_CMD_LINE, this, timerCmdLine);
            }
            else
            {
                MsgCenter.Broadcast(Constants.MSG_FINISH_EDITING_CMD_LINE, this, timerCmdLine);
            }

            Properties.Settings.Default.NormalTimer = timerCmdLine.WaitInMills;
            if (!this.isCreating)
            {
                if (this.timerCmdLine != null && this.timerCmdLineBackUp != null)
                {
                    CompareObj.CompareField(this.timerCmdLine, this.timerCmdLineBackUp, null, this.GetType().Name, true);
                }
            }
        }
Example #7
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (!tbX.IsValid || !tbY.IsValid)
            {
                //MessageBox.Show("Please input valid values.");
                MetroSetMessageBox.Show(this, "请输入正确的值.");
                return;
            }
            PointD laserMap = this.pattern.SystemRel(tbX.Value, tbY.Value);

            measureHeightCmdLine.Position.X   = laserMap.X;
            measureHeightCmdLine.Position.Y   = laserMap.Y;
            measureHeightCmdLine.StandardHt   = this.heightControl1.BoardHeight;
            measureHeightCmdLine.ToleranceMax = this.heightControl1.MaxTolerance;
            measureHeightCmdLine.ToleranceMin = this.heightControl1.MinTolerance;
            if (isCreating)
            {
                MsgCenter.Broadcast(Constants.MSG_FINISH_ADDING_CMD_LINE, this, measureHeightCmdLine);
            }
            else
            {
                MsgCenter.Broadcast(Constants.MSG_FINISH_EDITING_CMD_LINE, this, measureHeightCmdLine);
            }
            Properties.Settings.Default.laserX = measureHeightCmdLine.Position.X;
            Properties.Settings.Default.laserY = measureHeightCmdLine.Position.Y;
            if (!this.isCreating)
            {
                if (this.measureHeightCmdLine != null && this.measureHeightCmdLineBackUp != null)
                {
                    CompareObj.CompareProperty(this.measureHeightCmdLine, this.measureHeightCmdLineBackUp, null, this.GetType().Name, true);
                    CompareObj.CompareField(this.measureHeightCmdLine, this.measureHeightCmdLineBackUp, null, this.GetType().Name, true);
                }
            }
        }
Example #8
0
        private void btnDeleteEntry_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Soll der merkierte Eintrag wirklich gelöscht werden?", "Löschen bestätigen", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                connection.Open();
                cmd.CommandText = $@"DELETE FROM Members WHERE ID = '{selectedMember}'";
                cmd.ExecuteNonQuery();
                connection.Close();

                txbResultName.Text   = "";
                txbResultDW.Text     = "";
                txbResultExtern.Text = "";
                txbResultMobile.Text = "";
                txbResultEmail1.Text = "";
                txbResultEmail2.Text = "";
                txbResultEmail3.Text = "";
                txbResultNote.Text   = "";

                MemberImgB64         = "";
                pbxMemberImage.Image = null;

                MetroSetMessageBox.Show(this, "Eintrag gelöscht!", "Erfolg", MessageBoxButtons.OK, MessageBoxIcon.Information);
                LoadAllMembers();
            }
        }
Example #9
0
 private void btnOk_Click(object sender, System.EventArgs e)
 {
     if (!tbX.IsValid || !tbY.IsValid)
     {
         //MessageBox.Show("Please input valid value.");
         MetroSetMessageBox.Show(this, "请输入正确的值.");
         return;
     }
     moveAbsXyCmdLine.MoveType   = this.getMoveType();
     moveAbsXyCmdLine.Position.X = tbX.Value;
     moveAbsXyCmdLine.Position.Y = tbY.Value;
     if (isCreating)
     {
         MsgCenter.Broadcast(Constants.MSG_FINISH_ADDING_CMD_LINE, this, moveAbsXyCmdLine);
     }
     else
     {
         MsgCenter.Broadcast(Constants.MSG_FINISH_EDITING_CMD_LINE, this, moveAbsXyCmdLine);
     }
     Properties.Settings.Default.absX = moveAbsXyCmdLine.Position.X;
     Properties.Settings.Default.absY = moveAbsXyCmdLine.Position.Y;
     if (!this.isCreating)
     {
         if (this.moveAbsXyCmdLine != null && this.moveAbsXyCmdLineBackUp != null)
         {
             CompareObj.CompareField(this.moveAbsXyCmdLine, this.moveAbsXyCmdLineBackUp, null, this.GetType().Name, true);
         }
     }
 }
        private void generateButton_Click(object sender, System.EventArgs e)
        {
            do
            {
                smallBoardsListView.Clear();

                if (!validateBoardGeneration())
                {
                    break;
                }

                int selectedRectangleWidth = int.Parse(rectangleWidthTextBox.Text.Replace("Correction: ", ""));
                selectedRectangleWidth     = FibonnaciStore.getInstance().correctNumber(selectedRectangleWidth);
                rectangleWidthTextBox.Text = "Correction: " + selectedRectangleWidth;

                List <int> fibonacciEntries = FibonnaciStore.getInstance().getRespectiveFibonnaciSeries(selectedRectangleWidth);
                if (fibonacciEntries == null || fibonacciEntries.Count == 0)
                {
                    MetroSetMessageBox.Show(this, "No results found, please try another value" + Constants.MAX_NUMBER_ALLOWED);
                    break;
                }

                foreach (int entry in fibonacciEntries)
                {
                    smallBoardsListView.AddItem(entry.ToString());
                }
            } while (false);
        }
Example #11
0
        private void GenerateQRForUrl(string url)
        {
            try
            {
                Url    generator = new Url(url);
                string payload   = generator.ToString();

                QRCodeGenerator qrGenerator    = new QRCodeGenerator();
                QRCodeData      qrCodeData     = qrGenerator.CreateQrCode(payload, QRCodeGenerator.ECCLevel.Q);
                QRCode          qrCode         = new QRCode(qrCodeData);
                Bitmap          qrCodeAsBitmap = qrCode.GetGraphic(20);

                if (save_image_url == true)
                {
                    using (FolderBrowserDialog f = new FolderBrowserDialog())
                    {
                        if (f.ShowDialog() == DialogResult.OK)
                        {
                            qrCodeAsBitmap.Save(Path.Combine(f.SelectedPath, "qr-code-url.png"));
                        }
                    }
                }

                pictureBoxUrl.Image = qrCodeAsBitmap;

                qrCode.Dispose();
                qrCodeData.Dispose();
                qrGenerator.Dispose();
            }
            catch (Exception e)
            {
                MetroSetMessageBox.Show(this, "An error : " + e.Message, "QR Creator");
            }
        }
Example #12
0
        private void btnScan_Click(object sender, EventArgs e)
        {
            try
            {
                utils.CheckFolders();
                lbContent.Items.AddRange(utils.RetrieveGames());
            }
            catch (MissingFoldersException ex)      // The folders don't exist, can't continue
            {
                MetroSetMessageBox.Show(this, ex.Message, Strings.NO_FOLDER_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            catch (MissingGamesException ex)        // There are no games in the folders, can't continue
            {
                MetroSetMessageBox.Show(this, ex.Message, Strings.NO_GAMES_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }


            cmbDrive.Enabled  = false;
            btnScan.Enabled   = false;
            lbContent.Enabled = true;
            btnDown.Enabled   = true;
            btnUp.Enabled     = true;
            btnSort.Enabled   = true;
        }
Example #13
0
        private void gvExpire_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            //if click is on new row or header row
            if (e.RowIndex == gvExpire.NewRowIndex || e.RowIndex < 0)
            {
                return;
            }

            //Check if click is on specific column
            if (e.ColumnIndex == gvExpire.Columns["gvReturnButton"].Index)
            {
                // Put some logic here, for example to remove row from your binding list.
                // yourBindingList.RemoveAt(e.RowIndex);
                DialogResult dr = MessageBox.Show("Are you sure to want Return this Product ?", "Return Product", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dr == DialogResult.Yes)
                {
                    // res = db.DeleteCategory(gvExpire.Rows[e.RowIndex].Cells["ID"].Value.ToString());
                    res = db.returnStock(gvExpire.Rows[e.RowIndex].Cells["ID"].Value.ToString());
                    if (res.success)
                    {
                        MetroSetMessageBox.Show(this, res.message, "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        getExStock(Convert.ToInt32(txtDays.Text));
                    }
                    else
                    {
                        MetroSetMessageBox.Show(this, res.message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
Example #14
0
        private void btnSaveEntry_Click(object sender, EventArgs e)
        {
            btnSaveEntry.Enabled   = false;
            btnAbort.Enabled       = false;
            btnSelectImage.Enabled = false;

            txbResultName.ReadOnly   = true;
            txbResultDW.ReadOnly     = true;
            txbResultMobile.ReadOnly = true;
            txbResultEmail1.ReadOnly = true;
            txbResultEmail2.ReadOnly = true;
            txbResultEmail3.ReadOnly = true;
            txbResultNote.ReadOnly   = true;

            connection.Open();

            if (selectedMember == 0)
            {
                cmd.CommandText = $@"INSERT INTO Members (Name, DW, Mobile, Email1, Email2, Email3, Note, Image) VALUES ('{txbResultName.Text}','{txbResultDW.Text}','{txbResultMobile.Text}','{txbResultEmail1.Text}','{txbResultEmail2.Text}','{txbResultEmail3.Text}','{txbResultNote.Text}','{MemberImgB64}')";
            }
            else
            {
                cmd.CommandText = $@"UPDATE Members SET Name = '{txbResultName.Text}', DW = '{txbResultDW.Text}', Mobile = '{txbResultMobile.Text}', Email1 = '{txbResultEmail1.Text}', Email2 = '{txbResultEmail2.Text}', Email3 = '{txbResultEmail3.Text}', Note = '{txbResultNote.Text}', Image = '{MemberImgB64}' WHERE ID = '{selectedMember}'";
            }

            cmd.ExecuteNonQuery();
            connection.Close();

            MetroSetMessageBox.Show(this, "Eintrag gespeichert!", "Erfolg", MessageBoxButtons.OK, MessageBoxIcon.Information);

            LoadAllMembers(true);
        }
Example #15
0
        private void metroSetButton3_Click(object sender, EventArgs e)
        {
            if (metroSetTextBox3.Text == "")
            {
                MetroSetMessageBox.Show(this, "Lütfen bir dosya yolu yazınız!", "Hata");
                return;
            }

            if (!File.Exists(metroSetTextBox3.Text))
            {
                MetroSetMessageBox.Show(this, "Dosya bulunamadı! Dosya yolunu kontrol edin!", "Hata");
                return;
            }
            ;

            string[] lines = File.ReadAllLines(metroSetTextBox3.Text, Encoding.Default);

            foreach (string line in lines)
            {
                string[] split_line = line.Split(' ');
                if (split_line.Length < 2)
                {
                    continue;
                }

                string username = split_line[0];
                string password = split_line[1];

                if (!metroSetListBox1.Items.Contains(username + " " + password))
                {
                    metroSetListBox1.Items.Add(username + " " + password);
                }
            }
        }
Example #16
0
        private void metroSetButton6_Click(object sender, EventArgs e)
        {
            if (metroSetTextBox4.Text == "")
            {
                MetroSetMessageBox.Show(this, "Lütfen bir kullanıcı adı girin!", "Hata");
                return;
            }
            try
            {
                var url = "https://www.instagram.com/" + metroSetTextBox4.Text + "/?__a=1";

                HttpClient httpClient = new HttpClient();

                var doc = httpClient.GetAsync(url).Result.Content.ReadAsStringAsync().Result;

                JObject json = JObject.Parse(doc);
                string  id   = json["graphql"]["user"].Value <string>("id");
                string  profile_photo_url = json["graphql"]["user"].Value <string>("profile_pic_url");
                metroSetLabel11.Text = id;
                pictureBox3.Load(profile_photo_url);
            } catch (Newtonsoft.Json.JsonReaderException) {
                MetroSetMessageBox.Show(this, "Kullanıcı bulunamadı!", "Hata");
                return;
            }
        }
        private void addBoxButton_Click(object sender, System.EventArgs e)
        {
            do
            {
                if (!validateBoxSize())
                {
                    break;
                }

                int boxSize = int.Parse(boxSizeTextBox.Text);
                int respectiveFibonnaciNumber = FibonnaciStore.getInstance().correctNumber(boxSize);

                string toAdd = respectiveFibonnaciNumber.ToString();

                if (!FibonnaciStore.getInstance().isValidFibonnaciNumber(boxSize))
                {
                    toAdd = "Correction: " + toAdd;
                }

                if (boxSize != 1 && isDuplicateInput(toAdd))
                {
                    MetroSetMessageBox.Show(this, "Already Added");
                    boxSizeTextBox.Text = string.Empty;
                    break;
                }

                inputListBox.AddItem(toAdd);
                boxSizeTextBox.Text = string.Empty;
            } while (false);
        }
Example #18
0
        private void gv_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            //if click is on new row or header row
            if (e.RowIndex == gv.NewRowIndex || e.RowIndex < 0)
            {
                return;
            }

            //Check if click is on specific column
            if (e.ColumnIndex == gv.Columns["gvDeleteButton"].Index)
            {
                // Put some logic here, for example to remove row from your binding list.
                // yourBindingList.RemoveAt(e.RowIndex);
                DialogResult dr = MessageBox.Show("Are you sure to want delete this record ?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dr == DialogResult.Yes)
                {
                    res = db.DeleteProduct(gv.Rows[e.RowIndex].Cells["ID"].Value.ToString());
                    if (res.success)
                    {
                        MetroSetMessageBox.Show(this, res.message, "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        getMedicine();
                    }
                    else
                    {
                        MetroSetMessageBox.Show(this, res.message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
Example #19
0
 private void getMedicine()
 {
     res = db.GetProduct();
     if (res.success)
     {
         DataSet ds = res.data;
         gv.Columns.Clear();
         gv.DataSource = ds.Tables[0];
         // gv.EditMode = DataGridViewEditMode.EditOnF2;
         gv.ReadOnly = true;
         // gv.Columns[1].Visible = false;
         DataGridViewButtonColumn deleteButton = new DataGridViewButtonColumn();
         // deleteButton.DisplayIndex = 0;
         deleteButton.Name       = "gvDeleteButton";
         deleteButton.HeaderText = "Delete";
         deleteButton.Text       = "Delete";
         deleteButton.UseColumnTextForButtonValue = true;
         // Deletelink.Text = "DEL";
         gv.Columns.Add(deleteButton);
         gv.AllowUserToDeleteRows = false;
     }
     else
     {
         MetroSetMessageBox.Show(this, res.message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #20
0
        private void btnOk_Click(object sender, System.EventArgs e)
        {
            if (comboBoxSysPositions.SelectedItem == null)
            {
                //MessageBox.Show("System position is not selected.");
                MetroSetMessageBox.Show(this, "请选择坐标点位.");
                return;
            }
            UserPosition up = comboBoxSysPositions.SelectedItem as UserPosition;

            moveToLocationCmdLine.PositionName = up.Name;
            moveToLocationCmdLine.MoveType     = up.MoveType;
            if (isCreating)
            {
                MsgCenter.Broadcast(Constants.MSG_FINISH_ADDING_CMD_LINE, this, moveToLocationCmdLine);
            }
            else
            {
                MsgCenter.Broadcast(Constants.MSG_FINISH_EDITING_CMD_LINE, this, moveToLocationCmdLine);
            }
            if (!this.isCreating)
            {
                if (this.moveToLocationCmdLine != null && this.moveToLocationCmdLineBackUp != null)
                {
                    CompareObj.CompareField(this.moveToLocationCmdLine, this.moveToLocationCmdLineBackUp, null, this.GetType().Name, true);
                }
            }
        }
Example #21
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            Machine.Instance.Setting.ValveSelect = (ValveSelection)this.cmbValveSelect.SelectedIndex;
            if (!Machine.Instance.Valve1.ValveSeries.Equals(Machine.Instance.Valve2.ValveSeries) && Machine.Instance.Setting.ValveSelect == ValveSelection.双阀)
            {
                MetroSetMessageBox.Show(this, "请选择同类型阀组", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            Machine.Instance.SetupValve();
            Machine.Instance.Valve1.ValveSeries = (ValveSeries)this.metroSetListBox1.SelectedIndex;
            Machine.Instance.Valve2.ValveSeries = (ValveSeries)this.metroSetListBox2.SelectedIndex;
            ValvePrmMgr.Instance.FindBy(ValveType.Valve1).ValveSeires = (ValveSeries)this.metroSetListBox1.SelectedIndex;

            ValvePrmMgr.Instance.FindBy(ValveType.Valve2).ValveSeires = (ValveSeries)this.metroSetListBox2.SelectedIndex;
            Machine.Instance.Setting.Save();
            Machine.Instance.SaveValveSettings();

            if (Machine.Instance.Setting.ValveSelect == ValveSelection.双阀)
            {
                if (Machine.Instance.Valve1.ValveSeries == Machine.Instance.Valve2.ValveSeries)
                {
                    if (Machine.Instance.Valve1.ValveSeries == ValveSeries.喷射阀)
                    {
                        Machine.Instance.DualValve = new JtDualValve(CardMgr.Instance.FindBy(0), Machine.Instance.Valve1, Machine.Instance.Valve2);
                    }
                    if (Machine.Instance.Valve1.ValveSeries == ValveSeries.螺杆阀)
                    {
                        Machine.Instance.DualValve = new SvDualValve(CardMgr.Instance.FindBy(0), Machine.Instance.Valve1, Machine.Instance.Valve2);
                    }
                }
            }
            MsgCenter.Broadcast(MachineMsg.SETUP_VALVE, this, Machine.Instance.Valve1.ValveSeries, Machine.Instance.Valve2.ValveSeries);
        }
        private void generateSolutionButton_Click(object sender, EventArgs e)
        {
            List <int> inputList  = new List <int>();
            List <int> outputList = null;

            do
            {
                outputListBox.Clear();
                rectangleSizeTextBox.Text = string.Empty;

                if (inputListBox.Items == null || inputListBox.Items.Count == 0)
                {
                    MetroSetMessageBox.Show(this, "Invalid Operation, Empty input list");
                    break;
                }

                int startFrom = 1;
                int target    = 0;

                foreach (string entry in inputListBox.Items)
                {
                    int entryRepresentation = int.Parse(entry.Replace("Correction:", ""));

                    //if (entryRepresentation < startFrom)
                    //    startFrom = entryRepresentation;

                    if (target < entryRepresentation)
                    {
                        target = entryRepresentation;
                    }

                    inputList.Add(entryRepresentation);
                }

                outputList = FibonnaciStore.getInstance().getRespectiveFibonnaciSeries(target, startFrom, true);
                foreach (int entry in outputList)
                {
                    string toAdd = entry.ToString();

                    if (!inputList.Contains(entry))
                    {
                        toAdd = "Missing: " + toAdd;
                    }

                    outputListBox.AddItem(toAdd);
                }

                int rectangleSize = outputList[outputList.Count - 1];
                if (outputList.Count > 1)
                {
                    rectangleSize += outputList[outputList.Count - 2];
                }

                rectangleSizeTextBox.Text     = rectangleSize.ToString();
                rectangleSizeTextBox.ReadOnly = true;
            } while (false);
        }
Example #23
0
 private void metroSetButton4_Click(object sender, EventArgs e)
 {
     if (metroSetListBox1.SelectedIndex == -1 || metroSetListBox1.Items.Count == 0)
     {
         MetroSetMessageBox.Show(this, "Lütfen önce bir hesap seçiniz!", "Hata");
         return;
     }
     metroSetListBox1.Items.Remove(metroSetListBox1.Items[metroSetListBox1.SelectedIndex]);
 }
Example #24
0
 private void btnDefault_Click(object sender, EventArgs e)
 {
     if (MetroSetMessageBox.Show(this, "将模组的参数设置为默认值?", "警告",
                                 MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
     {
         SettingUtil.ResetToDefault <RobotDefaultPrm>(Machine.Instance.Robot.DefaultPrm);
         //LngPropertyProxyTypeDescriptor proxyObj = new LngPropertyProxyTypeDescriptor(Machine.Instance.Robot.DefaultPrm, this.GetType().Name);
         this.propertyGrid1.SelectedObject = Machine.Instance.Robot.DefaultPrm;
         CompareObj.CompareProperty(Machine.Instance.Robot.DefaultPrm, this.DefaultPrmBackUp, null, this.GetType().Name);
     }
 }
Example #25
0
 private void GeoGenerate_Click(object sender, EventArgs e)
 {
     if (!(string.IsNullOrWhiteSpace(LatBox.Text)) && !(string.IsNullOrWhiteSpace(LongBox.Text)))
     {
         GenerateGeoLocationQr(LatBox.Text, LongBox.Text);
     }
     else
     {
         MetroSetMessageBox.Show(this, "The fields must not be empty!", "Info");
     }
 }
Example #26
0
        private void btnOk_Click(object sender, System.EventArgs e)
        {
            if (lineCoordinateCache.Count <= 0)
            {
                //MessageBox.Show("Line points is empty.");
                MetroSetMessageBox.Show(this, "线轨迹上点个数为0.");
                return;
            }
            lineCmdLine.LineCoordinateList.Clear();
            lineCmdLine.LineCoordinateList.AddRange(lineCoordinateCache);
            lineCmdLine.IsWeightControl = cbWeightControl.Checked;

            if (isCreating)
            {
                MsgCenter.Broadcast(Constants.MSG_FINISH_ADDING_CMD_LINE, this, lineCmdLine);
            }
            else
            {
                MsgCenter.Broadcast(Constants.MSG_FINISH_EDITING_CMD_LINE, this, lineCmdLine);
            }

            int count = lineCmdLine.LineCoordinateList.Count;

            if (count > 0)
            {
                LineCoordinate lineCoordinate = lineCmdLine.LineCoordinateList[count - 1];
                Properties.Settings.Default.LineStartX = lineCoordinate.Start.X;
                Properties.Settings.Default.LineStartY = lineCoordinate.Start.Y;
                Properties.Settings.Default.LineEndX   = lineCoordinate.End.X;
                Properties.Settings.Default.LineEndY   = lineCoordinate.End.Y;
                Properties.Settings.Default.LineStyle  = (int)lineCmdLine.LineStyle;
                Properties.Settings.Default.LineIsWt   = lineCmdLine.IsWeightControl;
                Properties.Settings.Default.LineWt     = lineCmdLine.WholeWeight;
            }
            if (Machine.Instance.Valve1.RunMode == ValveRunMode.AdjustLine)
            {
                Line.WaitMsg.Set();
            }

            if (!this.isCreating)
            {
                if (this.lineCmdLine != null && this.lineCmdLineBackUp != null)
                {
                    CompareObj.CompareField(this.lineCmdLine, this.lineCmdLineBackUp, null, this.GetType().Name, true);
                    CompareObj.CompareProperty(this.lineCmdLine, this.lineCmdLineBackUp, null, this.GetType().Name, true);
                    for (int i = 0; i < this.lineCmdLine.LineCoordinateList.Count; i++)
                    {
                        string pathRoot = this.GetType().Name + "\\lineCmdLine\\" + "LineCoordinateList: " + i.ToString();
                        CompareObj.CompareField(this.lineCmdLine.LineCoordinateList[i], this.lineCmdLineBackUp.LineCoordinateList[i], null, pathRoot, true);
                    }
                }
            }
        }
Example #27
0
 private void btnGenerateText_Click(object sender, EventArgs e)
 {
     // Checking if input is not null
     if (!string.IsNullOrWhiteSpace(inputBoxText.Text))
     {
         GenerateQRFromText(inputBoxText.Text);
     }
     else
     {
         MetroSetMessageBox.Show(this, "Field cannot be empty!", "Error");
     }
 }
Example #28
0
        private async void button1_Click(object sender, EventArgs e)
        {
            try{
                UserGender = GenderCombo.SelectedItem.ToString();

                if (!string.IsNullOrEmpty(NameBox.Text) || !string.IsNullOrEmpty(LastNameBox.Text) ||
                    !string.IsNullOrEmpty(PassBox.Text) || !string.IsNullOrEmpty(PassVBox.Text) ||
                    !string.IsNullOrEmpty(UserBox.Text) || !string.IsNullOrEmpty(UserGender))
                {
                    if (PassBox.Text == PassVBox.Text)
                    {
                        var checker = await userManager.CheckUserExistenceAsync(UserBox.Text);

                        if (!checker)
                        {
                            if (!string.IsNullOrWhiteSpace(FileLocation.Text))
                            {
                                UserProfilePic = pictureManager.UploadPicture(FileLocation.Text);
                            }
                            else
                            {
                                UserProfilePic = pictureBox1.ImageLocation;
                            }

                            await userManager.RegisterNewUserAsync(NameBox.Text, LastNameBox.Text, UserBox.Text, PassVBox.Text, UserProfilePic, UserGender);

                            MetroSetMessageBox.Show(this, "Registration was successful!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            this.Hide();
                            loginPanel = new LoginPanel();
                            loginPanel.Show();
                            this.Close();
                        }
                        else
                        {
                            MetroSetMessageBox.Show(this, "Username is already in use!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    else
                    {
                        MetroSetMessageBox.Show(this, "Passwords didn't match.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MetroSetMessageBox.Show(this, "Fill all the gaps!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (NullReferenceException ex)
            {
                MetroSetMessageBox.Show(this, "Enter your gender!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
Example #29
0
 private void btnSort_Click(object sender, EventArgs e)
 {
     try
     {
         this.Cursor = Cursors.WaitCursor;       // Making the user aware of delay like a b0ss
         utils.Sort();                           // Trying to sort the games
     } catch (Exception ex)
     {
         MetroSetMessageBox.Show(this, ex.Message, Strings.ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     this.Cursor = Cursors.Default;      // The wait is over
 }
Example #30
0
        public void ShowRunAtStartupDialog()
        {
            DialogResult r = MetroSetMessageBox.Show(this, null, "Do you want to set the app to run at startup?", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

            if (r == DialogResult.Yes)
            {
                Presenter.SetAppRunAtStartup();
            }
            else
            {
                Presenter.DoNotAskAgainRunAtStartup();
            }
        }