Beispiel #1
0
        private void Border_Drop(object sender, DragEventArgs e)
        {
            // Check if a file was dropped
            if (FileDropped(e))
            {
                // Get the list of input files
                string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
                // Check the files whether they need to be fixed
                bool properFiles = true;
                foreach (string tmpFile in files)
                {
                    properFiles = (properFiles && ExtensionFixer.IsValidFile(tmpFile));
                }
                if (!properFiles)
                {
                    // If files are OK, notify user and exit
                    // TODO: show the filename for single file input
                    MessageBox.Show(this, "Исправление файлов не требуется");
                    return;
                }

                // Ask user what to do with source files
                MsgBoxResult promptRes = Interaction.MsgBox("Сохранить исходные файлы?", MsgBoxStyle.YesNoCancel, this.Title);
                bool         preserveSrc;
                switch (promptRes)
                {
                case MsgBoxResult.Yes:
                    preserveSrc = true;
                    break;

                case MsgBoxResult.No:
                    preserveSrc = true;
                    break;

                default:
                    return;
                }

                // Process every file
                string[] filesFixed = ExtensionFixer.FixFiles(files, preserveSrc);
                // Notify user on result
                string userMessage;
                switch (filesFixed.Length)
                {
                case 0:
                    userMessage = "Исправление файлов не требуется";
                    break;

                case 1:
                    userMessage = "Файл исправлен успешно!";
                    break;

                default:
                    userMessage = "Файлы исправлены успешно!";
                    break;
                }
                // Notify user
                MessageBox.Show(this, userMessage);
            }
        }
Beispiel #2
0
        public static MsgBoxResult Show(string messageBoxText,
                                        string caption,
                                        string details,
                                        MsgBoxButtons buttonOption,
                                        MsgBoxImage image,
                                        MsgBoxResult btnDefault = MsgBoxResult.None,
                                        object helpLink         = null,
                                        string helpLinkTitle    = "",
                                        string helpLabel        = "",
                                        Func <object, bool> navigateHelplinkMethod = null,
                                        bool enableCopyFunction = false)
        {
            // Construct the message box viewmodel
            ViewModel.MsgBoxViewModel viewModel = new ViewModel.MsgBoxViewModel(messageBoxText,
                                                                                caption,
                                                                                details,
                                                                                buttonOption,
                                                                                image,
                                                                                btnDefault,
                                                                                helpLink, helpLinkTitle, navigateHelplinkMethod,
                                                                                enableCopyFunction);

            viewModel.HyperlinkLabel = helpLabel;

            // Construct the message box view and add the viewmodel to it
            MsgBox.mMessageBox = new MsgBox();

            MsgBox.mMessageBox.DataContext = viewModel;

            MsgBox.mMessageBox.ShowDialog();

            return(viewModel.Result);
        }
Beispiel #3
0
        private void Parameter_Save_Click(object sender, EventArgs e)
        {
            for (uint member = 1; member < Parameter.Length; member++)
            {
                try
                {
                    float value = (float)Convert.ToDouble(ParameterView.Rows[(int)member].Cells["Parameter_Value"].Value);
                    if (PARAM_Write(member, value) == false)
                    {
                        member = (uint)Parameter.Length;
                    }
                }
                catch (FormatException)
                {
                    Interaction.MsgBox("Invalid input Format at " + Parameter[member].name, MsgBoxStyle.OkOnly, "Error Input");
                    member = (uint)Parameter.Length;
                }
                catch (InvalidCastException)
                {
                    Interaction.MsgBox("Invalid input Cast at " + Parameter[member].name, MsgBoxStyle.OkOnly, "Error Input");
                    member = (uint)Parameter.Length;
                }
            }

            MsgBoxResult Res = Interaction.MsgBox("Do you want to Update new parameter?", MsgBoxStyle.YesNo, "Warning");

            if (Res == MsgBoxResult.Yes)
            {
                CMD = ParamCMD.ParamSAVE;
            }
        }
Beispiel #4
0
        public override bool?ReadYesNoCancel(string prompt, bool?defaultYes)
        {
            MsgBoxStyle style = MsgBoxStyle.YesNoCancel;

            style |= (defaultYes == true ? MsgBoxStyle.DefaultButton1
                : defaultYes == false ? MsgBoxStyle.DefaultButton2
                    : MsgBoxStyle.DefaultButton3);
            while (true)
            {
                MsgBoxResult val = SafeMsgBox(prompt, "ReadYesNoCancel", style);
                Debug.Assert(val == MsgBoxResult.Yes || val == MsgBoxResult.No ||
                             val == MsgBoxResult.Cancel);
                // true==Yes, false==No
                if (val == MsgBoxResult.Yes)
                {
                    return(true);
                }
                else if (val == MsgBoxResult.No)
                {
                    return(false);
                }
                else
                {
                    return(null);
                }
            }
        }
