Esempio n. 1
0
 public AutoUpdaterUI(IUserConfigManager userConfigManager, AppConfigManager appConfigManager, IAutoUpdater autoUpdater, IFormFactory formFactory)
 {
     this.userConfigManager = userConfigManager;
     this.appConfigManager = appConfigManager;
     this.autoUpdater = autoUpdater;
     this.formFactory = formFactory;
 }
Esempio n. 2
0
        public ShellViewModel(
            IMessageBoxManager messageBoxManager,
            IWellDataImporter wellDataImporter,
            IWellProvider wellProvider,
            ITankProvider tankProvider,
            IWindowManager windowManager,
            IFactory <AddWellViewModel> wellViewModelFactory,
            IAutoUpdater autoUpdater)
        {
            _messageBoxManager    = messageBoxManager;
            _wellDataImporter     = wellDataImporter;
            _wellProvider         = wellProvider;
            _tankProvider         = tankProvider;
            _windowManager        = windowManager;
            _wellViewModelFactory = wellViewModelFactory;
            _autoUpdater          = autoUpdater;
            WellItems             = new BindableCollection <WellModel>();
            TankItems             = new BindableCollection <TankModel>();
            MessageQueue          = new SnackbarMessageQueue(TimeSpan.FromSeconds(2))
            {
                IgnoreDuplicate = true
            };

            _propertyObserver = new PropertyObserver <ShellViewModel>(this);

            _propertyObserver.OnChangeOf(x => x.SelectedWell).Do((vm) => LoadTanks(vm.SelectedWell).ConfigureAwait(false));
        }
Esempio n. 3
0
 public AutoUpdaterUI(IUserConfigManager userConfigManager, AppConfigManager appConfigManager, IAutoUpdater autoUpdater, IFormFactory formFactory)
 {
     this.userConfigManager = userConfigManager;
     this.appConfigManager  = appConfigManager;
     this.autoUpdater       = autoUpdater;
     this.formFactory       = formFactory;
 }
        public Updater(IAutoUpdater applicationInfo)
        {
            this.applicationInfo = applicationInfo;

            bgWorker                     = new BackgroundWorker();
            bgWorker.DoWork             += new DoWorkEventHandler(BgWorker_DoWork);
            bgWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(BgWorker_RunWorkerCompleted);
        }
Esempio n. 5
0
        private static int Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var process = RuningInstance();

            if (process != null)
            {
                Console.WriteLine("Updater is running.");
                return(0);
            }

            if (args != null && args.IsNotEmpty())
            {
                CommandLineArguments command = new CommandLineArguments(args);

                if (command.ContainKey("help") || command.ContainKey("?"))
                {
                    string msg =
                        new StringBuilder().Append("Usage command:")
                        .Append(Environment.NewLine)
                        .Append("-ForceUpdate if contains this means force update, otherwise the update can be applied.")
                        .ToString();

                    MessageBox.Show(msg, "Tips", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return(0);
                }

                if (command.ContainKey("forceUpdate"))
                {
                    CommonUnitity.ForceUpdate = true;
                }
            }

            CommonUnitity.LogMsg("Forceupdate = " + CommonUnitity.ForceUpdate);

            ExitCode     exitCode    = ExitCode.Default;
            IAutoUpdater autoUpdater = null;

            try
            {
                autoUpdater = new AutoUpdater();
                exitCode    = autoUpdater.Update();
            }
            catch (Exception exp)
            {
                CommonUnitity.LogMsg(exp);
                if (autoUpdater != null)
                {
                    autoUpdater.RollBack();
                }
                MessageBox.Show("Update failed, roll back files.");
            }
            return((int)exitCode);
        }
Esempio n. 6
0
        public Presenter(
            IAutoUpdater model,
            IGlobalSettingsAccessor settingsAccessor,
            IView view)
        {
            this.model = model;
            this.view  = view;

            view.SetPresenter(this);

            UpdateAutomaticUpdatesView();
            model.Changed += (s, e) => UpdateAutomaticUpdatesView();
        }
Esempio n. 7
0
        /// <summary>
        /// Konstruktor.
        /// </summary>
        public MainFormView()
        {
            InitializeComponent();

            this.nextClipboardViewer = (IntPtr)SetClipboardViewer((int)this.Handle);

            Icon updaterIcon = Subeditor.Properties.Resources.AppIcon;

            this.autoUpdater = new NetSparkleAutoUpdater(Subeditor.Properties.Resources.URLVersionInfo, updaterIcon);

            //this.autoUpdater.Update();
            this.autoUpdater.UpdateAsync();
        }
