Exemple #1
0
        private void Creator_OnCreationCompletedEvent(object sender, OnCreationCompletedEventArgs e)
        {
            switch (e.Result)
            {
            case Creator.CreationResult.Success:
                statusbar.Text = StaticData.LocaleProv.GetValue("forms.main.status.created-project");
                if (_isProject)
                {
                    string _filenameCtor = ProjectCreationData.ProjectName + ".lsproj";
                    string _projFldrCtor = Path.Combine(ProjectCreationData.ProjectDir, ProjectCreationData.ProjectName);
                    string _projFCtor    = Path.Combine(_projFldrCtor, _filenameCtor);
                    Opener.OpenProject(_projFCtor);
                }
                else
                {
                    string _filenameCtor = ScriptCreationData.Name + ".litescript";
                    string _projFCtor    = Path.Combine(ScriptCreationData.Directory, _filenameCtor);
                    editorBox.Text = Opener.OpenScript(_projFCtor);
                }
                break;

            case Creator.CreationResult.Error:
                LockAll();
                break;
            }
        }
Exemple #2
0
 public MainForm()
 {
     InitializeComponent();
     LoadPlugins();
     Creator.OnCreationCompletedEvent       += Creator_OnCreationCompletedEvent;
     Creator.OnCreationProgressChangedEvent += Creator_OnCreationProgressChangedEvent;
     Opener.OnOpeningFileEvent     += Opener_OnOpeningFileEvent;
     Opener.OnOpenedFileEvent      += Opener_OnOpenedFileEvent;
     Saver.OnSavedFileEvent        += Saver_OnSavedFileEvent;
     Saver.OnSavingFileEvent       += Saver_OnSavingFileEvent;
     Builder.OnBuildCompletedEvent += Builder_OnBuildCompletedEvent;
     Builder.OnBuildRunningEvent   += Builder_OnBuildRunningEvent;
     LoadSyntaxHl();
     LoadLocales();
     RunPlugins();
     LoadIconset();
     if (StaticData.RunFilepath != "")
     {
         if (StaticData.RunFilepath.EndsWith("lsproj"))
         {
             _isProject = true;
             Opener.OpenProject(StaticData.RunFilepath);
             StaticData.CurrentProject = _currProj;
             editorBox.Text            = _currProj.FileContents;
             welcomePanel.Visible      = false;
             editorPanel.Visible       = true;
             UnlockAll();
         }
         else if (StaticData.RunFilepath.EndsWith("litescript"))
         {
             _isProject           = false;
             _scriptPath          = StaticData.RunFilepath;
             editorBox.Text       = Opener.OpenScript(StaticData.RunFilepath);
             welcomePanel.Visible = false;
             editorPanel.Visible  = true;
             UnlockAll();
         }
         else
         {
             MessageBox.Show(StaticData.LocaleProv.GetValue("messages.errors.unknown-filetype"), StaticData.LocaleProv.GetValue("messages.titles.error"), MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
Exemple #3
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;
                }
            }
        }