Esempio n. 1
0
        private void SetupButton_Click(object sender, RoutedEventArgs e)
        {
            string message = String.Format("Database output structure will be created in {0}", output_folder);
            string caption = "Output Setup";

            WinForms.MessageBoxButtons buttons = WinForms.MessageBoxButtons.OKCancel;
            WinForms.DialogResult      result;
            result = WinForms.MessageBox.Show(message, caption, buttons);
            if (result == WinForms.DialogResult.OK)
            {
                sourceButton.IsEnabled = false;
                outputButton.IsEnabled = false;
                textBox1.Text          = textBox2.Text = textBox3.Text = null;

                SetupOutput();
                GenerateIndexLabels();
                result = WinForms.MessageBox.Show("Output Structure created succesfully!\n" +
                                                  "Now you can Extract the frames and landmarks :)\n" +
                                                  "Please, click on 'Create Database' Button",
                                                  "Output Setup", WinForms.MessageBoxButtons.OK);
                Process.Start(output_folder);

                ExtractButton.IsEnabled = true;
                setupButton.IsEnabled   = false;
            }
        }
Esempio n. 2
0
        public static Common.MessageBoxButtons Convert(MessageBoxButtons value)
        {
            var result = Common.MessageBoxButtons.Ok;

            if (value == null)
            {
                return(result);
            }
            if (value == MessageBoxButtons.OKCancel)
            {
                return(Common.MessageBoxButtons.OkCancel);
            }
            if (value == MessageBoxButtons.AbortRetryIgnore)
            {
                return(Common.MessageBoxButtons.AbortRetryIgnore);
            }
            if (value == MessageBoxButtons.YesNoCancel)
            {
                return(Common.MessageBoxButtons.YesNoCancel);
            }
            if (value == MessageBoxButtons.YesNo)
            {
                return(Common.MessageBoxButtons.YesNo);
            }
            if (value == MessageBoxButtons.RetryCancel)
            {
                return(Common.MessageBoxButtons.RetryCancel);
            }
            return(result);
        }
        /// <summary>
        /// import json and convert to jsonModel
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void importJson_Click(object sender, MouseButtonEventArgs e)
        {
            string         json           = "";
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "json files (*.json)|*.json";
            if (openFileDialog.ShowDialog() == true)
            {
                json = File.ReadAllText(openFileDialog.FileName);
                string message = "do you want to add that to current list? caution: override will delete all your progress! ";
                string caption = "Warning: override the current progress ";

                Forms.MessageBoxButtons buttons = Forms.MessageBoxButtons.YesNo;
                Forms.DialogResult      result;

                // Displays the MessageBox.
                result = Forms.MessageBox.Show(message, caption, buttons, Forms.MessageBoxIcon.Warning);
                if (result == Forms.DialogResult.Yes)
                {
                    listOfJsonModel.AddRange(deserializeJson(json));
                }
                else
                {
                    listOfJsonModel = deserializeJson(json);
                }
            }
            refreshObject();
        }
Esempio n. 4
0
        /// <summary>
        /// 显示信息窗口(对话框) 在对顶层
        /// </summary>
        /// <param name="text">信息文本(主要的信息内容)</param>
        /// <param name="caption">提示框标题</param>
        /// <param name="buttons">可选按钮</param>
        /// <param name="icon">窗口图标</param>
        /// <param name="defaultButton">默认选择的按钮(从左到右第几个)</param>
        /// <param name="options">选项</param>
        /// <param name="helpFilePath">帮助文件路劲</param>
        /// <param name="navigator">导航方式</param>
        /// <param name="param">用户单击帮助按钮时要显示的帮助主题的数字ID</param>
        /// <returns>对话框结果</returns>
        public static DialogResult ShowOnTopMost(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options, string helpFilePath, HelpNavigator navigator, object param)
        {
            var topf   = GetShowedTopMostForm();
            var result = SWF.MessageBox.Show(topf, text, caption, buttons, icon, defaultButton, options, helpFilePath, navigator, param);

            topf.Hide();
            return(result);
        }
