//dependency injection container
        protected override void OnStartup(StartupEventArgs e)
        {
            // dependenies
            FrameSourceService frameSourceService = new FrameSourceService();
            InvokerService     invokerService     = new InvokerService();
            AuthService        authService        = new AuthService();

            // viewModels
            MainViewModel        mainViewModel        = new MainViewModel(frameSourceService, invokerService);
            HomeViewModel        homeViewModel        = new HomeViewModel(frameSourceService, invokerService);
            LoginViewModel       loginViewModel       = new LoginViewModel(frameSourceService, invokerService, authService);
            RegisterViewModel    registerViewModel    = new RegisterViewModel(frameSourceService, invokerService, authService);
            SettingViewModel     settingViewModel     = new SettingViewModel(frameSourceService, invokerService, authService);
            GalleryViewModel     galleryViewModel     = new GalleryViewModel(frameSourceService, invokerService, authService);
            TaskManagerViewModel taskManagerViewModel = new TaskManagerViewModel(frameSourceService, invokerService, authService);
            ManagerPassViewModel managerPassViewModel = new ManagerPassViewModel(frameSourceService, invokerService, authService);

            // singleton
            ViewModelContainer.Init(mainViewModel, homeViewModel, loginViewModel, registerViewModel,
                                    settingViewModel, galleryViewModel, taskManagerViewModel, managerPassViewModel);

            invokerService.Invoke <MainViewModel>(new InitializationViewModel());

            base.OnStartup(e);
        }
Esempio n. 2
0
        public GalleryViewModel(FrameSourceService frameSourceService, InvokerService invokerService, AuthService authService)
        {
            this.frameSourceService = frameSourceService;
            this.invokerService     = invokerService;
            this.authService        = authService;
            this.invokerService.Receive <LoadNeccessaryData>(this, async(data) => LoadPicture());

            CollectionOfPhotos = new ObservableCollection <Gallery>();
        }
Esempio n. 3
0
        public RegisterViewModel(FrameSourceService frameSourceService, InvokerService invokerService, AuthService authService)
        {
            this.frameSourceService = frameSourceService;
            this.invokerService     = invokerService;
            this.authService        = authService;

            Username        = string.Empty;
            Password        = string.Empty;
            ConfirmPassword = string.Empty;
        }
Esempio n. 4
0
        public SettingViewModel(FrameSourceService frameSourceService, InvokerService invokerService, AuthService authService)
        {
            this.frameSourceService = frameSourceService;
            this.invokerService     = invokerService;
            this.authService        = authService;

            Username    = string.Empty;
            Password    = string.Empty;
            oldPassword = string.Empty;
        }
Esempio n. 5
0
        public ManagerPassViewModel(FrameSourceService frameSourceService, InvokerService invokerService, AuthService authService)
        {
            this.frameSourceService = frameSourceService;
            this.invokerService     = invokerService;
            this.authService        = authService;
            CollectionOfPassword    = new ObservableCollection <ManagerPass>();
            this.invokerService.Receive <LoadNeccessaryData>(this, async(data) => LoadPassword());

            Network  = string.Empty;
            Login    = string.Empty;
            Password = string.Empty;
        }
Esempio n. 6
0
        public LoginViewModel(FrameSourceService frameSourceService, InvokerService invokerService, AuthService authService)
        {
            this.frameSourceService = frameSourceService;
            this.invokerService     = invokerService;
            this.authService        = authService;

            Username = string.Empty;
            Password = string.Empty;

            CollectionOfUser = new ObservableCollection <Users>();

            LoadUser();
        }
Esempio n. 7
0
        public HomeViewModel(FrameSourceService frameSourceService, InvokerService invokerService)
        {
            this.frameSourceService = frameSourceService;
            this.invokerService     = invokerService;

            this.timer = string.Empty;

            this.invokerService.Receive <InvokeTimerTick>(this, async(data) =>
            {
                TimeSpan time = TimeSpan.FromSeconds(data.Time);
                string str    = time.ToString(@"hh\:mm\:ss");
                Timer         = str;
            });
        }
Esempio n. 8
0
        public TaskManagerViewModel(FrameSourceService frameSourceService, InvokerService invokerService, AuthService authService)
        {
            this.frameSourceService = frameSourceService;
            this.invokerService     = invokerService;
            this.authService        = authService;

            CollectionOfTaskManager = new ObservableCollection <TaskManager>();

            IsDone       = false;
            Title        = string.Empty;
            Description  = string.Empty;
            selectedDate = DateTime.Now;

            IsShowAddPanel   = false;
            IsEnableComplete = false;
            IsEnableDelete   = false;
            IsShowCompleted  = false;
            isEditMode       = false;


            this.invokerService.Receive <LoadNeccessaryData>(this, async(data) => LoadTasks());
        }
Esempio n. 9
0
        public MainViewModel(FrameSourceService frameSourceService, InvokerService invokerService)
        {
            this.frameSourceService = frameSourceService;
            this.invokerService     = invokerService;

            this.frameSourceService.FrameChangeEvent += (frame) => FrameSource = frame;

            IsNotify  = false;
            timer     = null;
            decrement = 0;

            this.invokerService.Receive <InitializationViewModel>(this, async(data) =>
            {
                this.frameSourceService.ChangeFrame(new Login());
            });
            this.invokerService.Receive <InvokeNotification>(this, async(data) =>
            {
                ShowNotification(data.Notification);
            });
            this.invokerService.Receive <InvokeTimerTick>(this, async(data) =>
            {
                decrement = data.Time;
                if (decrement == 0)
                {
                    timer.Stop();
                    this.invokerService.Invoke <HomeViewModel>(new InvokeTimerTick(decrement));
                    this.invokerService.Invoke <Organaizer_v2.Window.Timer>(new InvokeTimerTick(decrement));
                    return;
                }
                timer          = new DispatcherTimer();
                timer.Interval = TimeSpan.FromSeconds(1);

                timer.Tick += TimerTick;

                timer.Start();
            });
        }