Beispiel #5
0
        /// <summary>
        /// Determine a default button (such as OK or Yes) to be executed when the user hits the ENTER key.
        /// </summary>
        /// <param name="buttonOption"></param>
        private MsgBoxResult SetupDefaultButton(MsgBoxButtons buttonOption,
                                                MsgBoxResult defaultButton)
        {
            MsgBoxResult ret = defaultButton;

            // Lets define a useful default button (can be executed with ENTER)
            // if caller did not define a button or
            // if did not explicitly told the sub-system to not define a default button via MsgBoxResult.NoDefaultButton
            if (defaultButton == MsgBoxResult.None)
            {
                switch (buttonOption)
                {
                case MsgBoxButtons.Close:
                    ret = MsgBoxResult.Close;
                    break;

                case MsgBoxButtons.OK:
                case MsgBoxButtons.OKCancel:
                case MsgBoxButtons.OKClose:
                    ret = MsgBoxResult.Ok;
                    break;

                case MsgBoxButtons.YesNo:
                case MsgBoxButtons.YesNoCancel:
                    ret = MsgBoxResult.Yes;
                    break;
                }
            }

            return(ret);
        }
Beispiel #6
0
        /// <summary>
        /// Class constructor
        /// </summary>
        /// <param name="caption"></param>
        /// <param name="messageBoxText"></param>
        /// <param name="innerMessage"></param>
        /// <param name="buttonOption"></param>
        /// <param name="image"></param>
        /// <param name="defaultButton"></param>
        /// <param name="helpLink"></param>
        /// <param name="helpLinkTitle"></param>
        /// <param name="navigateHelplinkMethod"></param>
        /// <param name="enableCopyFunction"></param>
        internal MsgBoxViewModel(string messageBoxText,
                                 string caption,
                                 string innerMessage,
                                 MsgBoxButtons buttonOption,
                                 MsgBoxImage image,
                                 MsgBoxResult defaultButton = MsgBoxResult.None,
                                 object helpLink            = null,
                                 string helpLinkTitle       = "",
                                 Func <object, bool> navigateHelplinkMethod = null,
                                 bool enableCopyFunction = false)
        {
            this.Title               = caption;
            this.Message             = messageBoxText;
            this.InnerMessageDetails = innerMessage;

            this.SetButtonVisibility(buttonOption);

            this.mIsDefaultButton = this.SetupDefaultButton(buttonOption, defaultButton);

            this.SetImageSource(image);
            this.mHelpLink      = helpLink;
            this.mHelpLinkTitle = helpLinkTitle;

            this.mResult            = MsgBoxResult.None;
            this.mDialogCloseResult = null;

            if (navigateHelplinkMethod != null)
            {
                this.mNavigateHyperlinkMethod = navigateHelplinkMethod;
            }

            this.EnableCopyFunction = enableCopyFunction;
        }
Beispiel #7
0
        protected void deleting(object sender, EventArgs e)
        {
            MsgBoxResult correctionsQ = Interaction.MsgBox("هل انت متاكد من عملية حذف الحساب؟  ", MsgBoxStyle.YesNo);

            if (correctionsQ == MsgBoxResult.Yes)
            {
                SqlConnection conn = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\ehsbhaWebApp\Ehsbha_SP\Ehsbha_SP\App_Data\ehsbhaDB.mdf;Integrated Security=True");
                conn.Open();
                String     deleteS = "delete from sale where userId='" + Session["User"].ToString() + "'";
                SqlCommand com     = new SqlCommand(deleteS, conn);
                com.ExecuteNonQuery();
                String deleteP = "delete from purchase where userId='" + Session["User"].ToString() + "'";
                com = new SqlCommand(deleteP, conn);
                com.ExecuteNonQuery();
                String deleteAccount = "DELETE FROM users WHERE userId ='" + Session["User"].ToString() + "'";
                com = new SqlCommand(deleteAccount, conn);
                com.ExecuteNonQuery();
                conn.Close();

                Session["User"] = null;
                Response.Redirect("startPageA.aspx");
            }
            else
            {
                Response.Redirect("settingArabic.aspx");
            }
        }