Esempio n. 5
0
        /// <summary>
        /// 显示信息窗口(对话框) 在对顶层
        /// </summary>
        /// <param name="text">信息文本(主要的信息内容)</param>
        /// <param name="caption">提示框标题</param>
        /// <param name="buttons">可选按钮</param>
        /// <param name="icon">窗口图标</param>
        /// <param name="defaultButton">默认选择的按钮(从左到右第几个)</param>
        /// <param name="options">选项</param>
        /// <returns>对话框结果</returns>
        public static DialogResult ShowOnTopMost(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options)
        {
            var topf   = GetShowedTopMostForm();
            var result = SWF.MessageBox.Show(topf, text, caption, buttons, icon, defaultButton, options);

            topf.Hide();
            return(result);
        }
Esempio n. 6
0
        //
        //Функция для вывода сообщения ошибки или предупреждения с 0 по 19 зарезервированы номера ошибок с 20 предупреждений
        //

        private void GenFault(int numOfError)
        {
            string txtOfError;
            string txtOfHead = "Ошибка!";

            System.Windows.Forms.MessageBoxButtons MBB = MessageBoxButtons.OK;
            System.Windows.Forms.MessageBoxIcon    MBI = MessageBoxIcon.Error;
            switch (numOfError)
            {
            //
            //Ошибки
            //
            case 0:
                txtOfError = "Произошла ошибка при открытии документа 1!\nError in CreateTemplate()";
                break;

            case 1:
                txtOfError = "Произошла ошибка при генерации основного формата!\nError in ChangeTemplate()";
                break;

            case 2:
                txtOfError = "Произошла ошибка при открытии документа 2!\nError in CreateTemplate()";
                break;

            case 3:
                txtOfError = "Произошла ошибка при редактировании тела шаблона!\nError in ChangeTable()";
                break;

            case 4:
                txtOfError = "Произошла ошибка при генерации тела шаблона! \nError in ChangeBody();";
                break;

            //
            //Предупреждения
            //
            case 20:
                txtOfError = "Не все поля заполнены и/или не указано место сохранения";
                txtOfHead  = "Предупреждение!";
                MBI        = MessageBoxIcon.Warning;
                break;

            //
            //Ошибка, при некорректном method
            //
            default:
                txtOfError = "Неизвестная ошибка в коде. Обратитесь к специалисту.";
                break;
            }
            MessageBox.Show(txtOfError, txtOfHead, MBB, MBI);
            if (numOfError <= 19)
            {
                wordapp.Quit(ref falseObj, ref missingObj, ref missingObj);
                worddocument  = null;
                worddocument2 = null;
                wordapp       = null;
                GeneralFault  = true;
            }
        }
Esempio n. 7
0
            public override void Execute()
            {
                System.Windows.Forms.MessageBoxButtons button = 0;
                System.Windows.Forms.MessageBoxIcon    icon   = 0;

                switch (parameters[1])
                {
                case "MB1":
                    button = System.Windows.Forms.MessageBoxButtons.AbortRetryIgnore;
                    break;

                case "MB2":
                    button = System.Windows.Forms.MessageBoxButtons.OK;
                    break;

                case "MB3":
                    button = System.Windows.Forms.MessageBoxButtons.OKCancel;
                    break;

                case "MB4":
                    button = System.Windows.Forms.MessageBoxButtons.RetryCancel;
                    break;

                case "MB5":
                    button = System.Windows.Forms.MessageBoxButtons.YesNo;
                    break;

                case "MB6":
                    button = System.Windows.Forms.MessageBoxButtons.YesNoCancel;
                    break;
                }

                switch (parameters[2])
                {
                case "MI1":
                    icon = System.Windows.Forms.MessageBoxIcon.Information;
                    break;

                case "MI2":
                    icon = System.Windows.Forms.MessageBoxIcon.Error;
                    break;

                case "MI3":
                    icon = System.Windows.Forms.MessageBoxIcon.Exclamation;
                    break;

                case "MI4":
                    icon = System.Windows.Forms.MessageBoxIcon.None;
                    break;

                case "MI5":
                    icon = System.Windows.Forms.MessageBoxIcon.Question;
                    break;
                }

                System.Windows.Forms.MessageBox.Show(value, parameters[0].ToString(), button, icon);
            }
