示例#1
0
        private async Task CheckForUpdate()
        {
            var result      = false;
            var updaterPath = Path.Combine(Environment.CurrentDirectory, "Novaroma.Updater.exe");

            if (File.Exists(updaterPath))
            {
                var checkProcess = Process.Start(updaterPath, "/justcheck");
                if (checkProcess != null && checkProcess.WaitForExit(10000))
                {
                    result = checkProcess.ExitCode == 0;
                }
            }
            UpdateAvailable = result;

            if (UpdateAvailable)
            {
                _updateCheckTimer.Dispose();

                var activity = new Activity {
                    ActivityDate = DateTime.Now,
                    Description  = Resources.UpdateAvailable,
                    Path         = updaterPath + " > /checknow"
                };
                await _engine.InsertEntity(activity);
            }
        }
        private async void AddButton_OnClick(object sender, RoutedEventArgs e)
        {
            var window = new ScriptServiceWindow(_dialogService);
            var result = window.ShowDialog();

            if (result.HasValue && result.Value)
            {
                var scriptService = new ScriptService();
                scriptService.Name = window.ScriptName;
                scriptService.Code = window.Code;

                await _engine.InsertEntity(scriptService);

                ScriptServices.Add(scriptService);
                IsModified = true;
            }
        }