コード例 #1
0
        private void mnuDelete_Click(object sender, EventArgs e)
        {
            object obj = tvTemplates.SelectedNode.Tag;

            switch (tvTemplates.SelectedNode.Level)
            {
            case 1:
                if (MessageBoxMessage.Confirm("确定要删除此模板吗?") == false)
                {
                    return;
                }
                DirectoryInfo dir = obj as DirectoryInfo;
                Directory.Delete(dir.FullName, true);
                LoadTempates();
                if (TemplateChanged != null)
                {
                    TemplateChanged();
                }
                break;

            case 2:
                if (MessageBoxMessage.Confirm("确定要删除此文件吗?") == false)
                {
                    return;
                }
                TreeNode parent = tvTemplates.SelectedNode.Parent;
                FileInfo fi     = obj as FileInfo;
                File.Delete(fi.FullName);
                LoadFiles(parent);
                break;

            default:
                break;
            }
        }
コード例 #2
0
ファイル: MainViewModel.cs プロジェクト: AlienJust/RPD
        private void RemoveDataCommandExecute()
        {
            // значит что команда вызывается в первый раз, т.е. когда кнопка нажата, а нужно когда уже отжата.
            if (IsRemoveDataMode)
            {
                return;
            }

            var dataToRemove = new LogsParameters();

            FillLogsParametersAndUncheckThem(dataToRemove);
            if (dataToRemove.PsnLogs.Count == 0 && dataToRemove.RpdLogs.Count == 0)
            {
                return;
            }

            var msg = new MessageBoxMessage("Удалить выбранные логи?", "РПД", MessageBoxButton.YesNo,
                                            MessageBoxImage.Question,
                                            resultCallback => {
                if (resultCallback == MessageBoxResult.Yes)
                {
                    _messenger.Send(new ViewMessage(ViewAction.Show), Views.Views.ExportProgress);
                    _messenger.Send(new SetViewModelParametersMessage <LogsParameters>(dataToRemove));
                }
            });

            _messenger.Send(msg);
        }
コード例 #3
0
        /// <summary>
        /// Show help table of contents.
        /// </summary>
        public static void ShowHelpTableOfContents()
        {
#if DEBUG
            MessageBoxMessage.Send("ShowHelpTableOfContents", "Klicked", true);
#endif

            var culture = Thread.CurrentThread.CurrentUICulture;
            switch (culture.TwoLetterISOLanguageName)
            {
            case "en":
                if (!File.Exists("en/MiResiliencia Desktop.chm"))
                {
                    goto default;
                }
                System.Windows.Forms.Help.ShowHelp(null, "en/MiResiliencia Desktop.chm", HelpNavigator.TableOfContents);
                break;

            case "de":
                if (!File.Exists("de/MiResiliencia Desktop.chm"))
                {
                    goto default;
                }
                System.Windows.Forms.Help.ShowHelp(null, "de/MiResiliencia Desktop.chm", HelpNavigator.TableOfContents);
                break;

            case "es":
            default:
                System.Windows.Forms.Help.ShowHelp(null, "es/MiResiliencia Desktop.chm", HelpNavigator.TableOfContents);
                break;
            }
        }
コード例 #4
0
        private void AddFile(string ext)
        {
            InputForm frm = new InputForm();

            frm.Title = string.Format("请输入文件名称 (.{0})", ext);
            frm.Value = "test";
            if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (string.IsNullOrEmpty(frm.Value))
                {
                    MessageBoxMessage.Alert("文件名称不能为空。");
                    frm.ShowDialog();
                    return;
                }

                DirectoryInfo rootFolder = tvTemplates.SelectedNode.Tag as DirectoryInfo;
                string        path       = string.Format("{0}\\{1}.{2}", rootFolder.FullName, frm.Value, ext);
                if (File.Exists(path))
                {
                    MessageBoxMessage.Alert("文件已存在。");
                    frm.ShowDialog();
                    return;
                }

                Helper.WriteFile(path, "");
                LoadFiles(tvTemplates.SelectedNode);
            }
        }