Esempio n. 8
0
        public void syntaxErrorPopUp(string com)
        {
            System.Windows.Forms.MessageBoxButtons button = System.Windows.Forms.MessageBoxButtons.OK;
            string caption = "SYNTAX ERROR";
            string message = ($"Syntax error at: {com}");

            System.Windows.Forms.MessageBoxIcon icon = System.Windows.Forms.MessageBoxIcon.Error;
            System.Windows.Forms.MessageBox.Show(message, caption, button, icon);
        }
Esempio n. 9
0
        private void bFileHelp_Click(object sender, RoutedEventArgs e)
        {
            string messageBoxText = "Adjusting the slider control changes the flood fill algorithm and it may provide for better results.";
            string caption        = "help";

            System.Windows.Forms.MessageBoxButtons mbutton = MessageBoxButtons.OK;
            System.Windows.Forms.MessageBoxIcon    mIcon   = System.Windows.Forms.MessageBoxIcon.Information;
            System.Windows.Forms.MessageBox.Show(messageBoxText, caption, mbutton, mIcon);
        }
Esempio n. 10
0
        private void bImageHelp_Click(object sender, RoutedEventArgs e)
        {
            string messageBoxText = "Use the BROWSE button to select a scanned image of shreds for processing.  For best results scan the paper shreds on top of a high contrast background (example: white paper shreds on a pink background)";
            string caption        = "help";

            System.Windows.Forms.MessageBoxButtons mbutton = MessageBoxButtons.OK;
            System.Windows.Forms.MessageBoxIcon    mIcon   = System.Windows.Forms.MessageBoxIcon.Information;
            System.Windows.Forms.MessageBox.Show(messageBoxText, caption, mbutton, mIcon);
        }
Esempio n. 11
0
        // This is the method that does the actual work and
        // reports progress as it does its work.

        public bool CheckUserMachine(BackgroundWorker worker, DoWorkEventArgs e)
        {
            bool   isdocker    = Class1.CheckdockerInstallation();
            bool   ishyperV    = Class1.CheckWinFeatureStatus(String.Concat(Class1.getWinFeature, Class1.hyperV), "dism.exe");
            bool   isContainer = Class1.CheckWinFeatureStatus(String.Concat(Class1.getWinFeature, Class1.wincontainerFeature), "dism.exe");
            string message     = "Do you want to install Docker for windows and enable hyperV and Windows container feature?";
            string caption     = "Docker Environment Setup Alert";

            System.Windows.Forms.MessageBoxButtons buttons = System.Windows.Forms.MessageBoxButtons.YesNo;
            System.Windows.Forms.DialogResult      result;
            Class1 class1 = new Class1();

            if (worker.CancellationPending)
            {
                e.Cancel = true;
            }
            else
            {
                if (!isdocker)
                {
                    result = System.Windows.Forms.MessageBox.Show(message, caption, buttons);

                    if (result == System.Windows.Forms.DialogResult.Yes)
                    {
                        // Report progress as a percentage of the total task.
                        Task.Factory.StartNew(() => { ProgressThread(worker); });

                        class1.InstallDockerforWindows();
                        if (!ishyperV)
                        {
                            Class1.CheckWinFeatureStatus(String.Concat(Class1.enableWinFeature, Class1.hyperV, " /all /NoRestart"), "dism.exe");
                        }
                        if (!isContainer)
                        {
                            Class1.CheckWinFeatureStatus(String.Concat(Class1.enableWinFeature, Class1.wincontainerFeature, " /all /NoRestart"), "dism.exe");
                        }
                        message = "Operation Succesfull. Restart to complete installation steps?";
                        caption = "Installation Complete Alert";

                        result = System.Windows.Forms.MessageBox.Show(message, caption, buttons);

                        if (result == System.Windows.Forms.DialogResult.Yes)
                        {
                            BackgroundWorkerExample.ActiveForm.Close();
                            System.Diagnostics.Process.Start("shutdown", "/r /t 30");
                        }



                        return(true);
                    }
                }
            }


            return(false);
        }