Esempio n. 8
0
        /// <summary>
        /// Checks for /parses update.xml on server
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void bgWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            IAutoUpdater application = (IAutoUpdater)e.Argument;

            if (!AutoUpdaterXML.ExistsOnServer(application.UpdateXmlLocation))
            {
                e.Cancel = true;
            }
            else
            {
                e.Result = AutoUpdaterXML.Parse(application.UpdateXmlLocation, application.ApplicationID);
            }
        }
        private void BgWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            IAutoUpdater application = (IAutoUpdater)e.Argument;

            if (!AutoUpdaterConfig.ExistsOnServer(application.UpdateInfoLocation))
            {
                e.Cancel = true;
            }
            else
            {
                e.Result = AutoUpdaterConfig.Parse(application.UpdateInfoLocation);
            }
        }
Esempio n. 10
0
 {/// <summary>
  /// Create a new AutoUpdateInfoForm
  /// </summary>
  /// <param name="applicationInfo"></param>
  /// <param name="updateInfo"></param>
     public AutoUpdateInfoForm(IAutoUpdater applicationInfo, AutoUpdaterXML updateInfo)
     {
         InitializeComponent();
         ///Sets the icon if it's not null
         if (applicationInfo.ApplicationIcon != null)
         {
             this.Icon = applicationInfo.ApplicationIcon;
         }
         ///Fill in the UI
         this.Text            = applicationInfo.ApplicationName + " - Update Info";
         this.lblVersion.Text = String.Format("Current Version: {0}\nUpdate Version: {1}", applicationInfo.ApplicationAssembly.GetName().Version.ToString(),
                                              updateInfo.Version.ToString());
         this.txtDescription.Text = updateInfo.Description;
     }
Esempio n. 11
0
        /// <summary>
        /// Creats a new AutoUpdateAcceptForm
        /// </summary>
        /// <param name="applicationInfo"></param>
        /// <param name="updateInfo"></param>
        public AutoUpdateAcceptForm(IAutoUpdater applicationInfo, AutoUpdaterXML updateInfo)
        {
            InitializeComponent();

            this.applicationInfo = applicationInfo;
            this.updateInfo      = updateInfo;

            this.Text = this.applicationInfo.ApplicationName + " - Update Availiable";
            ///assigns the icon if it isn't null
            if (this.applicationInfo.ApplicationIcon != null)
            {
                this.Icon = this.applicationInfo.ApplicationIcon;
            }
            ///Adds the update version # to the form
            lblNewVersion.Text = string.Format("New Version: {0}", this.updateInfo.Version.ToString());
        }
Esempio n. 12
0
        public MainWindowViewModel(ApplicationSettings settings,
		                           DataSources dataSources,
		                           QuickFilters quickFilters,
		                           IActionCenter actionCenter,
		                           IAutoUpdater updater,
		                           IDispatcher dispatcher)
        {
            if (dataSources == null) throw new ArgumentNullException("dataSources");
            if (quickFilters == null) throw new ArgumentNullException("quickFilters");
            if (updater == null) throw new ArgumentNullException("updater");
            if (dispatcher == null) throw new ArgumentNullException("dispatcher");

            _dataSourcesViewModel = new DataSourcesViewModel(settings, dataSources);
            _dataSourcesViewModel.PropertyChanged += DataSourcesViewModelOnPropertyChanged;
            _quickFilters = new QuickFiltersViewModel(settings, quickFilters);
            _quickFilters.OnFiltersChanged += OnQuickFiltersChanged;
            _settings = new SettingsViewModel(settings);
            _actionCenter = new ActionCenterViewModel(dispatcher, actionCenter);

            _timer = new DispatcherTimer
                {
                    Interval = TimeSpan.FromMilliseconds(100)
                };
            _timer.Tick += TimerOnTick;
            _timer.Start();

            _autoUpdater = new AutoUpdateViewModel(updater, settings.AutoUpdate, dispatcher);

            _dispatcher = dispatcher;
            WindowTitle = Constants.MainWindowTitle;

            _selectNextDataSourceCommand = new DelegateCommand(SelectNextDataSource);
            _selectPreviousDataSourceCommand = new DelegateCommand(SelectPreviousDataSource);
            _addDataSourceCommand = new DelegateCommand(AddDataSource);

            ChangeDataSource(CurrentDataSource);
        }
Esempio n. 13
0
        public AutoUpdateViewModel(IAutoUpdater updater, IAutoUpdateSettings settings, IDispatcher dispatcher)
        {
            if (updater == null)
            {
                throw new ArgumentNullException(nameof(updater));
            }
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }
            if (dispatcher == null)
            {
                throw new ArgumentNullException(nameof(dispatcher));
            }

            _updater                = updater;
            _dispatcher             = dispatcher;
            _installCommand         = new DelegateCommand(Install, CanInstall);
            _gotItCommand           = new DelegateCommand(GotIt);
            _checkForUpdatesCommand = new DelegateCommand(CheckForUpdates);
            _installTitle           = "Install";

            _updater.LatestVersionChanged += UpdaterOnLatestVersionChanged;
        }
        public MainWindowViewModel(IApplicationSettings settings,
                                   DataSources dataSources,
                                   QuickFilters quickFilters,
                                   IActionCenter actionCenter,
                                   IAutoUpdater updater,
                                   ITaskScheduler taskScheduler,
                                   IAnalysisStorage analysisStorage,
                                   IDispatcher dispatcher,
                                   IPluginLoader pluginLoader)
        {
            if (dataSources == null)
            {
                throw new ArgumentNullException(nameof(dataSources));
            }
            if (quickFilters == null)
            {
                throw new ArgumentNullException(nameof(quickFilters));
            }
            if (updater == null)
            {
                throw new ArgumentNullException(nameof(updater));
            }
            if (dispatcher == null)
            {
                throw new ArgumentNullException(nameof(dispatcher));
            }

            _applicationSettings = settings;

            _plugins  = pluginLoader.Plugins;
            _settings = new SettingsMainPanelViewModel(settings);
            _actionCenterViewModel = new ActionCenterViewModel(dispatcher, actionCenter);

            _analysePanel = new AnalyseMainPanelViewModel(_applicationSettings, dataSources, dispatcher, taskScheduler, analysisStorage, pluginLoader);
            _analysePanel.PropertyChanged += AnalysePanelOnPropertyChanged;

            _logViewPanel = new LogViewMainPanelViewModel(actionCenter,
                                                          dataSources,
                                                          quickFilters,
                                                          _applicationSettings);
            _logViewPanel.PropertyChanged += LogViewPanelOnPropertyChanged;

            _timer = new DispatcherTimer
            {
                Interval = TimeSpan.FromMilliseconds(100)
            };
            _timer.Tick += TimerOnTick;
            _timer.Start();

            _autoUpdater                   = new AutoUpdateViewModel(updater, settings.AutoUpdate, dispatcher);
            _showLogCommand                = new DelegateCommand(ShowLog);
            _showGoToLineCommand           = new DelegateCommand2(ShowGoToLine);
            _showQuickNavigationCommand    = new DelegateCommand2(ShowQuickNavigation);
            _goToNextDataSourceCommand     = new DelegateCommand2(GoToNextDataSource);
            _goToPreviousDataSourceCommand = new DelegateCommand2(GoToPreviousDataSource);

            _analyseEntry = new AnalyseMainPanelEntry();
            _rawEntry     = new LogViewMainPanelEntry();
            _topEntries   = new IMainPanelEntry[]
            {
                _rawEntry,
                _analyseEntry
            };

            _settingsEntry = new SettingsMainPanelEntry();
            _pluginsEntry  = new PluginsMainPanelEntry();
            _aboutEntry    = new AboutMainPanelEntry();
            _bottomEntries = new[]
            {
                _settingsEntry,
                _pluginsEntry,
                _aboutEntry
            };

            var selectedTopEntry    = _topEntries.FirstOrDefault(x => x.Id == _applicationSettings.MainWindow.SelectedMainPanel);
            var selectedBottomEntry = _bottomEntries.FirstOrDefault(x => x.Id == _applicationSettings.MainWindow.SelectedMainPanel);

            if (selectedTopEntry != null)
            {
                SelectedTopEntry = selectedTopEntry;
            }
            else if (selectedBottomEntry != null)
            {
                SelectedBottomEntry = selectedBottomEntry;
            }
            else
            {
                SelectedTopEntry = _rawEntry;
            }
        }
