Exemplo n.º 1
0
        public void Shutdown()
        {
            this.viewDictionary.Clear();

            INewItemViewModel viewModel = ViewHelper.GetViewModel(this.newItemsViewModel.ActiveNewItemView as IView) as INewItemViewModel;

            if (viewModel != null)
            {
                Settings.Default.SelectNewItem = viewModel.Title;
            }
            else
            {
                Settings.Default.SelectNewItem = string.Empty;
            }
        }
Exemplo n.º 2
0
        protected override void OnInitialize()
        {
            this.newItemsViewModel = container.GetExportedValue <NewItemsViewModel>();
            AddWeakEventListener(this.newItemsViewModel, NewItemsViewModelPropertyChanged);

            IAlertAtTimeView     alertAtTimeView      = this.container.GetExportedValue <IAlertAtTimeView>();
            AlertAtTimeViewModel alertAtTimeViewModel = new AlertAtTimeViewModel(alertAtTimeView, this.dataService);

            alertAtTimeView.Title = alertAtTimeViewModel.Title;

            this.newItemsViewModel.NewItemViews.Add(alertAtTimeView);
            this.viewDictionary.Add(alertAtTimeView, alertAtTimeViewModel.NewItem);

            ICountDownAlertView     countDownAlertView      = this.container.GetExportedValue <ICountDownAlertView>();
            CountDownAlertViewModel countDownAlertViewModel = new CountDownAlertViewModel(countDownAlertView, this.dataService);

            countDownAlertView.Title = countDownAlertViewModel.Title;

            this.newItemsViewModel.NewItemViews.Add(countDownAlertView);
            this.viewDictionary.Add(countDownAlertView, countDownAlertViewModel.NewItem);

            this.newItemsViewModel.AddItemCommand = this.addItemCommand;

            if (string.IsNullOrEmpty(Settings.Default.SelectNewItem))
            {
                this.newItemsViewModel.ActiveNewItemView = this.newItemsViewModel.NewItemViews.First();
            }
            else
            {
                foreach (object view in this.newItemsViewModel.NewItemViews)
                {
                    INewItemViewModel viewModel = ViewHelper.GetViewModel(view as IView) as INewItemViewModel;
                    if (viewModel.Title == Settings.Default.SelectNewItem)
                    {
                        this.newItemsViewModel.ActiveNewItemView = view;
                    }
                }
            }
        }