Esempio n. 12
0
 private void RemoveAllButton_Click(object sender, EventArgs e)
 {
     System.Windows.Forms.MessageBoxButtons button = MessageBoxButtons.YesNo;
     if (System.Windows.Forms.MessageBox.Show("Do you really want to delete all spawns?", "Hold up!", button) == DialogResult.Yes)
     {
         Spawns.Clear();
         UpdateEnemyList();
         UpdateTextboxesValues();
     }
 }
Esempio n. 13
0
        public void invalidFunctionPopUp(string type)
        {
            System.Windows.Forms.MessageBoxButtons button = System.Windows.Forms.MessageBoxButtons.OK;
            string caption = "INVALID FUNCTION NAME";
            string message = ($"{type} function doesn't exist in the current context!");

            message = message.Substring(0, 1).ToUpper() + message.Substring(1, message.Length - 1);
            System.Windows.Forms.MessageBoxIcon icon = System.Windows.Forms.MessageBoxIcon.Error;
            System.Windows.Forms.MessageBox.Show(message, caption, button, icon);
        }
Esempio n. 14
0
        // Set Font property and then add a new Label.


        private void button1_Click_1(object sender, EventArgs e)        // Allocate
        {
            if (First_Fit.Checked == false && Best_Fit.Checked == false && Worst_Fit.Checked == false)
            {
                string message = "Please choose the technique";
                string caption = "missing data !";
                System.Windows.Forms.MessageBoxButtons buttons = System.Windows.Forms.MessageBoxButtons.OK;
                System.Windows.Forms.MessageBox.Show(message, caption, buttons);
            }

            else if (textbox_NameOfProcess.Text == "" && textbox_SizeOfProcess.Text == "")
            {
                string message = "Please Enter The name of the process you want to allocate and its size";
                string caption = "missing data !";
                System.Windows.Forms.MessageBoxButtons buttons = System.Windows.Forms.MessageBoxButtons.OK;
                System.Windows.Forms.MessageBox.Show(message, caption, buttons);
            }
            else if (textbox_NameOfProcess.Text == "")
            {
                string message = "Please Enter The name of process";
                string caption = "missing data !";
                System.Windows.Forms.MessageBoxButtons buttons = System.Windows.Forms.MessageBoxButtons.OK;
                System.Windows.Forms.MessageBox.Show(message, caption, buttons);
            }

            else if (textbox_SizeOfProcess.Text == "")
            {
                string message = "Please Enter The size of process  you want to allocate";
                string caption = "missing data !";
                System.Windows.Forms.MessageBoxButtons buttons = System.Windows.Forms.MessageBoxButtons.OK;
                System.Windows.Forms.MessageBox.Show(message, caption, buttons);
            }

            else
            {
                Name_OF_Process = textbox_NameOfProcess.Text;
                Size_OF_Process = Convert.ToInt32(textbox_SizeOfProcess.Text);

                if (First_Fit.Checked)
                {
                    allocate_first_fit.run(ArrayOfHoles, Size_OF_Process, Name_OF_Process);
                    Drawing(ArrayOfHoles, ArrayOfgaps, false);
                }
                else if (Best_Fit.Checked)
                {
                    allocate_best_fit.run(ArrayOfHoles, Size_OF_Process, Name_OF_Process);
                    Drawing(ArrayOfHoles, ArrayOfgaps, false);
                }
                else if (Worst_Fit.Checked)
                {
                    allocate_worst_fit.run(ArrayOfHoles, Size_OF_Process, Name_OF_Process);
                    Drawing(ArrayOfHoles, ArrayOfgaps, false);
                }
            }
        }