Esempio n. 15
0
        public Presenter(
            ILogSourcesManager logSources,
            Preprocessing.IManager preprocessingsManager,
            IView view,
            LogViewer.IPresenterInternal viewerPresenter,
            SearchResult.IPresenter searchResultPresenter,
            SearchPanel.IPresenter searchPanelPresenter,
            SourcesManager.IPresenter sourcesManagerPresenter,
            MessagePropertiesDialog.IPresenter messagePropertiesDialogPresenter,
            LoadedMessages.IPresenter loadedMessagesPresenter,
            BookmarksManager.IPresenter bookmarksManagerPresenter,
            IHeartBeatTimer heartBeatTimer,
            ITabUsageTracker tabUsageTracker,
            StatusReports.IPresenter statusReportFactory,
            IDragDropHandler dragDropHandler,
            IPresentersFacade presentersFacade,
            IAutoUpdater autoUpdater,
            Progress.IProgressAggregator progressAggregator,
            IAlertPopup alerts,
            SharingDialog.IPresenter sharingDialogPresenter,
            IssueReportDialogPresenter.IPresenter issueReportDialogPresenter,
            IShutdownSource shutdown,
            IColorTheme theme,
            IChangeNotification changeNotification,
            ITraceSourceFactory traceSourceFactory
            )
        {
            this.tracer                = traceSourceFactory.CreateTraceSource("UI", "ui.main");
            this.logSources            = logSources;
            this.preprocessingsManager = preprocessingsManager;
            this.view                       = view;
            this.tabUsageTracker            = tabUsageTracker;
            this.searchPanelPresenter       = searchPanelPresenter;
            this.searchResultPresenter      = searchResultPresenter;
            this.bookmarksManagerPresenter  = bookmarksManagerPresenter;
            this.viewerPresenter            = viewerPresenter;
            this.presentersFacade           = presentersFacade;
            this.dragDropHandler            = dragDropHandler;
            this.heartBeatTimer             = heartBeatTimer;
            this.autoUpdater                = autoUpdater;
            this.progressAggregator         = progressAggregator;
            this.alerts                     = alerts;
            this.sharingDialogPresenter     = sharingDialogPresenter;
            this.issueReportDialogPresenter = issueReportDialogPresenter;
            this.shutdown                   = shutdown;
            this.statusRepors               = statusReportFactory;
            this.theme                      = theme;
            this.changeNotification         = changeNotification;

            view.SetViewModel(this);

            viewerPresenter.ManualRefresh += delegate(object sender, EventArgs args)
            {
                using (tracer.NewFrame)
                {
                    tracer.Info("----> User Command: Refresh");
                    logSources.Refresh();
                }
            };
            viewerPresenter.FocusedMessageBookmarkChanged += delegate(object sender, EventArgs args)
            {
                if (searchResultPresenter != null)
                {
                    searchResultPresenter.MasterFocusedMessage = viewerPresenter.FocusedMessageBookmark;
                }
            };
            if (messagePropertiesDialogPresenter != null)
            {
                viewerPresenter.DefaultFocusedMessageActionCaption = "Show properties...";
                viewerPresenter.DefaultFocusedMessageAction       += (s, e) =>
                {
                    messagePropertiesDialogPresenter.Show();
                };
            }

            if (searchResultPresenter != null)
            {
                searchResultPresenter.OnClose           += (sender, args) => searchPanelPresenter.CollapseSearchResultPanel();
                searchResultPresenter.OnResizingStarted += (sender, args) => view.BeginSplittingSearchResults();
            }

            sourcesManagerPresenter.OnBusyState += (_, evt) => SetWaitState(evt.BusyStateRequired);

            searchPanelPresenter.InputFocusAbandoned += delegate(object sender, EventArgs args)
            {
                loadedMessagesPresenter.LogViewerPresenter.ReceiveInputFocus();
            };
            loadedMessagesPresenter.OnResizingStarted += (s, e) => view.BeginSplittingTabsPanel();

            this.heartBeatTimer.OnTimer += (sender, e) =>
            {
                if (e.IsRareUpdate)
                {
                    SetAnalyzingIndication(logSources.Items.Any(s => s.TimeGaps.IsWorking));
                }
            };

            logSources.OnLogSourceAdded += (sender, evt) =>
            {
                UpdateFormCaption();
            };
            logSources.OnLogSourceRemoved += (sender, evt) =>
            {
                UpdateFormCaption();
            };

            progressAggregator.ProgressStarted += (sender, args) =>
            {
                view.SetTaskbarState(TaskbarState.Progress);
                UpdateFormCaption();
            };

            progressAggregator.ProgressEnded += (sender, args) =>
            {
                view.SetTaskbarState(TaskbarState.Idle);
                UpdateFormCaption();
            };

            progressAggregator.ProgressChanged += (sender, args) =>
            {
                view.UpdateTaskbarProgress(args.ProgressPercentage);
                UpdateFormCaption();
            };

            if (sharingDialogPresenter != null)
            {
                sharingDialogPresenter.AvailabilityChanged += (sender, args) =>
                {
                    UpdateShareButton();
                };
                sharingDialogPresenter.IsBusyChanged += (sender, args) =>
                {
                    UpdateShareButton();
                };
            }
            ;

            UpdateFormCaption();
            UpdateShareButton();

            view.SetIssueReportingMenuAvailablity(issueReportDialogPresenter.IsAvailable);
        }