Beispiel #8
0
        MsgBoxResult SafeMsgBox(string prompt, string title,
                                MsgBoxStyle buttons)
        {
            MsgBoxResult result   = MsgBoxResult.Cancel;
            ButtonsType  buttons2 = Convert(buttons);
            EventHandler dlgt     = delegate {
                var dlg = new MessageDialog(_parent, DialogFlags.Modal,
                                            MessageType.Question, buttons2, prompt + "  [ " + GetDefaultString(buttons) + " ]");
                var dflt = GetDefaultResponse(buttons);
                dlg.DefaultResponse = dflt;
                while (true)
                {
                    var resultG = (Gtk.ResponseType)dlg.Run();
                    result = Convert(resultG);
                    bool isYN = (result == MsgBoxResult.Yes || result == MsgBoxResult.No);
                    bool isC  = (result == MsgBoxResult.Cancel);
                    if (isYN ||
                        (Enum_FlagEquals(buttons, MsgBoxStyle.YesNoCancel) &&
                         isC)
                        )
                    {
                        break;
                    }
                }//while
                dlg.Destroy();
            };

            SafeInvoke(this.tb, dlgt);
            return(result);
        }
Beispiel #9
0
        private void ProgressTracker_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (downloadForm.downloadPool.current.GetCount() > 0) //downloadForm.downloadInfoList.Select(x => x.CurrentSpeed == "Processing file...").Any(x => x) ||
                                                                  //downloadForm.downloadInfoList.Select(x => x.CurrentSpeed == "Sto elaborando il file...").Any(x => x))
            {
                // We don't want the user to stop a file whilst it's processing.
                // TODO: Add the existing file check to poliwebex.js
                //MessageBox.Show("Please wait until the file is done processing.");
                //e.Cancel = true;
                //return;
                //}

                //if (!(!downloadForm.downloadInfoList.Select(x => x.CurrentSpeed != "Finished.").Any(x => x) ||
                //    !downloadForm.downloadInfoList.Select(x => x.CurrentSpeed != "Finito.").Any(x => x)))
                //{
                MsgBoxResult ans = StartupForm.IsItalian
                    ? Interaction.MsgBox("Sei sicuro? Interromperà i download correnti e dovrai ricominciare da capo", MsgBoxStyle.YesNo, "Exit?")
                    : Interaction.MsgBox("Are you sure? This will stop all current downloads and you will have to start from scratch", MsgBoxStyle.YesNo, "Exit?");

                //bool? isSegmented = downloadForm.downloadPool.WeHaveSegmentedDownloadsCurrently();

                if (ans == MsgBoxResult.Ok || ans == MsgBoxResult.Yes)
                {
                    KillAllProcesses(this.downloadForm.downloadPool);
                }
                else
                {
                    e.Cancel = true;
                }
            }
        }