Esempio n. 15
0
        private void BtnRename_Click(object sender, RoutedEventArgs e)
        {
            // to check if ther user is running this program a secound time.
            //If so they could have already picked a directory and would like to use the one they already selected
            if (app.FileData.FirstRun == true)
            {
                //get out of if statements and go on and run the program
            }
            else if (app.FileData.NumOfFiles != 0 && app.FileData.NoPath == false)
            {
                app.FileData.ClearData(false);
            }
            else if (app.FileData.NumOfFiles != 0)
            {
                app.FileData.ClearData(true);
            }

            app.FileData.StartingEp = (int)numStartingCount.Value;

            CheckIfNoPath();

            GetShowData();


            if (chkSubtitles.IsChecked == true)
            {
                if (txtSubtitles.Text != null)
                {
                    app.FileData.SubLang = txtSubtitles.Text;
                }
                app.FileData.NewFileNames = app.GenerateNewNamesForSubs(app.FileData.OldFileNames, app.FileData.NumOfFiles, (int)app.FileData.StartingEp);
            }
            else
            {
                app.FileData.NewFileNames = app.GenerateNewNames(app.FileData.OldFileNames, app.FileData.NumOfFiles, (int)app.FileData.StartingEp);
            }

            string message = "You are about to rename files in " + app.FileData.Path;
            string title   = "Are you Sure?";

            WinForm.MessageBoxButtons buttons = WinForm.MessageBoxButtons.YesNo;
            WinForm.DialogResult      result  = WinForm.MessageBox.Show(message, title, buttons);

            if (result == WinForm.DialogResult.Yes)
            {
                app.RenameFiles();
                app.GetFileList();
                DisplayData(app.FileData.OldFileNames);
                app.FileData.NoPath = true;
            }
            app.FileData.FirstRun = false;
        }
Esempio n. 16
0
        public System.Windows.Forms.DialogResult ShowDialog(IWin32Window owner,
                                                            string text, string detail = "", string caption = "DialogAsShieldIcon",
                                                            System.Windows.Forms.MessageBoxButtons Buttons = System.Windows.Forms.MessageBoxButtons.OKCancel,
                                                            System.Windows.Forms.MessageBoxIcon icon       = MessageBoxIcon.Question)
        {
            this.Label1.Text     = text;
            this.Text            = caption;
            this.TextDetail.Text = detail;

            switch (Buttons)
            {
            case MessageBoxButtons.OKCancel:
                OK_Button.Text     = "OK";
                Cancel_Button.Text = "Cancel";
                break;

            case MessageBoxButtons.YesNo:
                OK_Button.Text     = "Yes";
                Cancel_Button.Text = "No";
                break;

            default:
                OK_Button.Text     = "OK";
                Cancel_Button.Text = "Cancel";
                break;
            }
            // とりあえずアイコンは処理しない(互換性のためパラメータだけ指定できる)

            base.ShowDialog(this.Owner);
            while (this.dResult == System.Windows.Forms.DialogResult.None)
            {
                System.Threading.Thread.Sleep(200);
                Application.DoEvents();
            }
            if (Buttons == MessageBoxButtons.YesNo)
            {
                switch (dResult)
                {
                case System.Windows.Forms.DialogResult.OK:
                    return(System.Windows.Forms.DialogResult.Yes);

                case System.Windows.Forms.DialogResult.Cancel:
                    return(System.Windows.Forms.DialogResult.No);
                }
            }
            else
            {
                return(dResult);
            }

            return(dResult);
        }
Esempio n. 17
0
 public static string msg(string args)
 {
     System.Windows.Forms.MessageBoxButtons buttons = System.Windows.Forms.MessageBoxButtons.OK;
     if (args.Length > 3)
     {
         if (args.Substring(0, 4).ToUpper() == "(YN)")
         {
             args    = args.Substring(4);
             buttons = System.Windows.Forms.MessageBoxButtons.YesNo;
         }
     }
     return("[" + MessageBox.Show(args, "Mensagem", buttons) + "]");
 }
