public CommonComponent(ICommonServices services, ICommonCompomentsFactory componentFactory) { Current = this; this.Services = services; this.componentFactory = componentFactory; InitializerProcess.Run(componentFactory); }
protected override bool Start(params object[] parameters) { ICommonCompomentsFactory factory = (ICommonCompomentsFactory)parameters[0]; //if (ran) throw new InvalidOperationException("Initializing only allowed at program start!"); if (ran) { return(false); } ran = true; Config.Initialize(); CommonComponent.Current.Config = Config.Current; StopTransfers.WalkingSpeed = () => PlanSettingsModel.WalkingSpeedInMps; factory.InitializeTools(); InitializeFields(); //StopPicker.LoadItemSource(); //Alkalmazás első indításakor hívódik meg if (AppFields.VersionId == null) { FirstRun = true; } //verzió kezelés, meghívódik verzió váltáskor if (AppFields.VersionId != CommonComponent.Current.Config.Version) { //Reset(); AppFields.VersionId = CommonComponent.Current.Config.Version; AppFields.ForceUpdate = true; AppFields.PlanningTrialExpired = false; factory.StopBackgroundAgent(); } try { //adatbázisok betöltése CommonComponent.Current.UB = factory.CreateUserBase(); //előzmények öregítése, itt csinálom gyorsan, hogy ne legyenek konkurens tranzakciók, amik a model teljes betöltésének a hatására fog indulni DailyTasks.Subscribe(CommonComponent.Current.UB.History.OldenHistory); DailyTasks.DoAll(); //majd a statikus adatbázist is betöltöm CommonComponent.Current.LoadTransitBase(); } catch (Exception ex) { Reset(); throw; } //csempe frissítő BackgroundAgent indítása factory.StartBackgroundAgent(); return(true); }