コード例 #5
0
        private void mnuAddTemplate_Click(object sender, EventArgs e)
        {
            InputForm frm = new InputForm();

            frm.Title = "请输入模板名称";
            frm.Value = "新模板";
            if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (string.IsNullOrEmpty(frm.Value))
                {
                    MessageBoxMessage.Alert("模板名称不能为空。");
                    frm.ShowDialog();
                    return;
                }

                DirectoryInfo rootFolder = rootNode.Tag as DirectoryInfo;
                string        path       = rootFolder.FullName + "\\" + frm.Value;
                if (Directory.Exists(path))
                {
                    MessageBoxMessage.Alert("模板已存在。");
                    frm.ShowDialog();
                    return;
                }

                Helper.CopyFolder(Application.StartupPath + "\\Config\\NewTemplate", path);
                LoadTempates();
                if (TemplateChanged != null)
                {
                    TemplateChanged();
                }
            }
        }
コード例 #6
0
        private void OnMessageBoxMessage(MessageBoxMessage message)
        {
            Action action = () =>
            {
                message.Result = Xceed.Wpf.Toolkit.MessageBox.Show(this, message.Text, message.Caption ?? this.Title, message.Button, message.Icon);
            };

            this.Dispatcher.Invoke(action);
        }
コード例 #7
0
    public void ShowMessage(MessageBoxMessage msg, bool flushQueue = false)
    {
        if (flushQueue)
        {
            queuedMessages = new Queue <MessageBoxMessage>();
            StopAllCoroutines();
        }

        queuedMessages.Enqueue(msg);

        if (queuedMessages.Count == 1)
        {
            StartCoroutine(ShowMessages());
        }
    }
コード例 #8
0
    IEnumerator ShowMessages()
    {
        messageBox.gameObject.SetActive(true);
        while (queuedMessages.Count > 0)
        {
            MessageBoxMessage msg = queuedMessages.Peek();
            textMessageBox.text = "";
            float timeToAnimate = msg.Duration / 2f;
            float timeToWait    = timeToAnimate / msg.Message.Length;
            allTheText += " " + msg.Message;
            for (int i = 0; i < msg.Message.Length; i++)
            {
                textMessageBox.text += msg.Message[i];
                yield return(new WaitForSeconds(timeToWait));
            }
            yield return(new WaitForSeconds(msg.Duration / 2f));

            queuedMessages.Dequeue();
        }
        messageBox.gameObject.SetActive(false);
    }
コード例 #9
0
        /// <summary>
        /// Handles a basic <see cref="MessageBoxMessage" /> on a flyout container by showing a <see cref="ModernMessageBox" />
        /// and invokes the callback.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="owner">The owner.</param>
        /// <exception cref="System.ArgumentNullException">owner</exception>
        public static void HandleWithModern(this MessageBoxMessage message, FlyoutContainer owner)
        {
            if (owner == null)
            {
                throw new ArgumentNullException("owner");
            }

            var d = owner.FindDispatcher();

            if (d != null && !d.CheckAccess())
            {
                d.BeginInvoke(new Action <Window>(win =>
                {
                    HandleWithModern(message, win);
                }), owner);
                return;
            }

            var res = ModernMessageBox.Show(owner, message.Content, message.Caption, message.Button, message.Icon, message.DefaultResult);

            message.DoCallback(res);
        }
