Пример #1
0
 public StartProgramCommand(CollectionsDataViewModel mainWindowVeiwModel)
 {
     _mainWindowVeiwModel = mainWindowVeiwModel;
 }
Пример #2
0
        protected override async void OnStartup(StartupEventArgs e)
        {
            var proc        = new ProcessHelper();
            var settingHelp = new SettingHelper();

            if (proc.CheckProcessByName(CommonConstant.NameAppUpdater))
            {
                proc.CloseProcess(CommonConstant.NameAppUpdater);
            }

            var getArgs = Environment.GetCommandLineArgs();

            try
            {
                if (getArgs.Length == 2)
                {
                    settingHelp.RemoveProgram(CommonConstant.PathUpdater, true);
                    settingHelp.CopyFilesProgram(Path.GetTempPath() + getArgs[1] + "\\" + CommonConstant.PathUpdater, CommonConstant.PathUpdater, true);
                    settingHelp.RemoveProgram(Path.GetTempPath() + getArgs[1], true);
                }
            }
            catch (Exception)
            {
            }


            if (!File.Exists(CommonConstant.PathUpdater + CommonConstant.StartAppUpdater))
            {
                MessageBox.Show(Constant.NotFoundUpdater);
                Shutdown();
                return;
            }

            if (!File.Exists(CommonConstant.FileSettingsLauncher))
            {
                MessageBox.Show(Constant.DescriptionMessBoxNotFoundSettings);
                Shutdown();
                return;
            }

            var token = proc.GetPublicKeyTokenFromAssembly(Assembly.GetCallingAssembly());

            if (string.IsNullOrEmpty(token))
            {
                MessageBox.Show(Constant.CrashLauncher);
                Shutdown();
                return;
            }

            var mut = new Mutex(true, token, out instance);

            if (!instance)
            {
                MessageBox.Show(Constant.AlreadyStartLauncher);
                Shutdown();
                return;
            }

            var args = new string[1]
            {
                Process.GetCurrentProcess().Id.ToString()
            };

            var setHelp = new SettingHelper();
            var set     = setHelp.Read <LauncherSettingSerializer>(CommonConstant.KeySettings, CommonConstant.FileSettingsLauncher);


            Constant.PidUpdater = proc.StartProcess(CommonConstant.PathUpdater + CommonConstant.StartAppUpdater, args);

            base.OnStartup(e);

            _mainWindowViewModel = new CollectionsDataViewModel();

            await DisplayRootRegistry.ShowModalPresentation(_mainWindowViewModel);

            Shutdown();
        }
Пример #3
0
 public AuthWindowCommand(CollectionsDataViewModel mainWindowVeiwModel)
 {
     _mainWindowVeiwModel = mainWindowVeiwModel;
 }
 public DownloadInstallProgramCommand(CollectionsDataViewModel mainWindowVeiwModel)
 {
     _mainWindowVeiwModel = mainWindowVeiwModel;
 }
 public CheckUpdateProgramCommand(CollectionsDataViewModel mainWindowVeiwModel)
 {
     _mainWindowVeiwModel = mainWindowVeiwModel;
 }