コード例 #1
0
ファイル: MainView.cs プロジェクト: robjer/tesvsnip
        private void editStringsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (stringEditor == null)
            {
                List<Plugin> plugins = new List<Plugin>();
                foreach (TreeNode node in PluginTree.Nodes)
                {
                    Plugin plugin = node.Tag as Plugin;
                    if (plugin == null)
                        continue;
                    plugins.Add(plugin);
                }

                if (plugins.Count == 0)
                {
                    MessageBox.Show(this, "No plugins available to edit", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                stringEditor = new Forms.StringsEditor();
                stringEditor.FormClosed += delegate(object a, FormClosedEventArgs args)
                {
                    CloseStringEditor();
                };
                stringEditor.Plugins = plugins.ToArray();
                stringEditor.Show(this); // modeless. Close if the tree is modified.
            }
        }
コード例 #2
0
ファイル: MainView.cs プロジェクト: robjer/tesvsnip
        private void CloseStringEditor()
        {
            if (this.stringEditor != null)
            {
                Forms.StringsEditor editor = this.stringEditor;
                this.stringEditor = null;
                try
                {
                    if (!editor.IsDisposed)
                        editor.Close();
                }
                catch { }

            }
        }