Example #1
0
 public MainWindow(IControllerFactory controllerFactory,
                   ITwitterAuthenticator twitterAuthenticator, IGlobalVariables globalVariables, SettingsViewModel settingsViewModel)
 {
     _controllerFactory = controllerFactory;
     InitializeComponent();
     DataContext = new MainViewModel(controllerFactory, twitterAuthenticator, globalVariables, settingsViewModel);
 }
Example #2
0
        public MainViewModel(IControllerFactory controllerFactory,
                             ITwitterAuthenticator twitterAuthenticator, IGlobalVariables globalVariables, SettingsViewModel settingsViewModel)
        {
            GlobalVariables  = globalVariables;
            _raidsController = controllerFactory.GetRaidsController;
            _tweetObserver   = controllerFactory.GetTweetObserver;
            var settingsController = controllerFactory.GetSettingsController;

            _blacklistController  = controllerFactory.GetBlacklistController;
            _controllerFactory    = controllerFactory;
            _twitterAuthenticator = twitterAuthenticator;
            Follows             = _raidsController.Follows;
            SettingsDataContext = settingsViewModel;
            RaidListCtx         = new RaidListViewModel(controllerFactory);
            RaidBosses          =
                new ReadOnlyObservableCollection <RaidListItem>(
                    controllerFactory.GetRaidlistController.RaidBossListItems);
            Settings          = settingsController.Settings;
            RemoveCommand     = new ActionCommand(r => Remove((string)r));
            StartLoginCommand = new ActionCommand(async() => await Startup());
            AddNewRaidCommand =
                new ActionCommand(async() => await DialogHost.Show(new AddRaidDialog(controllerFactory
                                                                                     .GetRaidlistController.RaidBossListItems)));
            ChangeViewCommand = new ActionCommand(i => ChangeView((string)i));

            _tweetObserver.SetAddAction(AddTweet);
            CheckUpdate();
            Id = UniqueId.Create();
            if (settingsController.Settings.Autologin &&
                !string.IsNullOrWhiteSpace(settingsController.Settings.AccessToken) &&
                !string.IsNullOrWhiteSpace(settingsController.Settings.AccessTokenSecret))
            {
                Startup().ConfigureAwait(false);
            }
            //Console.WriteLine(new List<string>()[4]);
        }