Esempio n. 18
0
        private bool SafeToContinueHighlight()
        {
            //checks
            //1. selects are set
            //2. if something is already highlighted,
            // make sure it's ok with the user

            //first see if file is set
            if (!this.FileSelected())
            {
                Forms.MessageBox.Show(Strings.fileNotSelectedMessage, Strings.fileNotSelectedCaption);
                return(false);
            }

            //validate selects
            if (!Globals.ThisAddIn.Ribbon.SelectsSet())
            {
                Forms.MessageBox.Show(Strings.rangeNotSetMessage, Strings.rangeNotSetCaption);
                return(false);
            }

            //Check here if any part of the text is already highlighted
            //If so, warn the user
            Word.Range range = null;
            if (prevRange != null)
            {
                range = prevRange;
            }
            else
            {
                range = this.FindRange();
            }

            if (range.HighlightColorIndex != Colors.none)
            {
                //format the message
                Forms.MessageBoxButtons buttons = Forms.MessageBoxButtons.YesNo;
                Forms.DialogResult      result;
                // Displays the warning
                result = Forms.MessageBox.Show(Strings.alreadyHighlightedMessage, Strings.alreadyHighlightedCaption, buttons);

                //can be abort or no, so just say
                //if not yes then abort operation
                if (result != Forms.DialogResult.Yes)
                {
                    return(false);
                }
            }

            return(true);
        }
Esempio n. 19
0
 private void SummaryButton_Click(object sender, RoutedEventArgs e)
 {
     if (input_folder == null || output_folder == null)
     {
         string message = "Please, select the Source and Output directories!";
         string caption = "Missing root folder";
         WinForms.MessageBoxButtons buttons = WinForms.MessageBoxButtons.OK;
         WinForms.DialogResult      result;
         // Displays the MessageBox.
         result = WinForms.MessageBox.Show(message, caption, buttons);
     }
     else
     {
         processingThread = new Thread(new ThreadStart(WriteSummary));
         processingThread.Start();
     }
 }
Esempio n. 20
0
 private void ExtractButton_Click(object sender, RoutedEventArgs e)
 {
     if (input_folder == null || output_folder == null)// || !imageStreams.Any())
     {
         string message = "Please, select the Source and Output directories!";
         string caption = "Missing root folder";
         WinForms.MessageBoxButtons buttons = WinForms.MessageBoxButtons.OK;
         WinForms.DialogResult      result;
         // Displays the MessageBox.
         result = WinForms.MessageBox.Show(message, caption, buttons);
     }
     else
     {
         processingThread = new Thread(new ThreadStart(ProcessingThread));
         processingThread.Start();
         stopButton.IsEnabled    = true;
         ExtractButton.IsEnabled = false;
     }
 }
Esempio n. 21
0
        public void doAction()
        {
            if (trianglePossible())
            {
                using (Graphics g = Graphics.FromImage(f.getBitmap()))
                {
                    g.DrawPolygon(Pens.White, drawPoints());
                    g.Dispose();
                }

                f.getMainDraw().Invalidate();
            }
            else
            {
                System.Windows.Forms.MessageBoxButtons button = System.Windows.Forms.MessageBoxButtons.OK;
                string caption = "Invalid parameters";
                string message = ("Cannot make triangle from these sides");
                System.Windows.Forms.MessageBoxIcon icon = System.Windows.Forms.MessageBoxIcon.Error;
                System.Windows.Forms.MessageBox.Show(message, caption, button, icon);
            }
        }
Esempio n. 22
0
        private void stopButton_Click(object sender, RoutedEventArgs e)
        {
            string message = "Are you sure to abort the database extraction?\n You will need to start from beginning if you stop now!";
            string caption = "Stop Extraction";

            WinForms.MessageBoxButtons buttons = WinForms.MessageBoxButtons.YesNo;
            WinForms.DialogResult      result;
            // Displays the MessageBox.
            result = WinForms.MessageBox.Show(message, caption, buttons);

            if (result == WinForms.DialogResult.Yes)
            {
                processingThread.Abort();

                stopButton.IsEnabled    = false;
                ExtractButton.IsEnabled = false;
                sourceButton.IsEnabled  = true;
                outputButton.IsEnabled  = true;
                setupButton.IsEnabled   = true;
            }
        }
