public void Initialize() { NotifyHost.TryInitialize(this); Settings.Default.Reload(); _viewModel = new ToolViewModel(); }
/// <summary> /// Constructor /// </summary> /// <param name="hostControl">The UserControl constructing us</param> public PrintHelper(UserControl hostControl, NotifyHost hostStatusHandler = null, NotifyHost hostErrorHandler = null) { this.hostControl = hostControl; this.HostStatusMsgHandler = hostStatusHandler; this.HostErrorMsgHandler = hostErrorHandler; printPreviewPages = new List <UIElement>(); }
public FlipViewPagePrintHelper(UserControl hostControl, NotifyHost hostStatusHandler = null, NotifyHost hostErrorHandler = null) : base(hostControl, hostStatusHandler, hostErrorHandler) { photoSize = PhotoSize.SizeFullPage; photoScale = Scaling.ShrinkToFit; }
public void SetHomeport(Homeport homeport) { this.homeport = homeport; if (homeport == null) { return; } notifyHost = new NotifyHost(homeport); Action UpdateInfo = () => { var shipsMax = homeport.Admiral?.MaxShipCount ?? 0; var ships = homeport.Organization?.Ships.Count(x => x.Value != null) ?? 0; var slotMax = homeport.Admiral?.MaxSlotItemCount ?? 0; var slots = homeport.Itemyard?.SlotItemsCount; if (labelShipCount.InvokeRequired) { labelShipCount.Invoke(() => labelShipCount.Text = $"소속칸무스: {ships}/{shipsMax}"); labelSlotitemCount.Invoke(() => labelSlotitemCount.Text = $"보유장비: {slots}/{slotMax}"); } else { labelShipCount.Text = $"소속칸무스: {ships}/{shipsMax}"; labelSlotitemCount.Text = $"보유장비: {slots}/{slotMax}"; } }; // Resources homeport.PropertyEvent(nameof(homeport.Materials), () => { AttachResources(homeport.Materials); homeport.Materials.PropertyEvent(nameof(homeport.Materials.Fuel), () => this.UpdateResources(homeport.Materials)); homeport.Materials.PropertyEvent(nameof(homeport.Materials.Ammo), () => this.UpdateResources(homeport.Materials)); homeport.Materials.PropertyEvent(nameof(homeport.Materials.Steel), () => this.UpdateResources(homeport.Materials)); homeport.Materials.PropertyEvent(nameof(homeport.Materials.Bauxite), () => this.UpdateResources(homeport.Materials)); homeport.Materials.PropertyEvent(nameof(homeport.Materials.RepairBuckets), () => this.UpdateResources(homeport.Materials)); homeport.Materials.PropertyEvent(nameof(homeport.Materials.BuildMaterials), () => this.UpdateResources(homeport.Materials)); homeport.Materials.PropertyEvent(nameof(homeport.Materials.DevMaterials), () => this.UpdateResources(homeport.Materials)); homeport.Materials.PropertyEvent(nameof(homeport.Materials.ImproveMaterials), () => this.UpdateResources(homeport.Materials)); this.UpdateResources(homeport.Materials); }, true); // Fleets & Expedition homeport.Organization.PropertyEvent(nameof(homeport.Organization.Fleets), () => { homeport.Admiral.PropertyEvent(nameof(homeport.Organization.Ships), () => UpdateInfo(), true); var fleets = homeport.Organization.Fleets.Select(x => x.Value); foreach (var fleet in fleets) { UpdateFleetState(fleet); if (fleet != null) { fleet.Expedition.PropertyEvent(nameof(fleet.Expedition.Id), () => UpdateFleetState(fleet)); fleet.Expedition.PropertyEvent(nameof(fleet.Expedition.Remaining), () => UpdateFleetState(fleet)); fleet.State.Condition.PropertyEvent(nameof(fleet.State.Condition.Remaining), () => UpdateFleetState(fleet)); fleet.State.Updated += (s, e) => UpdateFleetState(fleet); } } }, true); // NDock homeport.Repairyard.PropertyEvent(nameof(homeport.Repairyard.Docks), () => { var nDocks = homeport.Repairyard.Docks.Select(x => x.Value); foreach (var dock in nDocks) { dock.PropertyEvent(nameof(dock.Ship), () => UpdateNDock(dock)); dock.PropertyEvent(nameof(dock.Remaining), () => UpdateNDock(dock)); UpdateNDock(dock); } }, true); // KDock homeport.Dockyard.PropertyEvent(nameof(homeport.Dockyard.Docks), () => { var kDocks = homeport.Dockyard.Docks.Select(x => x.Value); foreach (var dock in kDocks) { dock.PropertyEvent(nameof(dock.Ship), () => UpdateKDock(dock)); dock.PropertyEvent(nameof(dock.Remaining), () => UpdateKDock(dock)); UpdateKDock(dock); } }, true); // Quests homeport.Quests.PropertyEvent(nameof(homeport.Quests.Current), () => { if (homeport.Quests.All.Count == 0) { return; } UpdateQuests(homeport.Quests.Current); }, true); // Admiral homeport.PropertyEvent(nameof(homeport.Admiral), () => { this.UpdateHQRecord(this.homeport.Admiral); UpdateInfo(); }, true); // Itemyard homeport.PropertyEvent(nameof(homeport.Itemyard), () => { homeport.Itemyard.PropertyEvent(nameof(homeport.Itemyard.SlotItemsCount), () => UpdateInfo()); }); catalogCalculator?.SetHomeport(this.homeport); catalogShips?.SetHomeport(this.homeport); UpdateInfo(); }