コード例 #1
0
 public static void ShowResources(List <ProjectFileReference> resources)
 {
     using (ResourcesForm f = new ResourcesForm())
     {
         f._resources = resources;
         f.ShowDialog();
     }
 }
コード例 #2
0
ファイル: formMain.cs プロジェクト: sketchit/sketchit
        private void MenuItemClicked(object sender, EventArgs e)
        {
            try
            {
                switch (((ToolStripItem)sender).Tag.ToString())
                {
                case "resources":
                    ResourcesForm.ShowResources(_resourceFiles);
                    break;

                case "restart-preview":
                    RestartPreview();
                    break;

                case "pause-preview":
                    PausePreview();
                    break;

                case "save-all":
                    SaveProject();
                    break;

                case "add-new-source-file":
                    AddNewSourceFile();
                    break;

                case "add-existing-file":
                    AddExistingFile();
                    break;

                case "open-project":
                    OpenProject();
                    break;

                case "start":
                    StartApp();
                    break;

                case "stop":
                    Stop();
                    break;

                case "new-project":
                    NewProject(true);
                    break;

                case "toggle-error-list":
                    splErrorList.Visible = pnlErrorList.Visible = ((ToolStripButton)sender).Checked;
                    break;

                case "remove-from-project":
                    if (GetActiveWindow() is BaseForm form)
                    {
                        form.Close();

                        if (!form.Equals(GetActiveWindow()))
                        {
                            foreach (TabButton button in tabWindows.TabButtons)
                            {
                                if (form.Equals(button.Tag))
                                {
                                    tabWindows.TabButtons.Remove(button);
                                    break;
                                }
                            }
                        }
                    }
                    break;

                case "exit":
                    this.Close();
                    break;

                case "about":
                    new SplashScreenForm().ShowDialog();
                    break;

                case "website":
                    Process.Start("http://www.sketchit.org");
                    break;

                case "help":
                    Process.Start("sketchit.chm");
                    break;

                case "create-screen-saver":
                    CreateScreenSaver();
                    break;

                default:
                    if (GetActiveWindow() != null)
                    {
                        GetActiveWindow().HandleCommand(((ToolStripItem)sender).Tag.ToString());
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "SketchIt", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                UpdateToolbarButtons();
            }
        }