Esempio n. 16
0
 public CleanUpDedector(IConfiguration configuration, IAutoUpdater updater)
 {
     _updater = updater;
     _switch  = configuration.GetValue("cleanup", false);
     _id      = configuration.GetValue("id", -1);
 }
 public WeatherForecastController(ILogger <WeatherForecastController> logger, IAutoUpdater autoUpdater)
 {
     _logger      = logger ?? throw new ArgumentNullException(nameof(logger));
     _autoUpdater = autoUpdater ?? throw new ArgumentNullException(nameof(autoUpdater));
 }
            static IEnumerable <IPreparedFeature> _(IAppRegistry registry, AppNodeInfo configuration, IAppManager manager, IAutoUpdater updater)
            {
                yield return(SubscribeFeature.New());

                yield return(Feature.Create(() => new InstallManagerActor(), new InstallManagerState(registry, configuration, manager, updater)));
            }
 public sealed record InstallManagerState(IAppRegistry Registry, AppNodeInfo Configuration, IAppManager AppManager, IAutoUpdater AutoUpdater);
Esempio n. 20
0
        public MainWindowViewModel(IServiceContainer services,
                                   IApplicationSettings settings,
                                   DataSources dataSources,
                                   QuickFilters quickFilters,
                                   IActionCenter actionCenter,
                                   IAutoUpdater updater)
        {
            if (dataSources == null)
            {
                throw new ArgumentNullException(nameof(dataSources));
            }
            if (quickFilters == null)
            {
                throw new ArgumentNullException(nameof(quickFilters));
            }
            if (updater == null)
            {
                throw new ArgumentNullException(nameof(updater));
            }

            var services1           = services;
            var applicationSettings = settings;

            _plugins = new PluginsMainPanelViewModel(applicationSettings,
                                                     services1.Retrieve <IDispatcher>(),
                                                     services1.Retrieve <IPluginUpdater>(),
                                                     services1.Retrieve <IPluginLoader>().Plugins);
            _settings = new SettingsFlyoutViewModel(settings, services);
            _actionCenterViewModel = new ActionCenterViewModel(services.Retrieve <IDispatcher>(), actionCenter);

            _logViewPanel = new LogViewMainPanelViewModel(services,
                                                          actionCenter,
                                                          dataSources,
                                                          quickFilters,
                                                          services.Retrieve <IHighlighters>(),
                                                          applicationSettings);
            WindowTitle       = _logViewPanel.WindowTitle;
            WindowTitleSuffix = _logViewPanel.WindowTitleSuffix;

            ((NavigationService)services.Retrieve <INavigationService>()).LogViewer = _logViewPanel;

            _logViewPanel.PropertyChanged += LogViewPanelOnPropertyChanged;

            var timer = new DispatcherTimer
            {
                Interval = TimeSpan.FromMilliseconds(100)
            };

            timer.Tick += TimerOnTick;
            timer.Start();

            _autoUpdater = new AutoUpdateViewModel(updater, settings.AutoUpdate, services.Retrieve <IDispatcher>());

            var fileMenuViewModel = new FileMenuViewModel(new DelegateCommand2(AddDataSourceFromFile),
                                                          new DelegateCommand2(AddDataSourceFromFolder),
                                                          _logViewPanel.DataSources.RemoveCurrentDataSourceCommand,
                                                          _logViewPanel.DataSources.RemoveAllDataSourcesCommand,
                                                          new DelegateCommand2(ShowPlugins),
                                                          new DelegateCommand2(ShowSettings),
                                                          new DelegateCommand2(Exit));
            var editMenu = new EditMenuViewModel(new DelegateCommand2(ShowGoToLine),
                                                 new DelegateCommand2(ShowGoToDataSource),
                                                 new DelegateCommand2(GoToNextDataSource),
                                                 new DelegateCommand2(GoToPreviousDataSource),
                                                 _logViewPanel);
            var viewMenu = new ViewMenuViewModel();
            var helpMenu = new HelpMenuViewModel(new DelegateCommand2(ReportIssue),
                                                 new DelegateCommand2(SuggestFeature),
                                                 new DelegateCommand2(AskQuestion),
                                                 AutoUpdater.CheckForUpdatesCommand,
                                                 new DelegateCommand(ShowLog),
                                                 new DelegateCommand2(ShowAboutFlyout));

            _mainMenu = new MainMenu(fileMenuViewModel,
                                     editMenu,
                                     viewMenu,
                                     helpMenu);
            _mainMenu.CurrentDataSource = _logViewPanel.CurrentDataSource;
        }