コード例 #10
0
        /// <summary>
        /// Show a help topic in the online CHM style help.
        /// </summary>
        /// <param name="helpTopic">The help topic to show. This must match exactly with the name
        /// of one of the help topic's .htm files, without the .htm extention and with spaces instead of underscores
        /// in the name. For instance, to display the help topic "This_is_my_topic.htm", pass the string "This is my topic".</param>
        /// <remarks>You can also pass in the help topic with the underscore replacement already done. You can also
        /// add the .htm extension.
        /// Certain characters other than spaces are replaced by underscores in RoboHelp help topic names.
        /// This method does not yet account for all those replacements, so if you really need to find a help topic
        /// with one or more of those characters, do the underscore replacement before passing the topic.</remarks>
        public static void ShowHelpTopic(string helpTopic)
        {
            // Strip off trailing period.
            if (helpTopic.IndexOf(".") == helpTopic.Length - 1)
            {
                helpTopic = helpTopic.Substring(0, helpTopic.Length - 1);
            }

            helpTopic = helpTopic.Replace(" ", "_").Replace("\\", "_").Replace("/", "_").Replace(":", "_").Replace("*", "_").Replace("?", "_").Replace("\"", "_").Replace(">", "_").Replace("<", "_").Replace("|", "_") + (helpTopic.IndexOf(".htm") == -1 ? ".htm" : "");

#if DEBUG
            MessageBoxMessage.Send("ShowHelpTopic", "Klicked on " + helpTopic, true);
#endif

            var culture = Thread.CurrentThread.CurrentUICulture;
            switch (culture.TwoLetterISOLanguageName)
            {
            case "en":
                if (!File.Exists("en/MiResiliencia Desktop.chm"))
                {
                    goto default;
                }
                Help.ShowHelp(null, "en/MiResiliencia Desktop.chm", HelpNavigator.Topic, helpTopic);
                break;

            case "de":
                if (!File.Exists("de/MiResiliencia Desktop.chm"))
                {
                    goto default;
                }
                Help.ShowHelp(null, "de/MiResiliencia Desktop.chm", HelpNavigator.Topic, helpTopic);
                break;

            case "es":
            default:
                Help.ShowHelp(null, "es/MiResiliencia Desktop.chm", HelpNavigator.Topic, helpTopic);
                break;
            }
        }
コード例 #11
0
 void IHandle <MessageBoxMessage> .Handle(MessageBoxMessage message)
 {
     MessageBox.Show(this, message.Message, message.Title);
 }
コード例 #12
0
        private void btnOutputCode_Click(object sender, EventArgs e)
        {
            foreach (Table table in selectTableUserControl1.SelectedTables)
            {
                if (table.Fields.Count == 0)
                {
                    MessageBoxMessage.Alert(string.Format("表{0}不存在任何字段,无法生成!", table.Name));
                    return;
                }
            }

            if (false == MessageBoxMessage.Confirm("确定要输出代码吗?"))
            {
                return;
            }

            if (Directory.Exists(CreateFilePath))
            {
                if (MessageBoxMessage.Confirm("该目录已存在,是否删除?"))
                {
                    try
                    {
                        Directory.Delete(CreateFilePath, true);
                    }
                    catch (Exception ex)
                    {
                        MessageBoxMessage.Error(ex.ToString());
                    }
                }
            }

            //selectTemplateUserControl1.SaveSetting();
            db.Selects = selectTableUserControl1.SelectedTables;

            //在Settings中额外地增加一项设定,值为当前选中的所有表
            List <Setting> settings = selectTemplateUserControl1.Settings;

            //目录有可能不存在,如果没有生成任何代码则打开目录会出错,故先创建目录
            if (false == Directory.Exists(CreateFilePath))
            {
                Directory.CreateDirectory(CreateFilePath);
            }

            try
            {
                Template template = new Template();
                template.TemplateFolder    = selectTemplateUserControl1.TemplateFolderPath;
                template.Database          = db;
                template.Settings          = settings;
                template.GenerateFolder    = CreateFilePath;
                template.OnProcessChanged += new ProcessChanged(template_OnProcessChanged);
                template.Generate();
                if (ShowDebug != null)
                {
                    ShowDebug(template.DatabaseJson, template.SettingJson, false);
                }
            }
            catch (Exception ex)
            {
                MessageBoxMessage.Error(ex.Message);
            }

            progressBar1.Value = 0;
            if (MessageBoxMessage.Confirm("成功生成,是否打开目录?"))
            {
                Process.Start(CreateFilePath);
            }
        }
コード例 #13
0
ファイル: HUDManager.cs プロジェクト: tansir23/LD32
    public void ShowMessage(MessageBoxMessage msg, bool flushQueue = false)
    {
        if (flushQueue)
        {
            queuedMessages = new Queue<MessageBoxMessage>();
            StopAllCoroutines();
        }

        queuedMessages.Enqueue(msg);

        if(queuedMessages.Count == 1)
        {
           StartCoroutine(ShowMessages());
        }
    }