internal SettingsUI(ICairoApplication cairoApplication, SettingsUIService uiService, ShellManagerService shellManagerService, IApplicationUpdateService applicationUpdateService, AppGrabberService appGrabber, ThemeService themeService) { InitializeComponent(); _appGrabber = appGrabber; _applicationUpdateService = applicationUpdateService; _cairoApplication = cairoApplication; _shellManager = shellManagerService.ShellManager; _themeService = themeService; _uiService = uiService; loadThemes(); loadLanguages(); loadRadioGroups(); loadCategories(); loadDesktopBackgroundSettings(); loadHotKeys(); loadLoggingLevels(); loadNotficationSettings(); loadVersionDependentSettings(); checkUpdateConfig(); checkTrayStatus(); checkRunAtLogOn(); checkIfCanHibernate(); }
public ModuleController( Lazy <ShellService> shellService, IEnvironmentService environmentService, ISettingsProvider settingsProvider, ISharedCookieService cookieService, Lazy <ManagerController> managerController, Lazy <QueueController> queueController, Lazy <DetailsController> detailsController, Lazy <CrawlerController> crawlerController, Lazy <ShellViewModel> shellViewModel, IApplicationUpdateService applicationUpdateService, ILogService logService, Lazy <IMessageService> messageService) { _shellService = shellService; _environmentService = environmentService; _settingsProvider = settingsProvider; _cookieService = cookieService; _detailsController = detailsController; _managerController = managerController; _queueController = queueController; _crawlerController = crawlerController; _shellViewModel = shellViewModel; _queueManager = new QueueManager(); _applicationUpdateService = applicationUpdateService; _logService = logService; _messageService = messageService; }
public ApplicationStartupViewModel(IRepository repository, IApplicationUpdateService updateService, IViewModelFactory viewModelFactory, IDialogService dialogService) { _updateService = updateService; _viewModelFactory = viewModelFactory; _dialogService = dialogService; _repository = repository; }
public ShellViewModel(IShellView view, IShellService shellService, ISyncService syncStartService, IGuiInteractionService guiInteractionService, Settings settings, SyncSummary syncSummary, IMessageService messageService, ApplicationLogger applicationLogger, IApplicationUpdateService applicationUpdateService, SystemTrayNotifierViewModel systemTrayNotifierViewModel, ChildContentViewFactory childContentViewFactory) : base(view) { _statusBuilder = new StringBuilder(); MessageService = messageService; ApplicationLogger = applicationLogger; Logger = applicationLogger.GetLogger(GetType()); ApplicationUpdateService = applicationUpdateService; ShellService = shellService; SyncStartService = syncStartService; GuiInteractionService = guiInteractionService; Settings = settings; SyncSummary = syncSummary; SystemTrayNotifierViewModel = systemTrayNotifierViewModel; ChildContentViewFactory = childContentViewFactory; view.Closing += ViewClosing; view.Closed += ViewClosed; }
public void CheckForUpdateOnStartup(IApplicationUpdateService service, ApplicationUpdatePresenterFactory presenterFactory) { if (Preferences.Get <bool>(Preference.StartupCheckForUpdate)) { CheckForUpdateInternal(service, presenterFactory); } }
//private static LowLevelKeyboardListener keyboardListener; // temporarily removed due to stuck key issue, commented out to prevent warnings public MenuBar(ICairoApplication cairoApplication, ShellManager shellManager, WindowManager windowManager, AppGrabberService appGrabber, IApplicationUpdateService applicationUpdateService, ISettingsUIService settingsUiService, AppBarScreen screen, AppBarEdge edge) : base(cairoApplication, shellManager, windowManager, screen, edge, 23) { _appGrabber = appGrabber; _applicationUpdateService = applicationUpdateService; _settingsUiService = settingsUiService; object menuBarWindowAllowsTransparencyResource = CairoApplication.Current.Resources["MenuBarWindowAllowsTransparency"]; if (menuBarWindowAllowsTransparencyResource is bool resourceValue) { AllowsTransparency = resourceValue; } InitializeComponent(); RequiresScreenEdge = true; SetPosition(); setupChildren(); setupMenu(); setupCairoMenu(); setupPlacesMenu(); Settings.Instance.PropertyChanged += Settings_PropertyChanged; }
public ModuleController( Lazy <ShellService> shellService, IEnvironmentService environmentService, IConfirmTumblrPrivacyConsent confirmTumblrPrivacyConsent, ISettingsProvider settingsProvider, ISharedCookieService cookieService, Lazy <ManagerController> managerController, Lazy <QueueController> queueController, Lazy <DetailsController> detailsController, Lazy <CrawlerController> crawlerController, Lazy <ShellViewModel> shellViewModel, IApplicationUpdateService applicationUpdateService) { _shellService = shellService; _environmentService = environmentService; _confirmTumblrPrivacyConsent = confirmTumblrPrivacyConsent; _settingsProvider = settingsProvider; _cookieService = cookieService; _detailsController = detailsController; _managerController = managerController; _queueController = queueController; _crawlerController = crawlerController; _shellViewModel = shellViewModel; _queueManager = new QueueManager(); _applicationUpdateService = applicationUpdateService; }
public AboutViewModel(IAboutView aboutView, IApplicationUpdateService applicationUpdateService, ApplicationLogger applicationLogger) : base(aboutView) { ApplicationLogger = applicationLogger.GetLogger(GetType()); _applicationUpdateService = applicationUpdateService; ProductVersion = ApplicationInfo.Version; }
public FeedbackViewModel(IFeedbackView view, IShellService shellService, IApplicationUpdateService applicationUpdateService, IMessageService messageService) : base(view) { ShellService = shellService; _sendCommand = new AsyncDelegateCommand(Send); _applicationUpdateService = applicationUpdateService; _messageService = messageService; }
public AboutViewModel(IAboutView view, IApplicationUpdateService applicationUpdateService) : base(view) { _showWebsiteCommand = new DelegateCommand(ShowWebsite); _checkForUpdatesCommand = new AsyncDelegateCommand(CheckForUpdates); _downloadCommand = new DelegateCommand(DownloadNewVersion); _applicationUpdateService = applicationUpdateService; }
public SettingsUIService(ICairoApplication cairoApplication, IAppGrabber appGrabber, IApplicationUpdateService updateService, ShellManagerService shellManager, IThemeService themeService) { _appGrabber = appGrabber; _cairoApplication = cairoApplication; _shellManager = shellManager; _themeService = themeService; _updateService = updateService; }
public MenuBarWindowService(ICairoApplication cairoApplication, ShellManagerService shellManagerService, WindowManager windowManager, AppGrabberService appGrabber, IApplicationUpdateService updateService, ISettingsUIService settingsUiService) : base(cairoApplication, shellManagerService, windowManager) { _appGrabber = appGrabber; _settingsUiService = settingsUiService; _updateService = updateService; EnableMultiMon = Settings.Instance.EnableMenuBarMultiMon; EnableService = Settings.Instance.EnableMenuBar; }
public AboutViewModel(IAboutView view, IApplicationUpdateService applicationUpdateService, ExportFactory <FeedbackViewModel> feedbackViewModelFactory) : base(view) { _showWebsiteCommand = new DelegateCommand(ShowWebsite); _checkForUpdatesCommand = new AsyncDelegateCommand(CheckForUpdates); _downloadCommand = new DelegateCommand(DownloadNewVersion); _feedbackCommand = new DelegateCommand(Feedback); _applicationUpdateService = applicationUpdateService; _feedbackViewModelFactory = feedbackViewModelFactory; }
private void CheckForUpdate(IApplicationUpdateService service, ApplicationUpdatePresenterFactory presenterFactory) { var result = CheckForUpdateInternal(service, presenterFactory); if (result.HasValue && !result.Value) { string text = $"{Core.Application.NameAndVersion} is already up-to-date."; MessageBox.ShowInformation(Form, text, Core.Application.NameAndVersion); } }
//private static LowLevelKeyboardListener keyboardListener; // temporarily removed due to stuck key issue, commented out to prevent warnings public MenuBar(ICairoApplication cairoApplication, ShellManager shellManager, WindowManager windowManager, IApplicationUpdateService applicationUpdateService, System.Windows.Forms.Screen screen, NativeMethods.ABEdge edge) : base(cairoApplication, shellManager, windowManager, screen, edge, 23) { _applicationUpdateService = applicationUpdateService; InitializeComponent(); RequiresScreenEdge = true; SetPosition(); setupChildren(); setupMenu(); setupCairoMenu(); setupPlacesMenu(); Settings.Instance.PropertyChanged += Settings_PropertyChanged; }
private bool?CheckForUpdateInternal(IApplicationUpdateService service, ApplicationUpdatePresenterFactory presenterFactory) { if (!Monitor.TryEnter(_checkForUpdateLock)) { return(null); } try { var uri = new Uri(Properties.Settings.Default.UpdateUrl); var update = service.GetApplicationUpdate(uri); if (update is null) { return(false); } if (!update.VersionIsGreaterThan(Core.Application.VersionNumber)) { return(false); } _applicationUpdateModel = new ApplicationUpdateModel(update); using (var presenter = presenterFactory.Create(_applicationUpdateModel)) { if (presenter.ShowDialog(Form) == DialogResult.OK) { if (_applicationUpdateModel.SelectedUpdateFileIsReadyToBeExecuted) { string text = String.Format(CultureInfo.CurrentCulture, "{0} will install the new version when you exit the application.", Core.Application.Name); MessageBox.ShowInformation(Form, text, Core.Application.NameAndVersion); } } } return(true); } finally { Monitor.Exit(_checkForUpdateLock); } }
private CairoSettingsWindow(ShellManagerService shellManagerService, IApplicationUpdateService applicationUpdateService) { InitializeComponent(); _applicationUpdateService = applicationUpdateService; _shellManager = shellManagerService.ShellManager; loadThemes(); loadLanguages(); loadRadioGroups(); loadCategories(); loadDesktopBackgroundSettings(); loadHotKeys(); loadLoggingLevels(); loadNotficationSettings(); loadVersionDependentSettings(); checkUpdateConfig(); checkTrayStatus(); checkRunAtLogOn(); checkIfCanHibernate(); }
//private static LowLevelKeyboardListener keyboardListener; // temporarily removed due to stuck key issue, commented out to prevent warnings public MenuBar(ICairoApplication cairoApplication, ShellManager shellManager, WindowManager windowManager, AppGrabberService appGrabber, IApplicationUpdateService applicationUpdateService, ISettingsUIService settingsUiService, AppBarScreen screen, AppBarEdge edge) : base(cairoApplication, shellManager, windowManager, screen, edge, 23) { _appGrabber = appGrabber; _applicationUpdateService = applicationUpdateService; _settingsUiService = settingsUiService; InitializeComponent(); RequiresScreenEdge = true; SetPosition(); setupChildren(); setupMenu(); setupCairoMenu(); setupPlacesMenu(); Settings.Instance.PropertyChanged += Settings_PropertyChanged; }
//#if DEBUG //RefWatcher? _refWatcher; //void SetupLeakCanary() //{ // // “A small leak will sink a great ship.” - Benjamin Franklin // if (LeakCanaryXamarin.IsInAnalyzerProcess(this)) // { // // This process is dedicated to LeakCanary for heap analysis. // // You should not init your app in this process. // return; // } // _refWatcher = LeakCanaryXamarin.Install(this); //} //#endif public override void OnCreate() { base.OnCreate(); //#if DEBUG // //SetupLeakCanary(); //#endif var stopwatch = Stopwatch.StartNew(); var startTrace = new StringBuilder(); FileSystem2.InitFileSystem(); stopwatch.Stop(); startTrace.AppendFormatLine("init FileSystem {0}ms", stopwatch.ElapsedMilliseconds); stopwatch.Restart(); IApplication.InitLogDir(); stopwatch.Stop(); startTrace.AppendFormatLine("init NLog {0}ms", stopwatch.ElapsedMilliseconds); stopwatch.Restart(); Startup.InitGlobalExceptionHandler(); stopwatch.Stop(); startTrace.AppendFormatLine("init ExceptionHandler {0}ms", stopwatch.ElapsedMilliseconds); stopwatch.Restart(); VisualStudioAppCenterSDK.Init(); stopwatch.Stop(); startTrace.AppendFormatLine("init AppCenter {0}ms", stopwatch.ElapsedMilliseconds); stopwatch.Restart(); XEFileProvider.TemporaryLocation = FileProviderLocation.Internal; XEPlatform.Init(this); // 初始化 Xamarin.Essentials.Platform.Init XEPlatform.ActivityStateChanged += OnActivityStateChanged; stopwatch.Stop(); startTrace.AppendFormatLine("init Essentials {0}ms", stopwatch.ElapsedMilliseconds); stopwatch.Restart(); bool GetIsMainProcess() { // 注意:进程名可以自定义,默认是包名,如果自定义了主进程名,这里就有误,所以不要自定义主进程名! var name = this.GetCurrentProcessName(); return(name == PackageName); } IsMainProcess = GetIsMainProcess(); stopwatch.Stop(); startTrace.AppendFormatLine("init IsMainProcess {0}ms", stopwatch.ElapsedMilliseconds); stopwatch.Restart(); SettingsHost.Load(); stopwatch.Stop(); startTrace.AppendFormatLine("init SettingsHost {0}ms", stopwatch.ElapsedMilliseconds); stopwatch.Restart(); InitSettingSubscribe(); stopwatch.Stop(); startTrace.AppendFormatLine("init SettingSubscribe {0}ms", stopwatch.ElapsedMilliseconds); stopwatch.Restart(); var level = DILevel.Min; if (IsMainProcess) { level = DILevel.MainProcess; } Startup.Init(level); stopwatch.Stop(); startTrace.AppendFormatLine("init Startup {0}ms", stopwatch.ElapsedMilliseconds); stopwatch.Restart(); if (IsMainProcess) { XEVersionTracking.Track(); stopwatch.Stop(); startTrace.AppendFormatLine("init VersionTracking {0}ms", stopwatch.ElapsedMilliseconds); stopwatch.Restart(); if (XEVersionTracking.IsFirstLaunchForCurrentVersion) { // 当前版本第一次启动时,清除存放升级包缓存文件夹的目录 IApplicationUpdateService.ClearAllPackCacheDir(); stopwatch.Stop(); startTrace.AppendFormatLine("init ClearAllPackCacheDir {0}ms", stopwatch.ElapsedMilliseconds); stopwatch.Restart(); } } UISettings.Language.Subscribe(x => R.ChangeLanguage(x)); stopwatch.Stop(); startTrace.AppendFormatLine("init Language.Subscribe {0}ms", stopwatch.ElapsedMilliseconds); stopwatch.Restart(); Startup.OnStartup(IsMainProcess); stopwatch.Stop(); startTrace.AppendFormatLine("init OnStartup {0}ms", stopwatch.ElapsedMilliseconds); stopwatch.Restart(); if (IsMainProcess) { var vmService = IViewModelManager.Instance; vmService.InitViewModels(); stopwatch.Stop(); startTrace.AppendFormatLine("init ViewModels {0}ms", stopwatch.ElapsedMilliseconds); stopwatch.Restart(); #if __XAMARIN_FORMS__ Forms.Init(this, null); FormsMaterial.Init(this, null); ImageCircleRenderer.Init(); stopwatch.Stop(); startTrace.AppendFormatLine("init XF {0}ms", stopwatch.ElapsedMilliseconds); stopwatch.Restart(); _Current = new(RealTheme); stopwatch.Stop(); startTrace.AppendFormatLine("init XFApp {0}ms", stopwatch.ElapsedMilliseconds); stopwatch.Restart(); #endif vmService.MainWindow.Initialize(); } stopwatch.Stop(); StartupTrack = startTrace.ToString(); #if DEBUG Log.Warn("Application", $"OnCreate Complete({stopwatch.ElapsedMilliseconds}ms"); #endif }
public void CheckForUpdateClick(IApplicationUpdateService service, ApplicationUpdatePresenterFactory presenterFactory) { CheckForUpdate(service, presenterFactory); }