Esempio n. 21
0
        public static AutoUpdateStatusPresentation GetPresentation(this IAutoUpdater model, bool preferShortBrief)
        {
            var    brief       = new StringBuilder();
            string details     = null;
            bool   canCheckNow = false;
            bool   enabled     = true;

            switch (model.State)
            {
            case AutoUpdateState.Disabled:
            case AutoUpdateState.Inactive:
                brief.Append("NA");
                enabled = false;
                break;

            case AutoUpdateState.WaitingRestart:
                if (preferShortBrief)
                {
                    brief.Append("Restart app to apply update");
                }
                else
                {
                    brief.Append("New update was downloaded. Restart LogJoint to apply it.");
                }
                break;

            case AutoUpdateState.Checking:
                brief.Append("checking for new update...");
                break;

            case AutoUpdateState.Idle:
                var lastCheckResult = model.LastUpdateCheckResult;
                if (lastCheckResult == null)
                {
                    brief.Append("never checked for update");
                }
                else
                {
                    if (lastCheckResult.ErrorMessage == null)
                    {
                        brief.AppendFormat("You're up to date as of {0}", lastCheckResult.When.ToLocalTime());
                    }
                    else
                    {
                        brief.AppendFormat("update at {0} failed.", lastCheckResult.When.ToLocalTime());
                        details = lastCheckResult.ErrorMessage;
                    }
                }
                canCheckNow = true;
                break;

            case AutoUpdateState.Failed:
                brief.Append("failure");
                break;

            case AutoUpdateState.FailedDueToBadInstallationDirectory:
                brief.Append("bad intallation directory detected.");
                details = string.Format(
                    @"For automtaic updates to work LogJoint must be installed" +
                    " to a directory allowed to be written by the current user ({0}).",
                    Environment.UserName
                    );
                break;

            default:
                brief.Append("?");
                enabled = false;
                break;
            }
            return(new AutoUpdateStatusPresentation()
            {
                Brief = brief.ToString(),
                CanCheckNow = canCheckNow,
                Enabled = enabled,
                Details = details
            });
        }
