示例#1
0
        public MainViewModel(
            WelcomeViewModel welcomeViewModel,
            ConnectingViewModel connectingViewModel,
            ContactsViewModel contactsViewModel,
            SettingsViewModel settingsViewModel,
            CoreDispatcher uiDispatcher) : base(uiDispatcher)
        {
            WelcomeViewModel = welcomeViewModel;
            ConnectingViewModel = connectingViewModel;
            ContactsViewModel = contactsViewModel;
            SettingsViewModel = settingsViewModel;

            WelcomeViewModel.OnCompleted += WelcomeCompleted;
            ConnectingViewModel.OnRegistered += ConnectingViewModel_OnRegistered;
            ConnectingViewModel.OnRegistrationFailed += ConnectingViewModel_OnRegistrationFailed;
            ShowSettingsCommand = new DelegateCommand(() => IsSettingsVisible = true);

            WelcomeViewModel.OnShowSettings += () => IsSettingsVisible = true;
            ContactsViewModel.OnShowSettings += () => IsSettingsVisible = true;
            ConnectingViewModel.OnShowSettings += () => IsSettingsVisible = true;
            SettingsViewModel.OnClose += SettingsViewModelOnClose;
            SettingsViewModel.OnRegistrationSettingsChanged += RegistrationSettingChanged;
        }        
        public MainViewModel(
            WelcomeViewModel welcomeViewModel,
            ConnectingViewModel connectingViewModel,
            ContactsViewModel contactsViewModel,
            SettingsViewModel settingsViewModel,
            CoreDispatcher uiDispatcher) : base(uiDispatcher)
        {
            WelcomeViewModel    = welcomeViewModel;
            ConnectingViewModel = connectingViewModel;
            ContactsViewModel   = contactsViewModel;
            SettingsViewModel   = settingsViewModel;

            WelcomeViewModel.OnCompleted             += WelcomeCompleted;
            ConnectingViewModel.OnRegistered         += ConnectingViewModel_OnRegistered;
            ConnectingViewModel.OnRegistrationFailed += ConnectingViewModel_OnRegistrationFailed;
            ShowSettingsCommand = new DelegateCommand(() => IsSettingsVisible = true);

            WelcomeViewModel.OnShowSettings    += () => IsSettingsVisible = true;
            ContactsViewModel.OnShowSettings   += () => IsSettingsVisible = true;
            ConnectingViewModel.OnShowSettings += () => IsSettingsVisible = true;
            SettingsViewModel.OnClose          += SettingsViewModelOnClose;
            SettingsViewModel.OnRegistrationSettingsChanged += RegistrationSettingChanged;
        }
 private void WelcomeCompleted()
 {
     ApplicationView.GetForCurrentView().Title = WelcomeViewModel.Name;
     ConnectingViewModel.EstablishConnection();
 }
 private void RegistrationSettingChanged()
 {
     IsActive = false;
     ConnectingViewModel.SwitchSignalingServer();
 }