//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);
        }
Exemple #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>();
        }
Exemple #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;
        }
Exemple #4
0
        public async Task Inside(string[] args)
        {
            var stream = new StreamProvider(() => string.Join(TokenConfigs.SeparatorString, args).CleanString(TokenConfigs.TextStart, TokenConfigs.TextEnd), input => { Console.WriteLine(input); return(string.Empty); });

            var invoker = new InvokerService("Inside", stream, true, Console.WriteLine);

            await invoker.Run();

            { }
        }
Exemple #5
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;
        }
Exemple #6
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;
        }
Exemple #7
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();
        }
Exemple #8
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;
            });
        }
Exemple #9
0
        public Form1()
        {
            InitializeComponent();

            Func <string> GetInput = () => InputBox.Text;

            Func <string, string> GetOutput = s =>
            {
                OutputBox.Text += Environment.NewLine;
                OutputBox.Text += s;
                return(string.Empty);
            };

            Invoker = new InvokerService("Main", new StreamProvider(GetInput, GetOutput), true);
        }
Exemple #10
0
        public Timer(InvokerService invokerService)
        {
            this.invokerService = invokerService;
            InitializeComponent();

            this.invokerService.Receive <InvokeTimerTick>(this, async(data) =>
            {
                TimeSpan time         = TimeSpan.FromSeconds(data.Time);
                StartButton.IsEnabled = false;
                if (time.TotalSeconds == 0)
                {
                    StartButton.IsEnabled = true;
                    EndButton.IsEnabled   = false;
                }
                string str      = time.ToString(@"hh\:mm\:ss");
                TimerFiled.Text = str;
            });
        }
Exemple #11
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());
        }
Exemple #12
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();
            });
        }
Exemple #13
0
 public Home(InvokerService invokerService)
 {
     this.invokerService = invokerService;
     InitializeComponent();
 }