Esempio n. 22
0
        /// <summary>
        /// Default Constructor
        /// </summary>
        public MainWindowViewModel(MacroManagerViewModel macroManager, SettingViewModel setting, IAutoUpdater autoUpdater, TimerToolViewModel timerTool, ResolutionConverterToolViewModel resolutionConverterTool, ScriptGeneratorViewModel scriptGenerator, CustomActionManager customActionManager, AutoLocationViewModel AutoLocation)
        {
            this.MacroManager            = macroManager;
            this.CurrentSettings         = setting;
            this.AutoUpdater             = autoUpdater;
            this.TimerTool               = timerTool;
            this.ScriptGenerator         = scriptGenerator;
            this.CustomActionManager     = customActionManager;
            this.ResolutionConverterTool = resolutionConverterTool;
            this.AutoLocation            = AutoLocation;

            InitializeCommands();


            if (CurrentSettings.IsAutoUpdateEnable == true)
            {
                this.AutoUpdater.CheckForUpdate();
            }
        }
Esempio n. 23
0
        public InstallManagerActor(IAppRegistry registry, IConfiguration configuration, IAppManager manager, IAutoUpdater autoUpdater)
        {
            SubscribeAbility ability = new SubscribeAbility(this);

            ability.MakeReceive();

            Receive <InstallerationCompled>(ic => ability.Send(ic));
            Receive <InstallRequest>(o => Context.ActorOf(Props.Create <ActualInstallerActor>(registry, configuration, autoUpdater)).Forward(o));
            Receive <UninstallRequest>(o => Context.ActorOf(Props.Create <ActualUninstallationActor>(registry, manager)).Forward(o));
        }
