Ejemplo n.º 1
0
        public async Task OpenAsync(string correlationId)
        {
            var components = _references.GetAll();

            Referencer.SetReferences(this, components);
            await Opener.OpenAsync(correlationId, components);
        }
Ejemplo n.º 2
0
        private void SetUpOpeners()
        {
            foreach (var editor in FileOpeners)
            {
                AddMenuItem("Open file in " + editor.Name, (s, e) => OpenFile(editor));
            }
            ResultsContextMenu.Items.Add(new ToolStripSeparator());

            foreach (var opener in LocationOpeners)
            {
                AddMenuItem(opener.Name + " Here", (s, e) => OpenLocation(opener));
            }
            ResultsContextMenu.Items.Add(new ToolStripSeparator());

            foreach (var opener in MultiOpeners)
            {
                opener.MenuItem = AddMenuItem("Open with " + opener.Name, (s, e) => MultiOpenLocation(opener));
            }

            ResultsContextMenu.Items.Add(new ToolStripSeparator());

            AddMenuItem("Copy folder to clipboard", (s, e) => Clipboard.SetText(activeRow.Folder()));
            AddMenuItem("Copy filename to clipboard", (s, e) => Clipboard.SetText(activeRow.FileName()));
            AddMenuItem("Copy full path to clipboard", (s, e) => Clipboard.SetText(activeRow.FullPath()));
            ResultsContextMenu.Items.Add(new ToolStripSeparator());

            AddMenuItem("Clear results", (s, e) => Clear());

            defaultOpener = FileOpeners.Union(LocationOpeners).First(x => x.DoubleClickAction);
            ResultsContextMenu.Opening += ResultsContextMenu_Opening;
        }
Ejemplo n.º 3
0
 private void monitoringDoubleClick(ModbusTcp.MachineInformation information)
 {
     if (Opener != null)
     {
         Opener.OpenNewForm(new frm_worker_home(information));
     }
 }
Ejemplo n.º 4
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;
            }
        }
        public override void Put(object locator, object component)
        {
            base.Put(locator, component);

            if (OpenEnabled)
            {
                Opener.OpenOneAsync(null, component).Wait();
            }
        }
Ejemplo n.º 6
0
 public void CheckOpener()
 {
     _opener = new Opener
     {
         Key = _key,
         Pwd = "12345"
     };
     Assert.AreEqual(_opener.Pwd, "12345");
 }
