Esempio n. 1
0
        public SettingsViewModel(
            IAppNotificationService appNotificationService,
            GraphService graphService)
        {
            BackupDbCommand  = new AsyncRelayCommand(BackupDb, () => true);
            RestoreDbCommand = new AsyncRelayCommand(RestoreDb, () => true);
            SignOutCommand   = new AsyncRelayCommand(SignOut, () => IsSignoutEnabled);

            _appNotificationService = appNotificationService;
            _graphService           = graphService;

            // Context to the original thread of the calling code (i.e., UI thread)
            _syncContext = SynchronizationContext.Current;
            _graphService.AuthenticationProvider.SynchronizationContext = _syncContext;


            if (App.CurrentUser != null)
            {
                WelcomeText      = "Welcome " + App.CurrentUser.GivenName;
                IsSignoutEnabled = true;
            }
            else
            {
                WelcomeText      = "Welcome, please select an option below and sign in when prompted";
                IsSignoutEnabled = false;
            }
        }
Esempio n. 2
0
 private static async void StartupKgs(IGameSettings settings, IAppNotificationService notifications)
 {
     if (settings.Interface.KgsAutoLogin && settings.Interface.KgsRememberPassword)
     {
         await Connections.Kgs.LoginAsync(settings.Interface.KgsName, settings.Interface.KgsPassword);
     }
 }
Esempio n. 3
0
        /// <summary>
        ///  Initializes boards and tasks.
        ///  Sorts the tasks by column index so that they are
        ///  loaded in as they were left when the app was last closed.
        /// </summary>
        public MainViewModel(
            Func <PresentationBoard, IAppNotificationService, BoardViewModel> boardViewModelFactory,
            IAdaptiveClient <IServiceManifest> dataProvider,
            INavigationService navigationService,
            IAppNotificationService appNotificationService,
            IDialogService dialogService)
        {
            this.boardViewModelFactory   = boardViewModelFactory;
            this.dataProvider            = dataProvider;
            this._navigationService      = navigationService;
            this._appNotificationService = appNotificationService;
            this._dialogService          = dialogService;

            PropertyChanged       += MainViewModel_PropertyChanged;
            NewBoardCommand        = new Base.RelayCommand(NewBoard, () => true);
            EditBoardCommand       = new Base.RelayCommand(EditBoard, () => CurrentBoard != null);
            SaveBoardCommand       = new Base.RelayCommand(SaveBoard, () => true);
            CancelSaveBoardCommand = new Base.RelayCommand(CancelSaveBoard, () => true);
            DeleteBoardCommand     = new Base.RelayCommand(DeleteBoard, () => CurrentBoard != null);
            OpenSettingsCommand    = new AsyncRelayCommand(OpenSettingsDialog, () => true);
            OpenCalendarCommand    = new AsyncRelayCommand(OpenCalendarDialog, () => true);
            OpenBoardListCommand   = new AsyncRelayCommand(OpenBoardListDialog, () => true);

            InitializeBoards();
        }
Esempio n. 4
0
        private static async void StartupIgs(IGameSettings settings, IAppNotificationService notifications)
        {
            if (settings.Interface.IgsAutoLogin && settings.Interface.IgsRememberPassword)
            {
                if (await Connections.Igs.ConnectAsync())
                {
                    var success = await Connections.Igs.LoginAsync(settings.Interface.IgsName, settings.Interface.IgsPassword);

                    if (!success)
                    {
                        notifications.TriggerNotification(new BubbleNotification("IGS auto-login failed.", "Pandanet", NotificationType.Error));
                    }
                }
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Initializes the commands and tasks for the current board.
        /// </summary>
        public BoardViewModel(
            PresentationBoard board,
            IAdaptiveClient <IServiceManifest> dataProvider,
            IAppNotificationService appNotificationService,
            IToastService toastService)
        {
            Board                   = board;
            DataProvider            = dataProvider;
            _appNotificationService = appNotificationService;
            _toastService           = toastService;

            CurrentTask         = new PresentationTask(new TaskDTO());
            NewTaskCommand      = new RelayCommand <ColumnTag>(NewTask, () => true);
            EditTaskCommand     = new RelayCommand <int>(EditTask, () => true);
            SaveTaskCommand     = new RelayCommand(SaveTask, () => true);
            DeleteTaskCommand   = new RelayCommand <int>(DeleteTask, () => PaneTitle.Equals("Edit Task") || PaneTitle.Equals(""));
            DeleteTagCommand    = new RelayCommand <string>(DeleteTag, () => true);
            CancelEditCommand   = new RelayCommand(CancelEdit, () => true);
            UpdateColumnCommand = new RelayCommand <string>(UpdateColumn, () => true);

            Columns = new ObservableCollection <PresentationColumn>();

            ColorKeys = new ObservableCollection <string>
            {
                "Low", "Medium", "High"
            };

            ReminderTimes = new ObservableCollection <string>
            {
                "None",
                "At Time of Due Date",
                "5 Minutes Before",
                "10 Minutes Before",
                "15 Minutes Before",
                "1 Hour Before",
                "2 Hours Before",
                "1 Day Before",
                "2 Days Before"
            };

            PaneTitle = "New Task";

            //ConfigureBoardColumns();
        }
Esempio n. 6
0
 /// <summary>
 /// Creates the quest points manager
 /// </summary>
 /// <param name="gameSettings">Game settings</param>
 /// <param name="appNotificationService">Notification service</param>
 /// <param name="localizationService">Localization service</param>
 public QuestsManager(IGameSettings gameSettings, IAppNotificationService appNotificationService, ILocalizationService localizationService)
 {
     _gameSettings           = gameSettings;
     _appNotificationService = appNotificationService;
     _localizer = (Localizer)localizationService;
 }
Esempio n. 7
0
 /// <summary>
 /// Returns the current instance of MainViewModel.
 /// </summary>
 /// <param name="frame"></param>
 /// <param name="appNotificationService"></param>
 /// <param name="dialogService"></param>
 /// <returns></returns>
 public static MainViewModel GetViewModel(INavigationService navigationService, IAppNotificationService appNotificationService, IDialogService dialogService)
 {
     return(container.Resolve <MainViewModel>(
                new TypedParameter(typeof(INavigationService), navigationService),
                new TypedParameter(typeof(IAppNotificationService), appNotificationService),
                new TypedParameter(typeof(IDialogService), dialogService)));
 }