コード例 #1
0
 public MessageBoxService()
 {
     _uiDispatcherService = Container.GetSharedInstance <IUiDispatcherService>();
     _mediator            = MediatorLocator.GetSharedMediator();
     _mediator.Subscribe <ApplicationHiddenEvent>(ignore => _applicationHidden   = true);
     _mediator.Subscribe <ApplicationRestoredEvent>(ignore => _applicationHidden = false);
 }
コード例 #2
0
 private void SubscribeToSwitchViewEvent()
 {
     if (Mediator != null)
     {
         SwitchViewToken = Mediator.Subscribe(ViewModelEvents.SwitchView, (view) => CurrentView = view);
     }
 }
コード例 #3
0
        public ShellView()
        {
            InitializeComponent();
            Container.Initialize(new List <string>()
            {
                "SourceControlMonitor.exe", "Infrastructure.dll", "DataServices.dll"
            });

            this.DataContext            = ViewModelLocator.GetSharedViewModel <IShellViewModel>();
            this.notifyIcon.DataContext = ViewModelLocator.GetSharedViewModel <ITaskBarIconViewModel>();

            _mediator = MediatorLocator.GetSharedMediator();
            _mediator.Subscribe <ShowApplicationEvent>(ignore => OnDoubleClick(null, null));

            this.StateChanged += (s, e) =>
            {
                if (this.WindowState == WindowState.Minimized)
                {
                    _mediator.NotifyColleaguesAsync <ApplicationHiddenEvent>(null);
                    Hide();
                    notifyIcon.Visibility = Visibility.Visible;
                }
                else
                {
                    notifyIcon.HideBalloonTip();
                    notifyIcon.Visibility = Visibility.Collapsed;
                }
            };
        }
コード例 #4
0
        public UglyDisplayViewModel()
        {
            _twitterizerService  = TweetServiceLocator.GetDataService <LinqTweet>();
            _uiDispatcherService = UiDispatcherLocator.GetDispatcher();
            _mediator            = MediatorLocator.GetMediator();
            _mediator.Subscribe(ViewModelEvents.SwitchViewBlocked, ignore =>
            {
                _allowSwitch = false;
                OnSwitchToPretty.RaiseCanExecuteChanged("OnSwitchToPretty");
            });

            _mediator.Subscribe(ViewModelEvents.SwitchViewUnblocked, ignore =>
            {
                _allowSwitch = true;
                OnSwitchToPretty.RaiseCanExecuteChanged("OnSwitchToPretty");
            });
        }