private void ProcessExited()
        {
            IsFormEnabled = true;

            // MessageVisibility = "Hidden";

            FormMessage = "Pobrano ustawienia. \nZamknij to okno i zapisz ustawienia by wprowadzić zmiany.";

            if(IsSolidWorksRunning)
            {
                List<string> keysList = new List<string>();

                if(Mode==LaunchMode.ProjectSetting)
                {
                    keysList.Add(SelectedVersion.RegPath);
                }
                else if (Mode == LaunchMode.UserSetting)
                {
                    keysList.Add(SelectedVersion.RegPath + "\\User Interface");
                    keysList.Add(SelectedVersion.RegPath + "\\Menu Customizations");

                }

                RegistryEntryList regList = new RegistryEntryList(RegistryTool.GetInstance().ParseSWSettings(SelectedVersion, keysList));
                string timeStamp = DateTime.Now.ToShortDateString() + "_" + DateTime.Now.ToLongTimeString().GetHashCode().ToString();
                string savePath = AppDomain.CurrentDomain.BaseDirectory + "regsettings\\" + timeStamp + ".regsetting";
                if (regList.SerializeRegEntries(savePath))
                {
                    editedSetting.RegSettings = "regsettings\\" + timeStamp + ".regsetting";
                }

                editedSetting.BoundVersion = SelectedVersion;
            }
            else
            {
                MessageVisibility = "Hidden";
            }

            IsSolidWorksRunning = false;
        }
        private void RunSolidWorks()
        {
            if (Mode==LaunchMode.ProjectSetting)
            {
                RegistryEntryList regList = new RegistryEntryList();
                if (editedSetting.RegSettings != null && File.Exists(AppDomain.CurrentDomain.BaseDirectory + editedSetting.RegSettings) && regList.DeserializeRegEntries(AppDomain.CurrentDomain.BaseDirectory + editedSetting.RegSettings))
                {
                    RegistryTool.GetInstance().WriteSWRegistrySettings(SelectedVersion, regList.RegEntries);
                }

                RegistryTool.GetInstance().OverrideSWSettings(SelectedVersion, EditedSetting);
            }

            solidWorks = new SolidWorks(SelectedVersion);
            solidWorks.ProcessStarted += ProcessLaunchStarted;
            solidWorks.InstanceStarted += InstanceObtained;
            solidWorks.ProcessEnded += ProcessExited;

            solidWorks.StartRunningProcess();
        }
        private void RunSolidWorks()
        {
            RegistryEntryList regList = new RegistryEntryList();

            if (SelectedSetting.RegSettings != null &&
                File.Exists(AppDomain.CurrentDomain.BaseDirectory + SelectedSetting.RegSettings) &&
                regList.DeserializeRegEntries(AppDomain.CurrentDomain.BaseDirectory + SelectedSetting.RegSettings))
            {
                ProgressMessage = "Wczytuję ustawienia";
                RegistryTool.GetInstance().WriteSWRegistrySettings(SelectedVersion, regList.RegEntries);
                ProgressMessage = "Wczytano ustawienia";
                LaunchProgress = 20;
            }

            RegistryTool.GetInstance().OverrideSWSettings(SelectedVersion, SelectedSetting);
            ProgressMessage = "Nadpisano ustawienia szablonów";
            LaunchProgress = 30;

            User userSettings = SWDataManager.Instance.GetUsers().Find(i => i.Name == Environment.UserName);

            if (userSettings!=null &&
                !String.IsNullOrEmpty(userSettings.SettingPath) &&
                File.Exists(AppDomain.CurrentDomain.BaseDirectory + userSettings.SettingPath) &&
                regList.DeserializeRegEntries(AppDomain.CurrentDomain.BaseDirectory + userSettings.SettingPath))
            {
                RegistryTool.GetInstance().WriteSWRegistrySettings(SelectedVersion, regList.RegEntries);
                ProgressMessage = "Wczytano ustawienia użytkownika";
                LaunchProgress = 40;
            }

            solidWorks = new SolidWorks(SelectedVersion);
            solidWorks.ProcessStarted += ProcessLaunchStarted;
            solidWorks.InstanceStarted += InstanceObtained;
            solidWorks.ProcessEnded += ProcessExited;
            solidWorks.SWIdle += SWReadyIdle;

            solidWorks.StartRunningProcess();
        }