Ejemplo n.º 7
0
 public void TestFileToString()
 {
     Assert.AreEqual(
         Opener.FileToString(
             "/Users/Muse/Desktop/su19-mikaelMuseFrederik/SU19-exercises/TestSpaceTaxi/" +
             "Levels/abc.txt"),
         "abcdefghijklmnopqrstuvwyz"
         );
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Opens the component.
        /// </summary>
        /// <param name="correlationId">(optional) transaction id to trace execution through call chain.</param>
        public async Task OpenAsync(string correlationId)
        {
            if (!_opened)
            {
                var components = base.GetAll();
                await Opener.OpenAsync(correlationId, components);

                _opened = true;
            }
        }
Ejemplo n.º 9
0
    private void OnTriggerEnter(Collider other)
    {
        if (((1 << other.gameObject.layer) & autoOpen) == 0)
        {
            return;
        }

        Opener opener = other.transform.GetComponent <Opener>();

        opener?.SetOpenState(true);
    }
Ejemplo n.º 10
0
        private void OpenFile(Opener opener)
        {
            foreach (var row in dgResults.SelectedRows.OfType <DataGridViewRow>())
            {
                var commandLine = opener.CommandLinePattern
                                  .Replace("[folder]", row.Folder())
                                  .Replace("[filename]", row.FileName())
                                  .Replace("[fullpath]", row.FullPath());

                Process.Start(opener.Path, commandLine);
            }
        }
Ejemplo n.º 11
0
        public void TestCutStringLevel()
        {
            string[] x = new[]
            { "1", "2", "3", "4", "5", "6", "7", "8", "9", "1", "2", "3", "4",
              "5", "6", "7", "8", "9", "1", "2", "3", "4", "5", null };

            Assert.AreEqual(
                Opener.CutStringLevel(
                    "/Users/Muse/Desktop/su19-mikaelMuseFrederik/SU19-exercises/" +
                    "TestSpaceTaxi/Levels/123.txt"),
                x);
        }
Ejemplo n.º 12
0
        private void openFilePngButton_Click(object sender, EventArgs e)
        {
            OpenFileDialog open = new OpenFileDialog();

            open.Filter = "Image Files(*.png;)| *.png; ";
            if (open.ShowDialog() == DialogResult.OK)
            {
                Opener.OpenFileAsPng(open.FileName, CurrentViewPort);
                tabMenu.SelectedTab.Text = Path.GetFileNameWithoutExtension(open.FileName);
            }
            statusBar.Items[0].Text = "Last action: Uploading project file as draw";
            CurrentViewPort.Refresh();
        }
Ejemplo n.º 13
0
        public static Tuple <float, float> PickupPosition(string filename)
        {
            Tuple <int, int> x = Pick(filename);

            string[]             map      = Opener.CutStringLevel(filename);
            char                 d        = map[x.Item2][x.Item1];
            int                  xaxispos = (x.Item1 + map[x.Item2].IndexOf(d)) / 2;
            float                xpos     = ((float)1 / map[0].Length) * xaxispos;
            float                ypos     = 1f - x.Item2 * ((float)1 / (map.Length - 1));
            Tuple <float, float> z        = new Tuple <float, float>(xpos, ypos);

            return(z);
        }
Ejemplo n.º 14
0
        public static async Task <bool> MainTask(string[] args)
        {
            //var opt = new Windows.System.LauncherOptions()
            //{
            //    TargetApplicationPackageFamilyName = "Microsoft.MicrosoftEdge_8wekyb3d8bbwe"
            //};
            //var items = await Windows.System.Launcher.FindUriSchemeHandlersAsync("microsoft-edge");
            //foreach (var item in items)
            //{
            //    Debug.WriteLine(item.DisplayInfo.DisplayName);
            //}
            //var regApps = Microsoft.Win32.Registry.LocalMachine.
            //    OpenSubKey("SOFTWARE", false).
            //    OpenSubKey("RegisteredApplications", false);
            //foreach (var regApp in regApps.GetValueNames())
            //{
            //    var value = regApps.GetValue(regApp).ToString();
            //    var capabilities = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(value, false) ??
            //        Microsoft.Win32.RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, Microsoft.Win32.RegistryView.Registry64).OpenSubKey(value, false);

            //    var urls = capabilities?.OpenSubKey("URLAssociations", false);
            //    foreach (var url in urls?.GetValueNames() ?? new string[] { })
            //    {
            //        if (url.ToLower() == "microsoft-edge")
            //            Debug.WriteLine(regApp);
            //    }
            //}

            switch (args.Length)
            {
            case 0:
                return(true);

            case 1:
                if (args[0].ToLower() == "microsoft-edge:")
                {
                    return(true);
                }
                else
                {
                    Config.LastUrl = args[0];
                    Config.Save();
                    await Opener.Open(args[0]);

                    return(false);
                }

            default:
                throw new TooManyArgException();
            }
        }
Ejemplo n.º 15
0
        private void OpenLocation(Opener opener)
        {
            var folders = dgResults.SelectedRows.OfType <DataGridViewRow>().Distinct(new RowCompare());

            foreach (var row in folders)
            {
                var commandLine = opener.CommandLinePattern
                                  .Replace("[folder]", row.Folder())
                                  .Replace("[filename]", row.FileName())
                                  .Replace("[fullpath]", row.FullPath());

                Process.Start(opener.Path, commandLine);
            }
        }
Ejemplo n.º 16
0
        /// <summary> Takes a string[] generated from opener and extracts the line that contains
        /// the customer info </summary>
        /// <returns> The customer information as a single string, error message if
        /// no such string is found</returns>
        private static string GetCustomerInfo(string filename)
        {
            string[] file       = Opener.FileToStringList(filename);
            string   identifier = "Customer:";
            string   error      = "Customer not found.";

            foreach (string elm in file)
            {
                if (elm.Contains(identifier))
                {
                    return(elm);
                }
            }

            return(error);
        }
Ejemplo n.º 17
0
        public void TestStringToImageList()
        {
            List <Tuple <string, string> > x = new List <Tuple <string, string> >();

            x.Add(new Tuple <string, string>("%)", " white-square.png"));
            x.Add(new Tuple <string, string>("#)", " ironstone-square.png"));
            x.Add(new Tuple <string, string>("1)", " neptune-square.png"));
            x.Add(new Tuple <string, string>("2)", " green-square.png"));
            x.Add(new Tuple <string, string>("3)", " yellow-stick.png"));
            x.Add(new Tuple <string, string>("o)", " purple-circle.png"));


            Assert.AreEqual(
                ImageList.StringToImageList(Opener.FileToString(
                                                "/Users/Muse/Desktop/su19-mikaelMuseFrederik/SU19-exercises/TestSpaceTaxi/" +
                                                "Levels/imagetest.txt")
                                            ), x);
        }
Ejemplo n.º 18
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);
         }
     }
 }
        private async Task RunAsync(string correlationId, CancellationToken token)
        {
            _correlationId = correlationId;

            CaptureErrors();

            //await StartAsync(correlationId, token);

            if (_config == null)
            {
                throw new InvalidStateException(correlationId, "NO_CONFIG", "Container was not configured");
            }

            try
            {
                _logger.Trace(correlationId, "Starting container.");

                // Create references with configured components
                InitReferences(_references);
                _references.PutFromConfig(_config);

                // Reference and open components
                var components = _references.GetAll();
                Referencer.SetReferences(_references, components);
                await Opener.OpenAsync(correlationId, _references.GetAll());

                // Get reference to logger
                _logger = new CompositeLogger(_references);

                // Get reference to container info
                var infoDescriptor = new Descriptor("*", "container-info", "*", "*", "*");
                _info = (ContextInfo)_references.GetOneRequired(infoDescriptor);

                _logger.Info(correlationId, "Container {0} started.", _info.Name);
            }
            catch (Exception ex)
            {
                _references = null;
                _logger.Error(correlationId, ex, "Failed to start container");

                throw;
            }
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Gets the platform names from the level file
        /// </summary>
        /// <param name="filename">
        /// File path
        /// </param>
        /// <returns>
        /// String array with all the platforms in a given map
        /// </returns>
        public static string[] Platforms(string filename)
        {
            string platform = "";

            string[] file       = Opener.FileToStringList(filename);
            string   identifier = "Platforms:";

            foreach (string elm in file)
            {
                if (elm.Contains(identifier))
                {
                    platform = elm;
                }
            }

            platform = Regex.Replace(platform, ",", "");
            platform = Regex.Replace(platform, "Platforms:", "");

            return(platform.Split());
        }
Ejemplo n.º 21
0
        private static Tuple <int, int> Pick(string filename)
        {
            Tuple <int, int> x = new Tuple <int, int>(0, 0);

            string[] file = Opener.CutStringLevel(filename);
            for (int i = 0; i < file.Length - 1; i++)
            {
                for (int j = 0; j < file[i].Length; j++)
                {
                    {
                        if (file[i][j] ==
                            CustomerInfo.SplitCustomerInfo(filename)[3].ToCharArray()[0])
                        {
                            x = new Tuple <int, int>(j, i);
                        }
                    }
                }
            }

            return(x);
        }
Ejemplo n.º 22
0
        private void gridView1_RowClick(object sender, RowClickEventArgs e)
        {
            long currentClickTime = DateTime.Now.Ticks / 10000;

            if (currentClickTime - latestRowClickTime < 300 && e.RowHandle == lastestRowHandle)
            {
                string machineCode = gridView1.GetDataRow(e.RowHandle)["MACHINE_CODE"].ToString();
                MachineInformation[] informations = MachineInformations.AsEnumerable().Where(x => x.MachineCode == machineCode).ToArray();

                MachineInformation information = informations[0];
                frm_worker_home    home        = new frm_worker_home(information);

                if (Opener != null)
                {
                    Opener.OpenNewForm(home);
                }
            }

            latestRowClickTime = currentClickTime;
            lastestRowHandle   = e.RowHandle;
        }
Ejemplo n.º 23
0
        /// <summary>
        /// finds the related image file and positions of all the platforms in the given levelfile
        /// </summary>
        /// <param name="textfile">
        /// level file
        /// </param>
        /// <returns>
        /// the related image file and positions of all the platforms in the level
        /// </returns>

        public static List <Tuple <Tuple <float, float>, string> > GetPlatform(string textfile)
        {
            string[] platformNames = CollisionPlatforms.Platforms(textfile);

            string[] text =
                Opener.CutStringLevel(textfile);

            Tuple <float, float>           mapSize  = Placement.CalculateMapSize(text);
            List <Tuple <string, string> > textures =
                ImageList.StringToImageList(Opener.FileToString(
                                                textfile));
            List <Tuple <Tuple <float, float>, string> > places =
                new List <Tuple <Tuple <float, float>, string> >();

            for (int y = 0; y < text.Length - 1; y++)
            {
                for (int x = 0; x < text[y].Length; x++)
                {
                    //The condition of the if statement bellow is where
                    //Placement.FindPlacementAndImage and GetPlatform are different
                    if (platformNames.Contains(text[y][x].ToString()))
                    {
                        foreach (Tuple <string, string> item in textures)
                        {
                            if (item.Item1.Contains(text[y][x].ToString()))
                            {
                                Tuple <float, float> z = Placement.Convert(x, y, mapSize);
                                places.Add(new Tuple <Tuple <float, float>,
                                                      string>(Placement.Convert(x, y, mapSize), item.Item2));
                            }
                        }
                    }
                }
            }


            return(places);
        }
        public async Task StartAsync(string correlationId, CancellationToken token)
        {
            if (Config == null)
            {
                throw new InvalidStateException(correlationId, "NO_CONFIG", "Container was not configured");
            }

            try
            {
                Logger.Trace(correlationId, "Starting container.");

                // Create references with configured components
                InitReferences(References);
                References.PutFromConfig(Config);

                // Reference and open components
                var components = References.GetAll();
                Referencer.SetReferences(References, components);
                await Opener.OpenAsync(correlationId, References.GetAll());

                // Get reference to logger
                Logger = new CompositeLogger(References);

                // Get reference to container info
                var infoDescriptor = new Descriptor("*", "container-info", "*", "*", "*");
                Info = (ContainerInfo)References.GetOneRequired(infoDescriptor);

                Logger.Info(correlationId, "Container {0} started.", Info.Name);
            }
            catch (Exception ex)
            {
                References = null;
                Logger.Error(correlationId, ex, "Failed to start container");

                throw;
            }
        }
Ejemplo n.º 25
0
        public void AssertPlatforms()
        {
            var results = Opener.LinCommand("npm install");

            Assert.Equal(results.Command, "xdg-open");
            Assert.Equal(results.Arguments, new List <string>()
            {
                "npm install"
            });

            results = Opener.MacCommand("npm install");
            Assert.Equal(results.Command, "open");
            Assert.Equal(results.Arguments, new List <string>()
            {
                "npm install"
            });

            results = Opener.WinCommand("npm install");
            Assert.Equal(results.Command, "cmd.exe");
            Assert.Equal(results.Arguments, new List <string>()
            {
                "/c", "start", string.Empty, "npm install"
            });
        }
Ejemplo n.º 26
0
        private void Guardar()
        {
            SISTMEDEntities P = new SISTMEDEntities();

            using (var dbContextTransaction = P.Database.BeginTransaction())
                try
                {
                    P.Configuration.ValidateOnSaveEnabled = false;

                    PRO_PHPV2 _itemPHP = new PRO_PHPV2();
                    _itemPHP.tamanio_frasco = ObtieneTamanioFrasco();
                    _itemPHP.bic            = checkBic.Checked;
                    _itemPHP.gotas_minuto   = Convert.ToInt32(cboGotaHora.SelectedValue);
                    _itemPHP.ml_hora        = txtMlHora.Text == ""? 0: Convert.ToInt32(txtMlHora.Text);
                    _itemPHP.fecha_carga    = DateTime.Now;
                    _itemPHP.usr_carga      = Clases.Usuario.UsuarioLogeado.id_usuario_Logeado;
                    _itemPHP.obs            = txtObs.Text;
                    if (_suspender == 1)
                    {
                        _itemPHP.fecha_baja = _fbja;
                    }
                    _itemPHP.frasco1  = Convert.ToInt32(cboDiluyente.SelectedValue);
                    _itemPHP.frasco2  = Convert.ToInt32(cboDiluyente2.SelectedValue);
                    _itemPHP.frasco3  = Convert.ToInt32(cboDiluyente3.SelectedValue);
                    _itemPHP.frasco4  = Convert.ToInt32(cboDiluyente4.SelectedValue);
                    _itemPHP.frasco5  = Convert.ToInt32(cboDiluyente5.SelectedValue);
                    _itemPHP.frasco6  = Convert.ToInt32(cboDiluyente6.SelectedValue);
                    _itemPHP.frasco7  = Convert.ToInt32(cboDiluyente7.SelectedValue);
                    _itemPHP.frasco8  = Convert.ToInt32(cboDiluyente8.SelectedValue);
                    _itemPHP.frasco9  = Convert.ToInt32(cboDiluyente9.SelectedValue);
                    _itemPHP.frasco10 = Convert.ToInt32(cboDiluyente10.SelectedValue);

                    if (suministro_procedimiento_id != 0)
                    {
                        _itemPHP.id_php         = _phpID;
                        P.Entry(_itemPHP).State = System.Data.Entity.EntityState.Modified;
                    }
                    else
                    {
                        P.PRO_PHPV2.Add(_itemPHP);
                    }

                    if (suministro_procedimiento_id != 0)
                    {
                        P.PRO_PHPV2_ADITIVO.RemoveRange(P.PRO_PHPV2_ADITIVO.Where(a => a.id_php == _phpID));
                    }

                    foreach (Control c in groupBoxFrascos.Controls)
                    {
                        if (c is DataGridView)
                        {
                            DataGridView _tablaAditivos = (DataGridView)c;
                            if (_tablaAditivos.Rows.Count > 0)//Tiene algun aditivo
                            {
                                for (int i = 0; i < _tablaAditivos.Rows.Count; i++)
                                {
                                    PRO_PHPV2_ADITIVO _itemAditivo = new PRO_PHPV2_ADITIVO();
                                    _itemAditivo.PRO_PHPV2    = _itemPHP;
                                    _itemAditivo.id_frasco    = Convert.ToInt32(_tablaAditivos.Tag);
                                    _itemAditivo.aditivo_id   = _tablaAditivos.Rows[i].Cells[(int)Col_Aditivos.ID].Value.ToString();
                                    _itemAditivo.aditivo_desc = _tablaAditivos.Rows[i].Cells[(int)Col_Aditivos.ADITIVO].Value.ToString();
                                    _itemAditivo.dosis        = Convert.ToDecimal(_tablaAditivos.Rows[i].Cells[(int)Col_Aditivos.DOSIS].Value);
                                    P.PRO_PHPV2_ADITIVO.Add(_itemAditivo);
                                }
                            }
                            else //No tiene aditivos
                            {
                                PRO_PHPV2_ADITIVO _itemAditivo = new PRO_PHPV2_ADITIVO();
                                _itemAditivo.PRO_PHPV2    = _itemPHP;
                                _itemAditivo.id_frasco    = Convert.ToInt32(_tablaAditivos.Tag);
                                _itemAditivo.aditivo_id   = "S/A";
                                _itemAditivo.aditivo_desc = "";
                                _itemAditivo.dosis        = 0;
                                P.PRO_PHPV2_ADITIVO.Add(_itemAditivo);
                            }
                        }
                    }

                    PRO_SuministroDeProcedimiento _itemSP = new PRO_SuministroDeProcedimiento();
                    _itemSP.paciente_id          = Clases.Paciente.PacienteIngresado;
                    _itemSP.procedimiento_id     = procedimiento_id;
                    _itemSP.tipoProcedimiento_id = 8;
                    _itemSP.usuario_id           = Clases.Usuario.UsuarioLogeado.id_usuario_Logeado;
                    _itemSP.fechaAltaSistema     = DateTime.Now;

                    if (_suspender == 1)
                    {
                        _itemSP.fechaBaja = _fbja;
                    }

                    if (suministro_procedimiento_id == 0)
                    {
                        _itemSP.PRO_PHPV2 = _itemPHP;
                        P.PRO_SuministroDeProcedimiento.Add(_itemSP);
                    }
                    else
                    {
                        if (_suspender == 1)
                        {
                            PRO_SuministroDeProcedimiento _itemSuministro = new PRO_SuministroDeProcedimiento {
                                suministroDeProcedimiento_id = suministro_procedimiento_id, fechaBaja = _fbja
                            };
                            P.PRO_SuministroDeProcedimiento.Attach(_itemSuministro);
                            P.Entry(_itemSuministro).Property(s => s.fechaBaja).IsModified = true;
                        }
                    }

                    P.SaveChanges();
                    dbContextTransaction.Commit();
                    MetroMessageBox.Show(this, "Se guardo correctamente");
                    if (suministro_procedimiento_id != 0)
                    {
                        ActualizarIndicacion();
                    }
                    else
                    {
                        Opener.IActualiza();
                    }
                    this.Close();
                }
                catch (Exception ex)
                {
                    dbContextTransaction.Rollback();
                    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
        }
Ejemplo n.º 27
0
        public bool IsOpened()
        {
            var components = _references.GetAll();

            return(Opener.IsOpened(components));
        }
Ejemplo n.º 28
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;
                }
            }
        }