Esempio n. 24
0
        public MainWindowViewModel(IServiceContainer services,
                                   IApplicationSettings settings,
                                   DataSources dataSources,
                                   QuickFilters quickFilters,
                                   IActionCenter actionCenter,
                                   IAutoUpdater updater)
        {
            if (dataSources == null)
            {
                throw new ArgumentNullException(nameof(dataSources));
            }
            if (quickFilters == null)
            {
                throw new ArgumentNullException(nameof(quickFilters));
            }
            if (updater == null)
            {
                throw new ArgumentNullException(nameof(updater));
            }

            _services            = services;
            _applicationSettings = settings;

            _plugins  = services.Retrieve <IPluginLoader>().Plugins;
            _settings = new SettingsMainPanelViewModel(settings);
            _actionCenterViewModel = new ActionCenterViewModel(services.Retrieve <IDispatcher>(), actionCenter);

            _logViewPanel = new LogViewMainPanelViewModel(services,
                                                          actionCenter,
                                                          dataSources,
                                                          quickFilters,
                                                          services.Retrieve <IHighlighters>(),
                                                          _applicationSettings);
            ((NavigationService)services.Retrieve <INavigationService>()).LogViewer = _logViewPanel;

            _logViewPanel.PropertyChanged += LogViewPanelOnPropertyChanged;

            var timer = new DispatcherTimer
            {
                Interval = TimeSpan.FromMilliseconds(100)
            };

            timer.Tick += TimerOnTick;
            timer.Start();

            _autoUpdater                   = new AutoUpdateViewModel(updater, settings.AutoUpdate, services.Retrieve <IDispatcher>());
            _showLogCommand                = new DelegateCommand(ShowLog);
            _showGoToLineCommand           = new DelegateCommand2(ShowGoToLine);
            _showQuickNavigationCommand    = new DelegateCommand2(ShowQuickNavigation);
            _goToNextDataSourceCommand     = new DelegateCommand2(GoToNextDataSource);
            _goToPreviousDataSourceCommand = new DelegateCommand2(GoToPreviousDataSource);

            _rawEntry   = new LogViewMainPanelEntry();
            _topEntries = new IMainPanelEntry[]
            {
                _rawEntry
            };

            _settingsEntry = new SettingsMainPanelEntry();
            _pluginsEntry  = new PluginsMainPanelEntry();
            _aboutEntry    = new AboutMainPanelEntry();
            _bottomEntries = new[]
            {
                _settingsEntry,
                _pluginsEntry,
                _aboutEntry
            };

            var selectedTopEntry    = _topEntries.FirstOrDefault(x => x.Id == _applicationSettings.MainWindow.SelectedMainPanel);
            var selectedBottomEntry = _bottomEntries.FirstOrDefault(x => x.Id == _applicationSettings.MainWindow.SelectedMainPanel);

            if (selectedTopEntry != null)
            {
                SelectedTopEntry = selectedTopEntry;
            }
            else if (selectedBottomEntry != null)
            {
                SelectedBottomEntry = selectedBottomEntry;
            }
            else
            {
                SelectedTopEntry = _rawEntry;
            }

            _isLeftSidePanelVisible = settings.MainWindow.IsLeftSidePanelVisible;
            UpdateLeftSidePanelExpanderTooltip();
        }
Esempio n. 25
0
        public AEMGViewModel(IMacroManager macroManager, AEActionListViewModel AEActionList, AESettingViewModel Settings, AEScriptGenerator scriptGenerator, IMessageBoxService messageBoxService, IAutoUpdater AutoUpdater)
        {
            this.MacroManager          = macroManager;
            this.AEActionListViewModel = AEActionList;
            this.Settings          = Settings;
            this.scriptGenerator   = scriptGenerator;
            this.messageBoxService = messageBoxService;
            this.AutoUpdater       = AutoUpdater;
            this.MacroManager.ScanForMacroes();

            InitializeCommandAndEvents();

            if (Settings.IsAutoUpdateEnable == true)
            {
                this.AutoUpdater.CheckForUpdate();
            }
        }
