Пример #1
0
        public PreferencesViewModel(IWritableOptions <ApplicationOptions> options, ApplicationInfo applicationInfo, IMessenger messenger, ILuxaforClient luxaforClient)
            : base(messenger)
        {
            _options = options;
            Title    = applicationInfo.Format("Preferences");
            Tokens   = new ObservableCollection <SlackToken>();

            UpdatePreferencesCommand = new RelayCommand(() =>
            {
                SaveSettings();
                CloseCommand?.Execute(null);
            });
            CloseCommand        = new RelayCommand(() => Messenger.Send(new CloseWindowMessage()));
            RequestTokenCommand = new RelayCommand(() => Process.Start(new ProcessStartInfo(OAuthHelper.GetAuthorizationUri().ToString())
            {
                UseShellExecute = true
            }));
            RemoveTokenCommand = new RelayCommand <SlackToken>(x => Tokens.Remove(x !));
            AddTokenCommand    = new RelayCommand(() => AddToken());

            _luxaforClient = luxaforClient;

            LoadSettings();
        }