Esempio n. 23
0
        public static DialogResult Show(string pText, string pCaption, System.Windows.Forms.MessageBoxButtons pButtons, System.Windows.Forms.MessageBoxIcon pIcon)
        {
            var myMessageBox = new frmMessageBox();

            myMessageBox.Text              = pCaption;
            myMessageBox.lblMessage.Text   = pText;
            myMessageBox.MessageBoxButtons = pButtons;
            myMessageBox.MessageBoxIcon    = pIcon;

            myMessageBox.SetMessageStyle();

            //Application.GetInstance ( ).Forms.ActiveForm;
            myMessageBox.PlaySong();

            if (ActiveForm != null && !ActiveForm.InvokeRequired)
            {
                return(myMessageBox.ShowDialog(ActiveForm));
            }

            myMessageBox.TopMost = true;

            return(myMessageBox.ShowDialog(true));
        }
 public System.Windows.Forms.DialogResult ShowMessageBox(string text, string caption, System.Windows.Forms.MessageBoxButtons buttons = MessageBoxButtons.OK, MessageBoxIcon icon = MessageBoxIcon.Asterisk)
 {
     return(XtraMessageBox.Show(text, caption, buttons, icon));
 }
Esempio n. 25
0
        //┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
        //  start access operation
        //┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
        internal void StartAccess()
        {
            button_access.Text = "STOP";

            // lock operation
            if (radioButton_lock.Checked)
            {
                UInt32 pwdACCESS;
                ushort lock_enable = 0;
                ushort lock_mask   = 0;

                int mark;
                int index = (int)comboBox_bank.SelectedIndex;

                if (false == UtilClass.HEX32(out pwdACCESS, textBox_accesspassword.Text))
                {
                    AccessEnd();
                    MessageBox.Show("Wrong Access Password!!");
                    return;
                }

                // set kill password field
                if (index == 0)
                {
                    mark = (int)comboBox_lockop.SelectedIndex;
                }
                else
                {
                    mark = 0;
                }

                lock_enable |= SWAPLSB2(mark > 0 ? mark - 1 : 0);
                lock_mask   |= (ushort)(mark > 0 ? 3 : 0);

                lock_enable <<= 2;
                lock_mask   <<= 2;

                // set access password field
                if (index == 1)
                {
                    mark = (int)comboBox_lockop.SelectedItem;
                }
                else
                {
                    mark = 0;
                }

                lock_enable |= SWAPLSB2(mark > 0 ? mark - 1 : 0);
                lock_mask   |= (ushort)(mark > 0 ? 3 : 0);

                lock_enable <<= 2;
                lock_mask   <<= 2;

                // set EPC memory field
                if (index == 2)
                {
                    mark = (int)comboBox_lockop.SelectedItem;
                }
                else
                {
                    mark = 0;
                }

                lock_enable |= SWAPLSB2(mark > 0 ? mark - 1 : 0);
                lock_mask   |= (ushort)(mark > 0 ? 3 : 0);

                lock_enable <<= 2;
                lock_mask   <<= 2;

                // TID memory field
                if (index == 3)
                {
                    mark = (int)comboBox_lockop.SelectedItem;
                }
                else
                {
                    mark = 0;
                }

                lock_enable |= SWAPLSB2(mark > 0 ? mark - 1 : 0);
                lock_mask   |= (ushort)(mark > 0 ? 3 : 0);

                lock_enable <<= 2;
                lock_mask   <<= 2;

                // USER memory field
                if (index == 4)
                {
                    mark = (int)comboBox_lockop.SelectedItem;
                }
                else
                {
                    mark = 0;
                }

                lock_enable |= SWAPLSB2(mark > 0 ? mark - 1 : 0);
                lock_mask   |= (ushort)(mark > 0 ? 3 : 0);

                MainForm.RFIDAPI.UHFAPI_LockSetTag((UHFAPI_NET.UHFAPI_NET.typeLockMasks)lock_mask, (UHFAPI_NET.UHFAPI_NET.typeLockMasks)lock_enable, pwdACCESS, MainForm.SetControlParam, false);
            }

            else if (radioButton_kill.Checked)
            {
                UInt32 pwdACCESS;
                UInt32 pwdKILL;

                if (false == UtilClass.HEX32(out pwdACCESS, textBox_accesspassword.Text))
                {
                    AccessEnd();
                    MessageBox.Show("Wrong Access Password!!");
                    return;
                }

                if (false == UtilClass.HEX32(out pwdKILL, textBox_killpassword.Text))
                {
                    AccessEnd();
                    MessageBox.Show("Wrong Access Password!!");
                    return;
                }

                System.Windows.Forms.MessageBoxButtons button = System.Windows.Forms.MessageBoxButtons.YesNo;
                System.Windows.Forms.MessageBoxIcon    icon   = System.Windows.Forms.MessageBoxIcon.Warning;
                System.Windows.Forms.DialogResult      rts    = System.Windows.Forms.MessageBox.Show("If you click on this YES, the kill tag will run..", "", button, icon);

                switch (rts)
                {
                case System.Windows.Forms.DialogResult.Yes:
                {
                    MainForm.SetupOperationParameter();

                    MainForm.RFIDAPI.UHFAPI_KillTag(pwdKILL, pwdACCESS, MainForm.SetControlParam, false);
                }
                break;

                case System.Windows.Forms.DialogResult.No:
                {
                    AccessEnd();
                }
                break;
                }
            }
        }