Esempio n. 26
0
        public ActualInstallerActor(IAppRegistry registry, IConfiguration configuration, IAutoUpdater autoUpdater)
        {
            string appBaseLocation = configuration["AppsLocation"];

            StartMessage <FileInstallationRequest>(HandleFileInstall);

            WhenStep(StepId.Start, c => c.OnExecute(cc => Preperation));

            WhenStep(Preperation, config =>
            {
                config.OnExecute((context, step) =>
                {
                    Log.Info("Perpering Data for Installation: {Apps}", context.Name);
                    return(context.SetSource(InstallationSourceSelector.Select, step.SetError)
                           .When(i => i != EmptySource.Instnace, () =>
                                 StepId.Waiting.DoAnd(_ =>
                                                      registry.Actor
                                                      .Ask <InstalledAppRespond>(new InstalledAppQuery(context.Name), TimeSpan.FromSeconds(5))
                                                      .PipeTo(Self))
                                 , StepId.Fail));
                });

                Signal <InstalledAppRespond>((context, respond) =>
                {
                    if (!respond.Fault)
                    {
                        return(Validation.DoAnd(_ => context.SetInstalledApp(respond.App)));
                    }

                    SetError(ErrorCodes.QueryAppInfo);
                    return(StepId.Fail);
                });
            });

            WhenStep(Validation, confg =>
            {
                confg.OnExecute((context, step) =>
                {
                    Log.Info("Validating Data for installation: {Apps}", context.Name);
                    if (context.Source.ValidateInput(context) is Status.Failure failure)
                    {
                        Log.Warning(failure.Cause, "Source Validation Failed {Apps}", context.Name);
                        step.ErrorMessage = failure.Cause.Message;
                        return(StepId.Fail);
                    }

                    // ReSharper disable once InvertIf
                    if (!context.InstalledApp.IsEmpty() && context.InstalledApp.Name == context.Name && !context.Override)
                    {
                        Log.Warning("Apps is Installed {Apps}", context.Name);
                        step.ErrorMessage = ErrorCodes.ExistingApp;
                        return(StepId.Fail);
                    }

                    return(PreCopy);
                });
            });

            WhenStep(PreCopy, config =>
            {
                config.OnExecute((context, step) =>
                {
                    Log.Info("Prepare for Copy Data {Apps}", context.Name);
                    string targetAppPath = Path.GetFullPath(Path.Combine(appBaseLocation, context.Name));


                    if (context.AppType != AppType.Host)
                    {
                        try
                        {
                            if (!Directory.Exists(targetAppPath))
                            {
                                Directory.CreateDirectory(targetAppPath);
                            }
                        }
                        catch (Exception e)
                        {
                            Log.Warning(e, "Installation Faild during Directory Creation {Apps}", context.Name);
                            step.ErrorMessage = ErrorCodes.DirectoryCreation;
                            return(StepId.Fail);
                        }
                    }

                    context.InstallationPath = targetAppPath;
                    context.Source.PreperforCopy(context)
                    .PipeTo(Self, success: () => new PreCopyCompled());


                    if (context.AppType != AppType.Host)
                    {
                        if (context.Override)
                        {
                            context.Backup.Make(targetAppPath);
                            context.Recovery.Add(context.Backup.Recover);
                        }
                    }

                    return(StepId.Waiting);
                });

                Signal <PreCopyCompled>((c, m) => Copy);
            });

            WhenStep(Copy, config =>
            {
                config.OnExecute((context, step) =>
                {
                    Log.Info("Copy Application Data {Apps}", context.Name);


                    if (context.AppType == AppType.Host)
                    {
                        autoUpdater.Tell(new StartAutoUpdate(context.Source.ToZipFile(context)));
                        return(StepId.Finish);
                    }

                    context.Recovery.Add(log =>
                    {
                        log.Info("Clearing Installation Directory during Recover {Apps}", context.Name);
                        context.InstallationPath.ClearDirectory();
                    });

                    try
                    {
                        context.Source.CopyTo(context, context.InstallationPath)
                        .PipeTo(Self, success: () => new CopyCompled());
                    }
                    catch (Exception e)
                    {
                        Log.Error(e, "Error on Extracting Files to Directory {Apps}", context.Name);
                        step.ErrorMessage = e.Message;
                        return(StepId.Fail);
                    }

                    context.Recovery.Add(log =>
                    {
                        log.Info("Delete Insttalation Files during Recovery {Apps}", context.Name);
                        context.InstallationPath.ClearDirectory();
                    });

                    return(StepId.Waiting);
                });

                Signal <CopyCompled>((context, compled) => Registration);
            });

            WhenStep(Registration, config =>
            {
                config.OnExecute((context, step) =>
                {
                    Log.Info("Register Application for Host {Apps}", context.Name);

                    if (context.InstalledApp.IsEmpty())
                    {
                        registry.Actor
                        .Ask <RegistrationResponse>(
                            new NewRegistrationRequest(context.Name, context.InstallationPath, context.Source.Version, context.AppType, context.GetExe()),
                            TimeSpan.FromSeconds(15))
                        .PipeTo(Self);
                    }
                    else
                    {
                        registry.Actor
                        .Ask <RegistrationResponse>(new UpdateRegistrationRequest(context.Name), TimeSpan.FromSeconds(15))
                        .PipeTo(Self);
                    }

                    return(StepId.Waiting);
                });

                Signal <RegistrationResponse>((context, response) =>
                {
                    if (response.Scceeded)
                    {
                        return(Finalization);
                    }
                    SetError(response.Error?.Message ?? "");
                    return(StepId.Fail);
                });
            });

            WhenStep(Finalization, config =>
            {
                config.OnExecute(context =>
                {
                    Log.Info("Clean Up and Compleding {Apps}", context.Name);

                    context.Backup.CleanUp();

                    try
                    {
                        context.Source.CleanUp(context);
                    }
                    catch (Exception e)
                    {
                        Log.Warning(e, "Error on Clean Up {Apps}", context.Name);
                    }

                    return(StepId.Finish);
                });
            });

            Signal <Failure>((ctx, f) =>
            {
                SetError(f.Exception.Message);
                return(StepId.Fail);
            });

            OnFinish(wr =>
            {
                if (!wr.Succesfully)
                {
                    Log.Warning("Installation Failed Recover {Apps}", wr.Context.Name);
                    wr.Context.Recovery.Recover(Log);
                }

                var finish = new InstallerationCompled(wr.Succesfully, wr.Error, wr.Context.AppType, wr.Context.Name, InstallationAction.Install);
                if (!Sender.Equals(Context.System.DeadLetters))
                {
                    Sender.Tell(finish, ActorRefs.NoSender);
                }

                Context.Parent.Tell(finish);
                Context.Stop(Self);
            });
        }