public ShellViewModel( IProjectData projectData, IBusy busy, IMenuViewModel menu, IFullJournalViewModel fullJournal, IAccountJournalViewModel accountJournal, IAccountsViewModel accounts, IApplicationUpdate applicationUpdate) { this.ProjectData = projectData; this.Busy = busy; this.Menu = menu; this.FullJournal = fullJournal; this.AccountJournal = accountJournal; this.Accounts = accounts; this.applicationUpdate = applicationUpdate; this.version = this.GetType().GetInformationalVersion(); // TODO SVM is too much responsible this.ProjectData.DataLoaded += (sender, args) => { this.Accounts.OnDataLoaded(); this.Menu.OnDataLoaded(); }; this.ProjectData.YearChanged += (_, __) => { this.UpdateDisplayName(); this.FullJournal.Rebuild(); this.Accounts.SelectFirstAccount(); }; this.ProjectData.JournalChanged += (_, args) => { this.FullJournal.Rebuild(); this.FullJournal.Select(args.ChangedBookingId); if (this.Accounts.SelectedAccount == null || !args.AffectedAccounts.Contains(this.Accounts.SelectedAccount.Identifier)) { return; } this.AccountJournal.Rebuild(this.Accounts.SelectedAccount.Identifier); this.AccountJournal.Select(args.ChangedBookingId); }; this.Accounts.PropertyChanged += (_, args) => { if (args.PropertyName == nameof(this.Accounts.SelectedAccount)) { this.AccountJournal.Rebuild(this.Accounts.SelectedAccount?.Identifier ?? 0); } }; }
private void bgWorker_DoWork(object s, DoWorkEventArgs e) { IApplicationUpdate application = (IApplicationUpdate)e.Argument; if (!ApplicationUpdaterXmlHandler.UriExists(application.ApplicationUpdaterXmlLocation)) { e.Cancel = true; } else { e.Result = ApplicationUpdaterXmlHandler.ParseXmlNode(application.ApplicationUpdaterXmlLocation, application.ApplicationID); } }
internal ApplicationUpdaterDetailsForm(IApplicationUpdate applicationUpdaterInfo, ApplicationUpdaterXmlHandler applicationUpdaterXml) { InitializeComponent(); if (applicationUpdaterInfo.ApplicationIcon != null) { this.Icon = applicationUpdaterInfo.ApplicationIcon; } this.Text = applicationUpdaterInfo.ApplicationName + " - Update Info"; this.lblVersions.Text = string.Format("Current Version: {0}\nUpdate Version: {1}", applicationUpdaterInfo.ApplicationAssembly.GetName().Version.ToString(), applicationUpdaterXml.Version.ToString()); this.txtDescription.Text = applicationUpdaterXml.Description; }
public ApplicationUpdater(IApplicationUpdate applicationUpdaterInfo) { this.applicationUpdaterInfo = applicationUpdaterInfo; bgWorker = new BackgroundWorker(); bgWorkerCheckUpdate = new BackgroundWorker(); bgWorkerCheckUpdate.DoWork += bgWorkerCheckUpdate_DoWork; bgWorkerCheckUpdate.RunWorkerCompleted += bgWorkerCheckUpdate_RunWorkerCompleted; if (!bgWorkerCheckUpdate.IsBusy) { bgWorkerCheckUpdate.RunWorkerAsync(this.applicationUpdaterInfo); } bgWorker.DoWork += bgWorker_DoWork; bgWorker.RunWorkerCompleted += bgWorker_RunWorkerCompleted; }
internal ApplicationUpdaterAcceptForm(IApplicationUpdate applicationUpdaterInfo, ApplicationUpdaterXmlHandler applicationUpdaterXml) { InitializeComponent(); this.applicationUpdaterInfo = applicationUpdaterInfo; this.applicationUpdaterXml = applicationUpdaterXml; this.Text = this.applicationUpdaterInfo.ApplicationName + " - Update Available"; if (this.applicationUpdaterInfo.ApplicationIcon != null) { this.Icon = this.applicationUpdaterInfo.ApplicationIcon; } this.lblNewVersion.Text = string.Format("New Version: {0}", this.applicationUpdaterXml.Version.ToString()); }