Example #1
0
 private void saveClicked(object sender, EventArgs e)
 {
     _projToSave = _currProj;
     if (_currProj == null)
     {
         Saver.SaveScript(_scriptPath, editorBox.Text);
     }
     else if ((_currProj != null) && (_projToSave != null) && (_scriptPath == ""))
     {
         _projToSave.FileContents = editorBox.Text;
         Saver.SaveProject(_projToSave);
     }
 }
Example #2
0
        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (_isNeededClosed || !_isProjectOrScriptLoaded)
            {
                #region =========== API INTEGRATION ============
                StopPlugins();
                #endregion
                Environment.Exit(0);
            }
            else
            {
                var dlg = MessageBox.Show(StaticData.LocaleProv.GetValue("message.save-before-quit"), StaticData.LocaleProv.GetValue("message.save-before-quit.title"), MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information);
                switch (dlg)
                {
                case DialogResult.Yes:
                    //LockAll();
                    _projToSave = _currProj;
                    if (_currProj == null)
                    {
                        Saver.SaveScript(_scriptPath, editorBox.Text);
                    }
                    else if ((_currProj != null) && (_projToSave != null) && (_scriptPath == ""))
                    {
                        _projToSave.FileContents = editorBox.Text;
                        Saver.SaveProject(_projToSave);
                    }
                    _isNeededClosed = true;
                    Environment.Exit(0);
                    break;

                case DialogResult.No:
                    //LockAll();
                    _isNeededClosed = true;
                    Environment.Exit(0);
                    break;

                case DialogResult.Cancel:
                    e.Cancel = true;
                    break;
                }
            }
        }
Example #3
0
        private void Opener_OnOpenedFileEvent(object sender, OnOpenedFileEventArgs e)
        {
            switch (e.Result)
            {
            case Opener.OpenResult.Success:
                _currProj                = e.ProjectFile;
                progress.Visible         = false;
                statusbar.Text           = StaticData.LocaleProv.GetValue("forms.main.status.opened-project");
                _isProjectOrScriptLoaded = true;
                string _fl = _currProj.FileContents;
                Text          += " - " + _currProj.ProjName;
                editorBox.Text = _fl;
                _projToSave    = _currProj;
                break;

            case Opener.OpenResult.Error:
                LockAll();
                break;
            }
        }
Example #4
0
        private void openLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (_isProjectOrScriptLoaded)
            {
                var dlg = MessageBox.Show(StaticData.LocaleProv.GetValue("message.save-before-quit"), StaticData.LocaleProv.GetValue("message.save-before-quit.title"), MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information);
                switch (dlg)
                {
                case DialogResult.Yes:
                    //LockAll();
                    _projToSave = _currProj;
                    if (_currProj == null)
                    {
                        Saver.SaveScript(_scriptPath, editorBox.Text);
                    }
                    else if ((_currProj != null) && (_projToSave != null) && (_scriptPath == ""))
                    {
                        _projToSave.FileContents = editorBox.Text;
                        Saver.SaveProject(_projToSave);
                    }
                    var dlg1 = openDialog.ShowDialog(this);
                    switch (dlg1)
                    {
                    case DialogResult.OK:
                        if (openDialog.FileName.EndsWith("lsproj"))
                        {
                            _isProject = true;
                            Opener.OpenProject(openDialog.FileName);
                            StaticData.CurrentProject = _currProj;
                            editorBox.Text            = _currProj.FileContents;
                            welcomePanel.Visible      = false;
                            editorPanel.Visible       = true;
                            UnlockAll();
                        }
                        else if (openDialog.FileName.EndsWith("litescript"))
                        {
                            _isProject           = false;
                            _scriptPath          = openDialog.FileName;
                            editorBox.Text       = Opener.OpenScript(openDialog.FileName);
                            welcomePanel.Visible = false;
                            editorPanel.Visible  = true;
                            UnlockAll();
                        }
                        break;

                    case DialogResult.Cancel:
                        break;
                    }
                    break;

                case DialogResult.No:
                    //LockAll();
                    var dlg2 = openDialog.ShowDialog(this);
                    switch (dlg2)
                    {
                    case DialogResult.OK:
                        if (openDialog.FileName.EndsWith("lsproj"))
                        {
                            _isProject = true;
                            Opener.OpenProject(openDialog.FileName);
                            StaticData.CurrentProject = _currProj;
                            editorBox.Text            = _currProj.FileContents;
                            welcomePanel.Visible      = false;
                            editorPanel.Visible       = true;
                            UnlockAll();
                        }
                        else if (openDialog.FileName.EndsWith("litescript"))
                        {
                            _isProject           = false;
                            _scriptPath          = openDialog.FileName;
                            editorBox.Text       = Opener.OpenScript(openDialog.FileName);
                            welcomePanel.Visible = false;
                            editorPanel.Visible  = true;
                            UnlockAll();
                        }
                        break;

                    case DialogResult.Cancel:
                        break;
                    }
                    break;

                case DialogResult.Cancel:
                    return;
                }
            }
            else
            {
                var dlg = openDialog.ShowDialog(this);
                switch (dlg)
                {
                case DialogResult.OK:
                    if (openDialog.FileName.EndsWith("lsproj"))
                    {
                        _isProject = true;
                        Opener.OpenProject(openDialog.FileName);
                        StaticData.CurrentProject = _currProj;
                        editorBox.Text            = _currProj.FileContents;
                        welcomePanel.Visible      = false;
                        editorPanel.Visible       = true;
                        UnlockAll();
                    }
                    else if (openDialog.FileName.EndsWith("litescript"))
                    {
                        _isProject                = false;
                        _scriptPath               = openDialog.FileName;
                        editorBox.Text            = Opener.OpenScript(openDialog.FileName);
                        StaticData.CurrentProject = _currProj;
                        welcomePanel.Visible      = false;
                        editorPanel.Visible       = true;
                        UnlockAll();
                    }
                    break;

                case DialogResult.Cancel:
                    break;
                }
            }
        }