public RepairingDockViewModel(RepairingDock 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(
                            "Repair Dock",
                            string.Format("Dock {0} has finished repairing {1}", this.Id, this.Ship),
                            () => App.ViewModelRoot.Activate());
                    }
                };
            }
            else
            {
                source.Completed += (sender, args) =>
                {
                    if (this.IsNotifyCompleted)
                    {
                        NotifyIconWrapper.Show(
                            "Repair Dock",
                            string.Format("Dock {0} has finished repairing {1}", this.Id, this.Ship));
                    }
                };
            }
        }
Example #2
0
 public void SetRepairCompletion(RepairingDock dock, DateTimeOffset?timeStamp)
 {
     SelectedNotifier.RemoveSchedule("Repair" + dock.Id);
     if (dock.RepairingShip != null && timeStamp is DateTimeOffset t)
     {
         SelectedNotifier.AddSchedule("Repair" + dock.Id,
                                      localization.GetLocalized("Notification", "Repair_Title"),
                                      string.Format(localization.GetLocalized("Notification", "Repair_Content"),
                                                    dock.Id, TryTranslate(dock.RepairingShip.Info?.Name.FullName)), t - TimeSpan.FromMinutes(1));
     }
 }
Example #3
0
        public RepairingDockViewModel(RepairingDock 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.Repairyard_NotificationMessage_Title,
                        string.Format(Resources.Repairyard_NotificationMessage, this.Id, this.Ship),
                        () => App.ViewModelRoot.Activate());
                }
            };
        }
        public RepairingDockViewModel(RepairingDock 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.Ship),
                            () => this.Messenger.Raise(new WindowActionMessage(WindowAction.Active, "Window/Activate")));
                    }
                };
            }
        }
Example #5
0
        private void UpdateNDock(RepairingDock dock)
        {
            Action <int, string, string> UpdateDisplay = (idx, name, time) =>
            {
                var cell = tableRepair.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;
                }

                tableRepair.RequestUpdate();
            };

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

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

            case RepairingDockState.Repairing:
                var time      = dock.Remaining;
                var remaining = time.HasValue
                                                ? $"{(int)time.Value.TotalHours:D2}:{time.Value.ToString(@"mm\:ss")}"
                                                : "--:--:--";
                UpdateDisplay(dock.Id, dock.Ship.LvName, remaining);
                break;
            }
        }
 public RepairingDockViewModel(RepairingDock source)
 {
     this.source = source;
     this.CompositeDisposable.Add(new PropertyChangedEventListener(source, (sender, args) => this.RaisePropertyChanged(args.PropertyName)));
 }