Esempio n. 26
0
 public static WF.DialogResult ShowMessage(WF.IWin32Window owner = null, string text = null, string caption = null, WF.MessageBoxButtons buttons = WF.MessageBoxButtons.OK, WF.MessageBoxIcon icon = WF.MessageBoxIcon.Information, WF.MessageBoxDefaultButton defaultButton = WF.MessageBoxDefaultButton.Button1)
 {
     if (owner == null)
     {
         owner = GetMainForm();
     }
     if (string.IsNullOrEmpty(text))
     {
         text = "Informace nebyla zadána";
     }
     if (string.IsNullOrEmpty(caption))
     {
         caption = AppTitle;
     }
     if (owner != null && owner is WF.Form form && form.InvokeRequired)
     {
         return((WF.DialogResult)form.Invoke(new Func <WF.IWin32Window, string, string, WF.MessageBoxButtons, WF.MessageBoxIcon, WF.MessageBoxDefaultButton, WF.DialogResult>(_ShowMessage), owner, text, caption, buttons, icon, defaultButton));
     }
Esempio n. 27
0
 public static DialogResult Show(IWin32Window owner, string text, string caption, System.Windows.Forms.MessageBoxButtons buttons, MessageBoxIcon icon)
 {
     return(DevExpress.XtraEditors.XtraMessageBox.Show(owner, text, caption, buttons, icon));
 }
Esempio n. 28
0
 public static DialogResult Warning(string message, System.Windows.Forms.MessageBoxButtons buttons = System.Windows.Forms.MessageBoxButtons.OK)
 {
     return(System.Windows.Forms.MessageBox.Show(message, Application.ProductName, buttons, System.Windows.Forms.MessageBoxIcon.Warning));
 }
Esempio n. 29
0
 ///<summary>Shows a message to the user.  Automatically checks to see if a progress window is showing and will ask the progress window
 ///to show the message to the user so that the progress window doesn't cover up the question.</summary>
 public static System.Windows.Forms.DialogResult Show(System.Windows.Forms.IWin32Window owner, string text, string caption,
                                                      System.Windows.Forms.MessageBoxButtons buttons, System.Windows.Forms.MessageBoxIcon icon)
 {
     return(ShowHelper((formPB) => formPB.MsgBoxShow(text, caption, buttons, icon), () => System.Windows.Forms.MessageBox.Show(owner, text, caption, buttons, icon)));
 }
Esempio n. 30
0
 ///<summary>Shows a message to the user.  Automatically checks to see if a progress window is showing and will ask the progress window
 ///to show the message to the user so that the progress window doesn't cover up the question.</summary>
 public static System.Windows.Forms.DialogResult Show(string text, string caption, System.Windows.Forms.MessageBoxButtons buttons)
 {
     return(ShowHelper((formPB) => formPB.MsgBoxShow(text, caption, buttons), () => System.Windows.Forms.MessageBox.Show(text, caption, buttons)));
 }