Esempio n. 1
0
        private void ModifyTimeZone()
        {
            try
            {
                if (SelectedTimeZoneViewModel == null)
                {
                    Messenger.Default.Send(new NotificationMessage("请先选择时间区!"), Tokens.TimeZonePage_ShowNotification);
                    return;
                }

                var viewModel = new TimeZoneViewModel(SelectedTimeZoneViewModel.CurrentTimeZone);

                Messenger.Default.Send(new OpenWindowMessage()
                {
                    DataContext = viewModel
                }, Tokens.OpenTimeZoneView);
                if (viewModel.ViewModelAttachment.LastOperationSuccess)
                {
                    var index = TimeZoneViewModels.IndexOf(SelectedTimeZoneViewModel);
                    TimeZoneViewModels[index] = viewModel;
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex);
            }
        }
Esempio n. 2
0
        private void AddTimeZone()
        {
            try
            {
                var timeZoneViewModel = new TimeZoneViewModel(new Model.TimeZone());

                Messenger.Default.Send(new OpenWindowMessage()
                {
                    DataContext = timeZoneViewModel
                }, Tokens.OpenTimeZoneView);
                if (timeZoneViewModel.ViewModelAttachment.LastOperationSuccess)
                {
                    TimeZoneViewModels.Add(new TimeZoneViewModel((timeZoneViewModel.ViewModelAttachment.CoreModel)));
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex);
            }
        }
Esempio n. 3
0
        private void ConfirmDeleteTimeZone()
        {
            DispatcherHelper.CheckBeginInvokeOnUI(() =>
            {
                string message = "";
                try
                {
                    _timeZoneRepo.Delete(SelectedTimeZoneViewModel.CurrentTimeZone.TimeZoneID);
                    message = "删除时间区成功!";

                    TimeZoneViewModels.Remove(SelectedTimeZoneViewModel);
                }
                catch (Exception ex)
                {
                    Log.Error(ex);
                    message = "删除时间区失败!";
                }
                Messenger.Default.Send(new NotificationMessage(message), Tokens.TimeZonePage_ShowNotification);
            });
        }