Beispiel #10
0
        private void label9_Click(object sender, EventArgs e)
        {
            string selectedScriptName = this.scriptList.SelectedItem.ToString();

            if (this.scriptList.SelectedIndex <= 0)
            {
                return;
            }
            MsgBoxResult result = Interaction.MsgBox("确定删除此进程吗?", MsgBoxStyle.OkCancel, "提示");

            if (result != MsgBoxResult.Ok)
            {
                return;
            }
            else
            {
                try
                {
                    Config.deleteConfigByName(selectedScriptName, currentPath + "\\" + confFileName);

                    MessageBox.Show("删除成功", "提示",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
                    InitSavedScript();
                }
                catch (Exception x)
                {
                    MessageBox.Show("删除过程中出现了错误,建议重新启动程序\r\n" + x.Message + "\r\n" + x.StackTrace, "警告",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                    this.Close();
                }
            }
        }
Beispiel #11
0
 private void SubscribeEvents()
 {
     activeButtons.ForEach((btn, index) => btn.Click += (s, e) =>
     {
         SelectionResult = (MsgBoxResult)index;
         Close();
     });
 }
Beispiel #12
0
 private void CloseDialog(MsgBoxResult res)
 {
     Refresh();
     Visible = false;
     if (_callback != null)
     {
         _callback(res);
     }
 }
Beispiel #13
0
        public static MsgBoxResult Show(Exception exp, string caption,
                                        MsgBoxButtons buttonOption, MsgBoxImage image,
                                        MsgBoxResult btnDefault = MsgBoxResult.None,
                                        object helpLink         = null,
                                        string helpLinkTitle    = "",
                                        string helpLabel        = "",
                                        Func <object, bool> navigateHelplinkMethod = null,
                                        bool enableCopyFunction = false)
        {
            string sMess          = "Unknown error occured.";
            string messageBoxText = string.Empty;

            if (true)
            {
                try
                {
                    messageBoxText = exp.Message;

                    Exception innerEx = exp.InnerException;

                    for (int i = 0; innerEx != null; i++, innerEx = innerEx.InnerException)
                    {
                        string spaces = string.Empty;

                        for (int j = 0; j < i; j++)
                        {
                            spaces += "  ";
                        }

                        messageBoxText += "\n" + spaces + "+->" + innerEx.Message;
                    }

                    sMess = exp.ToString();
                }
                catch
                {
                }
            }

            // Construct the message box viewmodel
            ViewModel.MsgBoxViewModel viewModel = new ViewModel.MsgBoxViewModel(messageBoxText, caption,
                                                                                sMess,
                                                                                buttonOption, image, btnDefault,
                                                                                helpLink, helpLinkTitle, navigateHelplinkMethod,
                                                                                enableCopyFunction);

            viewModel.HyperlinkLabel = helpLabel;

            // Construct the message box view and add the viewmodel to it
            MsgBox.mMessageBox = new MsgBox();

            MsgBox.mMessageBox.DataContext = viewModel;

            MsgBox.mMessageBox.ShowDialog();

            return(viewModel.Result);
        }
Beispiel #14
0
 MsgBoxResult IMsgBoxService.Show(string messageBoxText,
                                  MsgBoxResult btnDefault,
                                  object helpLink,
                                  string helpLinkTitle, string helpLinkLabel,
                                  Func <object, bool> navigateHelplinkMethod,
                                  bool showCopyMessage)
 {
     return(View.MsgBox.Show(messageBoxText, btnDefault,
                             helpLink, helpLinkTitle, helpLinkLabel, navigateHelplinkMethod, showCopyMessage));
 }
Beispiel #15
0
 public static MsgBoxResult Show(string messageBoxText, string caption, MsgBoxImage image,
                                 MsgBoxResult btnDefault = MsgBoxResult.None,
                                 object helpLink         = null,
                                 string helpLinkTitle    = "",
                                 string helpLabel        = "",
                                 Func <object, bool> navigateHelplinkMethod = null,
                                 bool enableCopyFunction = false)
 {
     return(Show(messageBoxText, caption, string.Empty, MsgBoxButtons.OK, image, btnDefault,
                 helpLink, helpLinkTitle, helpLabel, navigateHelplinkMethod, enableCopyFunction));
 }
Beispiel #16
0
        internal static bool ShowErrorMessage(Exception e, bool canRetry)
        {
            string      msg = string.Format(ERR_MSG, e.GetType().FullName, Environment.NewLine, e.Message);
            MsgBoxStyle btn = canRetry
                ? MsgBoxStyle.RetryCancel | MsgBoxStyle.DefaultButton1 | MsgBoxStyle.Critical | MsgBoxStyle.SystemModal | MsgBoxStyle.MsgBoxSetForeground
                : MsgBoxStyle.OkOnly | MsgBoxStyle.DefaultButton1 | MsgBoxStyle.Critical | MsgBoxStyle.SystemModal | MsgBoxStyle.MsgBoxSetForeground;

            MsgBoxResult res = Interaction.MsgBox(msg, btn, ERR_MSG_TITLE);

            return(res == MsgBoxResult.Retry);
        }
Beispiel #17
0
        //void Pause__old()
        //{
        //    //bool hc = this.tb.IsHandleCreated;
        //    bool ir = this.tb.InvokeRequired;
        //    if (ir) { //DEBUG
        //    }
        //    MessageBox.Show("Pause" + (ir ? " InvokeRequired!!" : " (is on UI thread)"), "Pause",
        //        MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1);
        //}

        public override bool ReadYesNo(string prompt, bool defaultYes)
        {
            MsgBoxStyle style = MsgBoxStyle.YesNo;

            style |= (defaultYes ? MsgBoxStyle.DefaultButton1 : MsgBoxStyle.DefaultButton2);
            while (true)
            {
                MsgBoxResult val = SafeMsgBox(prompt, "ReadYesNo", style);
                Debug.Assert(val == MsgBoxResult.Yes || val == MsgBoxResult.No);
                return(val == MsgBoxResult.Yes);  // true==Yes, false==No
            }
        }
Beispiel #18
0
        MsgBoxResult SafeMsgBox(string prompt, string title,
                                MsgBoxStyle buttons)
        {
            MsgBoxResult result = MsgBoxResult.Cancel;
            EventHandler dlgt   = delegate
            {
                result = Interaction.MsgBox(prompt, buttons,
                                            title);
            };

            SafeInvoke(this.tb, dlgt);
            return(result);
        }
Beispiel #19
0
 private void btn_save_Click_1(object sender, EventArgs e)
 {
     if (this.tb_templatePath.Text.Trim() != _TemplatePath.Trim())
     {
         MsgBoxResult y = Interaction.MsgBox("You have changed the Default Template Path and have not saved it.  Do you want to save this new Template Path?  A Template path is used mostly if you are storing on a network location.  Note this will overwrite all defaults to this, if this is not what you want click NO then close this and click CLEAR TEMPLATE to reload defaults", MsgBoxStyle.YesNo);
         if (y == MsgBoxResult.Yes)
         {
             saveDefaults();
         }
     }
     Interaction.MsgBox("This template will UPDATE for this run, click SAVE TEMPLATE to actually save it for future uses when this closes.");
     this.Close();
 }
Beispiel #20
0
        public override bool?ReadYesNoCancel(string prompt, bool?defaultYes)
        {
            MsgBoxStyle style = MsgBoxStyle.YesNoCancel;

            style |= (defaultYes == true ? MsgBoxStyle.DefaultButton1
                : defaultYes == false ? MsgBoxStyle.DefaultButton2
                    : MsgBoxStyle.DefaultButton3);
            var twoChoicesSupportedOnly = false;

#if NETCF
            twoChoicesSupportedOnly = SystemSettings.Platform == WinCEPlatform.Smartphone;
#endif
            if (twoChoicesSupportedOnly)
            {
                bool result;
                result = ReadYesNo("Choose Yes or No/Cancel -- " + prompt, defaultYes == null);
                if (result)
                {
                    return(true);
                }
                result = ReadYesNo("Choose No or Cancel -- " + prompt, defaultYes == null);
                if (result)
                {
                    return(false);
                }
                else
                {
                    return(null);
                }
            }
            while (true)
            {
                MsgBoxResult val = SafeMsgBox(prompt, "ReadYesNoCancel", style);
                Debug.Assert(val == MsgBoxResult.Yes || val == MsgBoxResult.No ||
                             val == MsgBoxResult.Cancel);
                // true==Yes, false==No
                if (val == MsgBoxResult.Yes)
                {
                    return(true);
                }
                else if (val == MsgBoxResult.No)
                {
                    return(false);
                }
                else
                {
                    return(null);
                }
            }
        }
Beispiel #21
0
 MsgBoxResult IMsgBoxService.Show(Exception exp, string caption,
                                  MsgBoxButtons buttonOption, MsgBoxImage image,
                                  MsgBoxResult btnDefault = MsgBoxResult.None,
                                  object helpLink         = null,
                                  string helpLinkTitle    = "",
                                  string helpLabel        = "",
                                  Func <object, bool> navigateHelplinkMethod = null,
                                  bool showCopyMessage = false)
 {
     return(View.MsgBox.Show(exp, caption,
                             buttonOption, image, btnDefault,
                             helpLink, helpLinkTitle, helpLabel, navigateHelplinkMethod,
                             showCopyMessage));
 }
Beispiel #22
0
 /// <summary>
 /// Show a messagebox with details (such as a stacktrace or other information that can be kept in an expander).
 /// </summary>
 /// <param name="title"></param>
 /// <param name="message"></param>
 /// <param name="details"></param>
 /// <param name="buttonOption"></param>
 /// <param name="image"></param>
 /// <returns></returns>
 MsgBoxResult IMsgBoxService.Show(string messageBoxText,
                                  string caption,
                                  string details,
                                  MsgBoxButtons buttonOption,
                                  MsgBoxImage image,
                                  MsgBoxResult btnDefault,
                                  object helpLink,
                                  string helpLinkTitle, string helpLinkLabel,
                                  Func <object, bool> navigateHelplinkMethod,
                                  bool showCopyMessage)
 {
     return(View.MsgBox.Show(messageBoxText, caption, details,
                             buttonOption, image, btnDefault,
                             helpLink, helpLinkTitle, helpLinkLabel, navigateHelplinkMethod,
                             showCopyMessage));
 }
 private async Task ResetCredentials()
 {
     await Task.Run(() => {
         MsgBoxResult result = Interaction.MsgBox("A credentials reset for IMS was requested using the IMS remote interface.  Would you like to reset the IMS admin console username/password?", "IMS Credentials Reset", MsgBoxStyle.YesNo);
         if (result == MsgBoxResult.Yes)
         {
             IMSSettings settings  = IMS.Instance.CurrentSettings.Clone() as IMSSettings;
             settings.Username     = null;
             settings.PasswordHash = null;
             IMS.Instance.ChangeSettings(settings);
         }
         lock (Locker) {
             CurrentTask = null;
         }
     });
 }
        private void RemoveSaveButton_Click(object sender, EventArgs e)
        {
            if (SaveDataGridView.SelectedCells.Count > 0)
            {
                SystemSounds.Exclamation.Play();
                MsgBoxResult result = Interaction.MsgBox("Are you sure you want to delete?", MsgBoxStyle.YesNo);
                if (result == MsgBoxResult.Yes)
                {
                    for (int j = SaveDataGridView.SelectedCells.Count - 1; j >= 0; j += -1)
                    {
                        string saveName = Convert.ToString(SaveDataGridView[0, SaveDataGridView.SelectedCells[j].RowIndex].Value);

                        for (int i = 0; i <= DataList.SaveNames.Count - 1; i++)
                        {
                            if (saveName == DataList.SaveNames[i].Value)
                            {
                                try {
                                    if (Properties.Settings.Default.SaveListPermaDelete == false)
                                    {
                                        new Computer().FileSystem.DeleteDirectory(DataList.SaveNames[i].Key, Microsoft.VisualBasic.FileIO.UIOption.OnlyErrorDialogs, Microsoft.VisualBasic.FileIO.RecycleOption.SendToRecycleBin, Microsoft.VisualBasic.FileIO.UICancelOption.DoNothing);
                                    }
                                    else
                                    {
                                        Directory.Delete(DataList.SaveNames[i].Key, true);
                                    }

                                    SaveDataGridView.Rows.RemoveAt(SaveDataGridView.SelectedCells[j].RowIndex);
                                    DataList.SaveNames.RemoveAt(i);
                                    DataList.SaveLastModifiedDates.RemoveAt(i);
                                    //ResortDataGridView()
                                } catch (Exception ex) {
                                    SystemSounds.Hand.Play();
                                    Interaction.MsgBox(ex.Message);
                                }
                                break;
                            }
                        }
                    }
                }
                this.ActiveControl = null;
            }
            else
            {
                SystemSounds.Asterisk.Play();
            }
        }
Beispiel #25
0
 /// <summary>
 /// Remove a specified row and all it's data from settings.
 /// </summary>
 /// <param name="row">Corresponding row. (Name and settings data row)</param>
 private void RemoveGame(int row)
 {
     if (row >= 0)
     {
         if (DataGridView1.Rows.Count > 0)
         {
             SystemSounds.Exclamation.Play();
             MsgBoxResult result = Interaction.MsgBox("Are you sure you want to delete?", MsgBoxStyle.YesNo, "Warning");
             if (result == MsgBoxResult.Yes)
             {
                 StopAnyMainFormWork(); // stop any active elements
                 if (MainForm.Games.GameList.Remove(Convert.ToString(DataGridView1[0, row].Value)))
                 {
                     string txt = Convert.ToString(DataGridView1[1, row].Value);
                     DataGridView1.Rows.RemoveAt(row);
                     if (txt == "Current")
                     {
                         const string name  = "GAME AUTOSAVER";
                         bool         found = false;
                         for (int i = 0; i <= DataGridView1.Rows.Count - 1; i++)
                         {
                             if (Convert.ToString(DataGridView1[0, i].Value) == name)
                             {
                                 LoadGame(i, true);
                                 found = true;
                             }
                         }
                         if (!found)
                         {
                             MainForm.Games.GameList.Add(name, new GameSettings());
                             MainForm.Games.GameList[name].Name = name;
                             int idx = DataGridView1.Rows.Add(name, "Load", "Remove");
                             //ResortDataGridView();
                             LoadGame(idx, true);
                         }
                     }
                 }
                 else
                 {
                     Interaction.MsgBox("Could not find data to delete!", MsgBoxStyle.Critical, "Error");
                 }
             }
         }
     }
 }
Beispiel #26
0
        /// <summary>
        /// Method is executed when TestMsgBoxParameters command is invoked.
        /// </summary>
        private async void TestMsgBoxParametersAsync_Executed()
        {
            MsgBoxImage image;

            image = this.MessageImageSelected.EnumKey;

            // Set the current culture and UI culture to the currently selected languages
            Thread.CurrentThread.CurrentCulture   = new CultureInfo(this.ButtonLanguageSelected.BCP47);
            Thread.CurrentThread.CurrentUICulture = new CultureInfo(this.ButtonLanguageSelected.BCP47);

            var msg = GetService <IContentDialogService>().MsgBox;

            MsgBoxResult result = await msg.ShowAsync(this.MessageText, this.CaptionText,
                                                      this.mMessageButtonSelected.EnumKey,
                                                      image,
                                                      this.DefaultMessageButtonSelected.EnumKey,
                                                      null,
                                                      "", "", null,
                                                      this.ShowCopyButton);

            this.Result = result.ToString();
        }
            public MsgBoxButtonHolder(MsgBoxResult CoreButton)
            {
                switch (CoreButton)
                {
                case MsgBoxResult.Ok:
                    Label    = _e("Global_buttons_ok");
                    ResultId = (int)MsgBoxResult.Ok;
                    Action   = ButtonAction.Ok;
                    break;

                case MsgBoxResult.Cancel:
                    Label    = _e("Global_buttons_cancel");
                    ResultId = (int)MsgBoxResult.Cancel;
                    Action   = ButtonAction.Cancel;
                    break;

                case MsgBoxResult.Yes:
                    Label    = _e("Global_buttons_yes");
                    ResultId = (int)MsgBoxResult.Yes;
                    Action   = ButtonAction.Ok;
                    break;

                case MsgBoxResult.YesAll:
                    Label    = _e("Global_buttons_yesForAll");
                    ResultId = (int)MsgBoxResult.YesAll;
                    break;

                case MsgBoxResult.No:
                    Label    = _e("Global_buttons_no");
                    ResultId = (int)MsgBoxResult.No;
                    Action   = ButtonAction.Cancel;
                    break;

                case MsgBoxResult.NoAll:
                    Label    = _e("Global_buttons_noForAll");
                    ResultId = (int)MsgBoxResult.NoAll;
                    break;
                }
            }
Beispiel #28
0
        /// <summary>
        /// Creates an External MsgBox dialog outside of the main window.
        /// </summary>
        /// <param name="metroWindow"></param>
        /// <param name="dlgControl"></param>
        /// <param name="settings"></param>
        /// <returns></returns>
        public MsgBoxResult ShowModalDialogExternal(
            IMetroWindow metroWindow
            , IMsgBoxDialogFrame <MsgBoxResult> dlgControl
            , IMetroDialogFrameSettings settings = null)
        {
            settings = settings ?? new MetroDialogFrameSettings();

            // Create the outter dialog window that hosts the dialog control
            var dlgWindow = _metroWindowService.CreateExternalWindow();

            // The window is visible on top of the mainWindow
            dlgWindow = CreateModalExternalWindow(metroWindow, dlgWindow);

            if (settings.MsgBoxMode == StaticMsgBoxModes.ExternalMoveable)
            {
                // Relay drag event from thumb to outer window to let user drag the dialog
                if (dlgControl.DialogThumb != null && dlgWindow is IMetroWindow)
                {
                    ((IMetroWindow)dlgWindow).SetWindowEvents(dlgControl.DialogThumb);
                }
            }

            dlgWindow.Content = dlgControl;

            MsgBoxResult result = MsgBoxResult.None;

            dlgControl.WaitForButtonPressAsync().ContinueWith(task =>
            {
                result = task.Result;
                dlgWindow.Invoke(dlgWindow.Close);
            });

            HandleOverlayOnShow(metroWindow, settings);
            dlgWindow.ShowDialog();
            HandleOverlayOnHide(metroWindow, settings);

            return(result);
        }
Beispiel #29
0
 public void Close(int result)
 {
     Result = (MsgBoxResult)result;
     Destroy(gameObject);
 }
 private MessageBoxResult ConvertResult(MsgBoxResult result)
 {
     switch(result)
     {
         case MsgBoxResult.Cancel:
             return MessageBoxResult.Cancel;
         case MsgBoxResult.Close:
             return MessageBoxResult.Cancel;
         case MsgBoxResult.OK:
             return MessageBoxResult.OK;
         case MsgBoxResult.Yes:
             return MessageBoxResult.Yes;
         case MsgBoxResult.No:
             return MessageBoxResult.No;
         default:
             return MessageBoxResult.None;
     }
 }
Beispiel #31
0
        public void TcWmfout()
        {
            int    num;
            int    num9;
            object obj2;

            try
            {
IL_01:
                ProjectData.ClearProjectError();
                num = -2;
IL_09:
                int num2 = 2;
                Document mdiActiveDocument = Application.DocumentManager.MdiActiveDocument;
IL_16:
                num2 = 3;
                Editor editor = Application.DocumentManager.MdiActiveDocument.Editor;
IL_28:
                num2 = 4;
                Database database = mdiActiveDocument.Database;
IL_32:
                num2 = 5;
                BlockTableRecord blockTableRecord = new BlockTableRecord();
IL_3B:
                num2 = 6;
                blockTableRecord.Name = "*U";
IL_49:
                num2 = 7;
                BlockReference blockReference = null;
IL_4E:
                num2 = 8;
                editor.WriteMessage("你可以使用wmfopts命令,预先设置wmf输出选项\r\n");
IL_5B:
                num2 = 9;
                using (Transaction transaction = database.TransactionManager.StartTransaction())
                {
                    BlockTable            blockTable = (BlockTable)transaction.GetObject(database.BlockTableId, 1);
                    PromptSelectionResult selection  = mdiActiveDocument.Editor.GetSelection();
                    if (selection.Status == 5100)
                    {
                        SelectionSet value    = selection.Value;
                        Entity       entity   = (Entity)transaction.GetObject(value[0].ObjectId, 0);
                        Point3d      minPoint = entity.GeometricExtents.MinPoint;
                        blockTableRecord.Origin = minPoint;
                        IEnumerator enumerator = value.GetEnumerator();
                        while (enumerator.MoveNext())
                        {
                            object         obj            = enumerator.Current;
                            SelectedObject selectedObject = (SelectedObject)obj;
                            Entity         entity2        = (Entity)transaction.GetObject(selectedObject.ObjectId, 1);
                            Entity         entity3        = (Entity)entity2.Clone();
                            blockTableRecord.AppendEntity(entity3);
                        }
                        if (enumerator is IDisposable)
                        {
                            (enumerator as IDisposable).Dispose();
                        }
                        blockTable.Add(blockTableRecord);
                        transaction.AddNewlyCreatedDBObject(blockTableRecord, true);
                        BlockTableRecord blockTableRecord2 = (BlockTableRecord)transaction.GetObject(blockTable[BlockTableRecord.ModelSpace], 1);
                        blockReference = new BlockReference(minPoint, blockTableRecord.ObjectId);
                        blockTableRecord2.AppendEntity(blockReference);
                        transaction.AddNewlyCreatedDBObject(blockReference, true);
                        Point3d minPoint2      = blockReference.GeometricExtents.MinPoint;
                        Point3d maxPoint       = blockReference.GeometricExtents.MaxPoint;
                        object  systemVariable = Application.GetSystemVariable("TARGET");
                        Point3d point3d2;
                        Point3d point3d = (systemVariable != null) ? ((Point3d)systemVariable) : point3d2;
                        maxPoint..ctor(maxPoint.X - point3d.X, maxPoint.Y - point3d.Y, maxPoint.Z - point3d.Z);
                        minPoint2..ctor(minPoint2.X - point3d.X, minPoint2.Y - point3d.Y, minPoint2.Z - point3d.Z);
                        checked
                        {
                            long num3 = (long)Math.Round(unchecked (maxPoint.get_Coordinate(1) - minPoint2.get_Coordinate(1)));
                            long num4 = (long)Math.Round(unchecked (maxPoint.get_Coordinate(0) - minPoint2.get_Coordinate(0)));
                        }
                        double num5 = Math.Abs(minPoint2.get_Coordinate(0) - maxPoint.get_Coordinate(0));
                        double num6 = Math.Abs(minPoint2.get_Coordinate(1) - maxPoint.get_Coordinate(1));
                        double num7 = num5 / num6;
                        num5 = 1000.0;
                        num6 = num5 / num7;
                        mdiActiveDocument.Window.WindowState = 0;
                        Size deviceIndependentSize = new Size(num5, num6);
                        mdiActiveDocument.Window.DeviceIndependentSize = deviceIndependentSize;
                        exportWmf.SetView(minPoint2, maxPoint, 1.05);
                    }
                    transaction.Commit();
                }
IL_314:
                num2 = 11;
                mdiActiveDocument.Editor.WriteMessage("WMF 自动输出到 \"c:\\\\temp.wmf\"\r\n");
IL_327:
                num2 = 12;
                mdiActiveDocument.SendStringToExecute("(command \"wmfout\" \"c:\\\\temp.wmf\" (handent \"" + blockReference.Handle.ToString() + "\"))\r\n", false, false, false);
IL_358:
                num2 = 13;
                Thread.Sleep(2000);
IL_365:
                num2 = 14;
                if (Information.Err().Number == 0)
                {
                    goto IL_391;
                }
IL_37A:
                num2 = 15;
                Interaction.MsgBox(Information.Err().Description, MsgBoxStyle.OkOnly, null);
                goto IL_3BD;
IL_391:
                num2 = 17;
IL_394:
                num2 = 18;
                MsgBoxResult msgBoxResult = Interaction.MsgBox("WMF  文件成功导出到  c:\\temp.wmf\r\n\r\n你是否需要打开此文件?", MsgBoxStyle.YesNo, null);
IL_3A5:
                num2 = 19;
                if (msgBoxResult != MsgBoxResult.Yes)
                {
                    goto IL_3BD;
                }
IL_3AF:
                num2 = 20;
                Process.Start("c:\\temp.wmf");
IL_3BD:
                goto IL_474;
IL_3C2:
                int num8 = num9 + 1;
                num9     = 0;
                @switch(ICSharpCode.Decompiler.ILAst.ILLabel[], num8);
IL_42E:
                goto IL_469;
IL_430:
                num9 = num2;
                if (num <= -2)
                {
                    goto IL_3C2;
                }
                @switch(ICSharpCode.Decompiler.ILAst.ILLabel[], num);
                IL_446 :;
            }
            catch when(endfilter(obj2 is Exception & num != 0 & num9 == 0))
            {
                Exception ex = (Exception)obj3;

                goto IL_430;
            }
IL_469:
            throw ProjectData.CreateProjectError(-2146828237);
IL_474:
            if (num9 != 0)
            {
                ProjectData.ClearProjectError();
            }
        }