//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); }
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>(); }
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; }
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; }
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; }
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(); }
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; }); }
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()); }
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(); }); }