Exemple #1
0
 public PreferencesViewModel()
 {
     this.RestartApplicationCommand = new RelayCommand(this.RestartApplication);
     this.RequestTokenCommand       = new RelayCommand(() => Process.Start(OAuthHelper.GetAuthorizationUri().ToString()));
     this.Title = $"{App.AppName} - Preferences";
     this.Token = Properties.Settings.Default.Token;
     this.ShowUnreadMentions = Properties.Settings.Default.ShowUnreadMentions;
     this.ShowUnreadMessages = Properties.Settings.Default.ShowUnreadMessages;
     this.ShowStatus         = Properties.Settings.Default.ShowStatus;
 }
Exemple #2
0
        public static void Main(string[] args)
        {
            commandLineOptions = ParseCommandLine(args);
            if (commandLineOptions != null)
            {
                if (commandLineOptions.RequestToken)
                {
                    logger.Warn("Please visit following uri to retrieve your Slack token");
                    logger.Warn(OAuthHelper.GetAuthorizationUri());
                }
                else
                {
                    luxa4Slack = new Luxa4Slack(
                        commandLineOptions.Token,
                        commandLineOptions.ShowUnreadMentions,
                        commandLineOptions.ShowUnreadMessages,
                        commandLineOptions.ShowStatus);

                    try
                    {
                        luxa4Slack.Initialize();
                        luxa4Slack.LuxaforFailure += OnLuxaforFailure;

                        Console.ReadLine();
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex);
                    }
                    finally
                    {
                        luxa4Slack.Dispose();
                    }
                }
            }
        }
        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();
        }