public BuildingDockViewModel(BuildingDock source)
        {
            this.source = source;
            this.CompositeDisposable.Add(new PropertyChangedEventListener(source, (sender, args) => this.RaisePropertyChanged(args.PropertyName)));

            if (Toast.IsSupported)
            {
                source.Completed += (sender, args) =>
                {
                    if (this.IsNotifyCompleted)
                    {
                        Toast.Show(
                            "Building Dock",
                            string.Format("Construction of {1} in dock {0} is complete.", this.Id, this.CanDisplayShipName ? "" + this.Ship + "" : "ship"),
                            () => App.ViewModelRoot.Activate());
                    }
                };
            }
            else
            {
                source.Completed += (sender, args) =>
                {
                    if (this.IsNotifyCompleted)
                    {
                        NotifyIconWrapper.Show(
                            "Building Dock",
                            string.Format("Construction of {1} in dock {0} is complete.", this.Id, this.CanDisplayShipName ? "" + this.Ship + "" : "ship"));
                    }
                };
            }
        }
Example #2
0
 public void SetBuildCompletion(BuildingDock dock, DateTimeOffset?timeStamp)
 {
     SelectedNotifier.RemoveSchedule("Build" + dock.Id);
     if (dock.BuiltShip != null && timeStamp is DateTimeOffset t)
     {
         SelectedNotifier.AddSchedule("Build" + dock.Id,
                                      localization.GetLocalized("Notification", "Build_Title"),
                                      string.Format(localization.GetLocalized("Notification", "Build_Content"),
                                                    dock.Id, TryTranslate(dock.BuiltShip?.Name.FullName)), t);
     }
 }
Example #3
0
        private void UpdateKDock(BuildingDock dock)
        {
            Action <int, string, string> UpdateDisplay = (idx, name, time) =>
            {
                var cell = tableBuild.TableCells[idx - 1];
                cell.Header  = name;
                cell.Value   = time;
                cell.Visible = time != null;
                if (time == "" || time == "--:--:--")
                {
                    cell.ForeColor = Color.Gray;
                }
                else
                {
                    cell.ForeColor = Color.White;
                }

                tableBuild.RequestUpdate();
            };

            switch (dock.State)
            {
            case BuildingDockState.Locked:
                UpdateDisplay(dock.Id, "", null);
                break;

            case BuildingDockState.Unlocked:
                UpdateDisplay(dock.Id, "", "--:--:--");
                break;

            case BuildingDockState.Building:
                var time      = dock.Remaining;
                var remaining = time.HasValue
                                                ? $"{(int)time.Value.TotalHours:D2}:{time.Value.ToString(@"mm\:ss")}"
                                                : "--:--:--";
                UpdateDisplay(dock.Id, dock.Ship.Name, remaining);
                break;

            case BuildingDockState.Completed:
                UpdateDisplay(dock.Id, dock.Ship.Name, "완료");
                break;
            }
        }
        public BuildingDockViewModel(BuildingDock source)
        {
            this.source = source;
            this.CompositeDisposable.Add(new PropertyChangedEventListener(source, (sender, args) => this.RaisePropertyChanged(args.PropertyName)));

            source.Completed += (sender, args) =>
            {
                if (this.IsNotifyCompleted)
                {
                    WindowsNotification.Notifier.Show(
                        Resources.Dockyard_NotificationMessage_Title,
                        string.Format(
                            Resources.Dockyard_NotificationMessage,
                            this.Id,
                            this.CanDisplayShipName ? this.Ship : Resources.Common_ShipGirl),
                        () => App.ViewModelRoot.Activate());
                }
            };
        }
Example #5
0
        public BuildingDockViewModel(BuildingDock source)
        {
            this.source = source;
            this.CompositeDisposable.Add(new PropertyChangedEventListener(source, (sender, args) => this.RaisePropertyChanged(args.PropertyName)));

            if (Helper.IsWindows8OrGreater)
            {
                source.Completed += (sender, args) =>
                {
                    if (this.IsNotifyCompleted)
                    {
                        Toast.Show(
                            "建造完了",
                            string.Format("工廠第 {0} ドックでの{1}の建造が完了しました。", this.Id, this.CanDisplayShipName ? "「" + this.Ship + "」" : "艦娘"),
                            () => this.Messenger.Raise(new WindowActionMessage(WindowAction.Active, "Window/Activate")));
                    }
                };
            }
        }
 public BuildingDockViewModel(BuildingDock source)
 {
     this.source = source;
     this.CompositeDisposable.Add(new PropertyChangedEventListener(source, (sender, args) => this.RaisePropertyChanged(args.PropertyName)));
 }