Exemple #1
0
 private bool Save()
 {
     if (IsDirty)
     {
         string msg;
         if (PlugInDefFilePath.IsNullOrWhiteSpace())
         {
             msg = "Do you want to save changes to untitled?";
         }
         else
         {
             msg = "Do you want to save changes to '{0}'?".FormatString(Path.GetFileName(PlugInDefFilePath));
         }
         DialogResult r = MessageBox.Show(msg, Caption, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
         if (r == DialogResult.Cancel)
         {
             return(true);
         }
         else if (r == DialogResult.No)
         {
             IsDirty = false;
             return(false);
         }
         else
         {
             return(!Save(PlugInDefFilePath));
         }
     }
     return(false);
 }
Exemple #2
0
        private void Application_Idle(object sender, EventArgs e)
        {
            //if (Count  == 0)
            //    _copiedBuilder = null;

            if (!_isPlugInRunning)
            {
                int index = lstPlugIns.SelectedIndex;

                tsbCopyPlugInDef.Enabled     = Count > 0;
                tsbPastePlugInDef.Enabled    = _copiedBuilder != null;
                tsbNewPlugInDefFile.Enabled  = true;
                tsbOpenPlugInDefFile.Enabled = true;
                tsbDeletePlugInDef.Enabled   = index >= 0;
                tsbMoveDownPlugInDef.Enabled = Count > 1 && index != 0;
                tsbMoveUpPlugInDef.Enabled   = Count > 1 && index != Count - 1;
                tsbClearOutput.Enabled       = !txtOutput.Text.IsNullOrEmpty();

                tsbRunPlugInDef.Enabled       = index >= 0;
                tsbRunAllPlugInDef.Enabled    = Count >= 1;
                tsbCancelRunPlugInDef.Enabled = false;

                if (PlugInDefFilePath.IsNullOrWhiteSpace())
                {
                    //IsDirty = Count > 0;
                    tsbSavePlugInDefFile.Enabled = IsDirty;
                    //tsbSaveAsPlugInDefFile.Enabled = IsDirty;
                }

                tsbCmbPlugInsGroup.Enabled   = _plugInEditorSettings.PlugInsGroupSelectionEnabled;
                tsbAddNewPlugInGroup.Enabled = _plugInEditorSettings.AddNewPlugInsGroupEnabled;
                tsbDeletePlugInGroup.Enabled = _plugInEditorSettings.DeletePlugInsGroupEnabled;
                tsbRenamePlugInGroup.Enabled = _plugInEditorSettings.RenamePlugInsGroupEnabled;
            }
            else
            {
                txtOutput.Text = null;

                tsbPastePlugInDef.Enabled    = false;
                tsbCopyPlugInDef.Enabled     = false;
                tsbNewPlugInDefFile.Enabled  = false;
                tsbOpenPlugInDefFile.Enabled = false;
                tsbDeletePlugInDef.Enabled   = false;
                tsbMoveDownPlugInDef.Enabled = false;
                tsbMoveUpPlugInDef.Enabled   = false;
                tsbClearOutput.Enabled       = false;

                tsbRunPlugInDef.Enabled       = false;
                tsbRunAllPlugInDef.Enabled    = false;
                tsbCancelRunPlugInDef.Enabled = true;

                tsbSavePlugInDefFile.Enabled = false;
                tsbCmbPlugInsGroup.Enabled   = false;
                tsbAddNewPlugInGroup.Enabled = false;
                tsbDeletePlugInGroup.Enabled = false;
                tsbRenamePlugInGroup.Enabled = false;
            }
        }