Example #1
0
 /// <summary>
 /// Metoda zawieraj¹ca cia³a komend zadeklarowanych wczesniej
 /// </summary>
 private void InitCommand()
 {
     OnLoad = new RelayCommand(() =>
     {
     });
     CreateBaseCommand = new RelayCommand(() => { navigationService.NavigateTo(ViewModelLocator.CreateBaseKey); });
     LoadBaseCommand   = new RelayCommand(() => { navigationService.NavigateTo(ViewModelLocator.LoadBaseKey); });
 }
Example #2
0
        private void InitCommand()
        {
            AddPatientCmd = new RelayCommand(() =>
            {
                if (error != "" || PatientFirstName == null || PatientSecondName == null || PatientDOB == null || PatientEmail == null || PatientMRN == null || PatientSex == null)
                {
                    MessageBox.Show("Invalid data!",
                                    "Confirmation", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                else if (servObj.CreatePatientData(new Patient
                {
                    FirstName = PatientFirstName,
                    SecondName = PatientSecondName,
                    MRN = PatientMRN,
                    DOB = PatientDOB,
                    Email = PatientEmail,
                    Sex = SelectedPatientSex
                }))
                {
                    {
                        MessageBox.Show("Succesfull",
                                        "Confirmation", MessageBoxButton.OK, MessageBoxImage.Information);
                        PatientFirstName  = null;
                        PatientSecondName = null;
                        PatientMRN        = null;
                        PatientEmail      = null;
                        PatientSex        = null;
                        navigationService.NavigateTo(ViewModelLocator.PatientKey);
                    }
                }
                else
                {
                    MessageBox.Show("Check MRN",
                                    "Confirmation", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            });

            BackCmd = new RelayCommand(() =>
            {
                if (PatientFirstName != null || PatientEmail != null || PatientSecondName != null || PatientSex != null || PatientMRN != null)
                {
                    MessageBoxResult msgResult = MessageBox.Show("Are you sure to back?",
                                                                 "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question);
                    if (msgResult == MessageBoxResult.Yes)
                    {
                        PatientFirstName = PatientSecondName = PatientMRN = PatientEmail = SelectedPatientSex = null;
                        navigationService.NavigateTo(ViewModelLocator.PatientKey);
                    }
                }
                else
                {
                    navigationService.NavigateTo(ViewModelLocator.PatientKey);
                }
            });
        }
Example #3
0
 private void CheckSplit()
 {
     if (SelectedSplit == "3x3")
     {
         if (Image != null)
         {
             TrzyNaTrzyViewModel.StartTime = DateTime.Now;
             TrzyNaTrzyViewModel.Original.Clear();
             TrzyNaTrzyViewModel.GameList.Clear();
             navigationService.NavigateTo(ViewModelLocator.TrzyNaTrzyKey, Image);
             ChoosenSplit = "3x3";
         }
         else
         {
             MessageBox.Show("Wybierz obraz", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Information);
         }
     }
     else if (SelectedSplit == "4x4")
     {
         if (Image != null)
         {
             CzteryNaCzteryViewModel.StartTime = DateTime.Now;
             CzteryNaCzteryViewModel.Original.Clear();
             CzteryNaCzteryViewModel.GameList.Clear();
             navigationService.NavigateTo(ViewModelLocator.CzteryNaCzteryKey, Image);
             ChoosenSplit = "4x4";
         }
         else
         {
             MessageBox.Show("Wybierz obraz", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Information);
         }
     }
     else if (SelectedSplit == "5x5")
     {
         if (Image != null)
         {
             PiecNaPiecViewModel.StartTime = DateTime.Now;
             PiecNaPiecViewModel.Original.Clear();
             PiecNaPiecViewModel.GameList.Clear();
             navigationService.NavigateTo(ViewModelLocator.PiecNaPiecKey, Image);
             ChoosenSplit = "5x5";
         }
         else
         {
             MessageBox.Show("Wybierz obraz", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Information);
         }
     }
 }
Example #4
0
 public RemindersHomeViewModel(IMyNavigationService navigationService)
 {
     AddNewReminderCommand = new Command(() => {
         //Do something e.g:
         //navigationService.GoBack();
         navigationService.NavigateTo(ViewModelLocator.AddReminderPageKey);
     });
 }
 public PromptingHomeViewModel(IMyNavigationService navigationService)
 {
     //TOP MENU BUTTONS
     RemindersButtonCommand = new Command(() => {
         navigationService.NavigateTo(ViewModelLocator.RemindersHomePageKey);
         //navigationService.GoBack();
     });
     PromptingButtonCommand = new Command(() => {
         navigationService.NavigateTo(ViewModelLocator.PromptingHomePageKey);
     });
     MappingButtonCommand = new Command(() => {
         navigationService.NavigateTo(ViewModelLocator.MappingHomePageKey);
     });
     SettingsButtonCommand = new Command(() => {
         navigationService.NavigateTo(ViewModelLocator.SettingsHomePageKey);
     });
 }
Example #6
0
        private void InitCommand()
        {
            BackCmd = new RelayCommand(() =>
            {
                navigationService.NavigateTo(ViewModelLocator.ChoiceKey);
            });

            AddTestCmd = new RelayCommand(() =>
            {
                navigationService.NavigateTo(ViewModelLocator.AddTestKey);
            });

            OnLoad = new RelayCommand(() =>
            {
                LoadAllTest();
            });
        }
Example #7
0
 public SettingsHomeViewModel(IMyNavigationService navigationService)
 {
     DemoButtonCommand = new Command(() => {
         //Do something e.g:
         //navigationService.GoBack();
         navigationService.NavigateTo(ViewModelLocator.SamplePagePageKey);
     });
 }
Example #8
0
        public void InitCommand()
        {
            PatientCmd = new RelayCommand(() =>
            {
                navigationService.NavigateTo(ViewModelLocator.PatientKey);
            });

            TestCmd = new RelayCommand(() =>
            {
                navigationService.NavigateTo(ViewModelLocator.TestKey);
            });

            OrderCmd = new RelayCommand(() =>
            {
                navigationService.NavigateTo(ViewModelLocator.OrderKey);
            });
        }
		public RemindersHomeViewModel(IMyNavigationService navigationService)
		{

			AddNewReminderCommand = new Command(() => {
				//Do something e.g:
				//navigationService.GoBack();
				navigationService.NavigateTo(ViewModelLocator.AddReminderPageKey);
			});

		}
		public SettingsHomeViewModel(IMyNavigationService navigationService)
		{

			DemoButtonCommand = new Command(() => {
				//Do something e.g:
				//navigationService.GoBack();
				navigationService.NavigateTo(ViewModelLocator.SamplePagePageKey);
			});

		}
        public RemindersHomeViewModel(IMyNavigationService navigationService)
        {
            //TOP MENU BUTTONS
            RemindersButtonCommand = new Command(() => {
                navigationService.NavigateTo(ViewModelLocator.RemindersHomePageKey);
                //navigationService.GoBack();
            });
            PromptingButtonCommand = new Command(() => {
                navigationService.NavigateTo(ViewModelLocator.PromptingHomePageKey);
            });
            MappingButtonCommand = new Command(() => {
                navigationService.NavigateTo(ViewModelLocator.MappingHomePageKey);
            });
            SettingsButtonCommand = new Command(() => {
                navigationService.NavigateTo(ViewModelLocator.SettingsHomePageKey);

            });

            if (0 == 0)
            {
                //Debug.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~yes");
            }
            backColor = new Color(32,32,32);
        }
Example #12
0
        private void InitCommand()
        {
            BackCmd = new RelayCommand(() =>
            {
                if (TestType != null || SelectedPriority != 0 || TestSpecimenCode != null || SelectedTitle != null)
                {
                    MessageBoxResult msgResult = MessageBox.Show("Are you sure to back?",
                                                                 "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question);
                    if (msgResult == MessageBoxResult.Yes)
                    {
                        TestType = SelectedTitle = TestSpecimenCode = null; SelectedPriority = TestOrderNumber = 0;
                        navigationService.NavigateTo(ViewModelLocator.PatientKey);
                    }
                }
                else
                {
                    navigationService.GoBack();
                }
            });

            AddTestCmd = new RelayCommand(() =>
            {
                if (ViewModelLocator.OrderNumberViewModel != 0)
                {
                    TestModel testModel = new TestModel(SelectedTitle, TestType, 0, TestSpecimenCode, SelectedPriority, false, TestOrderNumber);
                    ViewModelLocator.TestModelList.Add(testModel);
                    //servObj.CreateTestData(ConverterDataBase.toDataBase(testModel));
                    TestType = SelectedTitle = TestSpecimenCode = null; SelectedPriority = TestOrderNumber = 0;
                    navigationService.GoBack();
                }
            });

            OnLoad = new RelayCommand(() =>
            {
                TestTitle.Clear();
                LoadAllTest();
                if (ViewModelLocator.OrderNumberViewModel != 0)
                {
                    TestOrderNumber = ViewModelLocator.OrderNumberViewModel;
                }
                else
                {
                    TestOrderNumber = servObj.NextIdOrder();
                }
            });
        }
Example #13
0
 /// <summary>
 /// Metoda zawierająca inizjalizację wszystkich komend w widoku
 /// W tym widoku jest tylko jedna komenda opisana wyżej
 /// </summary>
 private void InitCommand()
 {
     CreateBaseCommand = new RelayCommand(() =>
     {
         if (PathName == null)
         {
             MessageBoxResult result = MessageBox.Show("Wybierz odpowiednie rozszerzenie",
                                                       "Confirmation", MessageBoxButton.OK);
         }
         else if (BaseName == null || BaseName == "")
         {
             MessageBoxResult result = MessageBox.Show("Podaj nazwę bazy",
                                                       "Confirmation", MessageBoxButton.OK);
         }
         else if (TableName == null || TableName == "")
         {
             MessageBoxResult result = MessageBox.Show("Podaj nazwę arkusza",
                                                       "Confirmation", MessageBoxButton.OK);
         }
         else if (BaseName.FirstOrDefault() >= '0' && BaseName.FirstOrDefault() <= '9')
         {
             MessageBoxResult result = MessageBox.Show("Nazwa nie powinna zaczynać się cyfrą\n" +
                                                       "lub być liczbą",
                                                       "Confirmation", MessageBoxButton.OK);
             BaseName = "";
         }
         else if (TableName.FirstOrDefault() >= '0' && TableName.FirstOrDefault() <= '9')
         {
             MessageBoxResult result = MessageBox.Show("Nazwa nie powinna zaczynać się cyfrą\n" +
                                                       "lub być liczbą",
                                                       "Confirmation", MessageBoxButton.OK);
             TableName = "";
         }
         else
         {
             string file = $"D:\\{BaseName}.{PathName}";
             var stream  = new FileStream(file, FileMode.Create, FileAccess.Write);
             //XSSFWorkbook workbook = new XSSFWorkbook();
             XSSFSheet sheet = (XSSFSheet)(App.workbook.CreateSheet($"{TableName}"));
             App.workbook.Write(stream);
             stream.Close();
             navigationService.NavigateTo(ViewModelLocator.CreateBaseAddColumnsKey, file);
         }
     });
 }
 /// <summary>
 /// Initializes a new instance of the MainViewModel class.
 /// </summary>
 public TempMenuViewModel(IMyNavigationService navigationService)
 {
     this.navigationService = navigationService;
     LogoutCommand          = new Command(() => {
         database.LoseToken("Yammer");
         navigationService.NavigateTo(ViewModelLocator.FeedPageKey);
     });
     ContactsCommand = new Command(() => {
         database.truncadePerson();
         MyCalendar.ImportContacts();
     });
     CalendarCommand = new Command(() => {
         database.truncade();
         MyCalendar.ImportCalendar();
     });
     PurgeCommand = new Command(() => {
         database.truncade();
         database.truncadePerson();
     });
 }
 /// <summary>
 /// Initializes a new instance of the MainViewModel class.
 /// </summary>
 public TempMenuViewModel(IMyNavigationService navigationService)
 {
     this.navigationService = navigationService;
     LogoutCommand = new Command (() => {
         database.LoseToken("Yammer");
         navigationService.NavigateTo(ViewModelLocator.FeedPageKey);
     });
     ContactsCommand = new Command (() => {
         database.truncadePerson();
         MyCalendar.ImportContacts();
     });
     CalendarCommand = new Command (() => {
         database.truncade();
         MyCalendar.ImportCalendar();
     });
     PurgeCommand = new Command (() => {
         database.truncade();
         database.truncadePerson();
     });
 }
Example #16
0
        public AddActivityViewModel(IMyNavigationService navigationService)
        {
            var database = new ActivityDatabase();

            DemoButtonCommand = new Command(() => {
                //create new model for adding a step
                //Do something e.g:
                //navigationService.GoBack();
                // navigationService.NavigateTo(ViewModelLocator.SamplePagePageKey);
            });

            SaveAndQuit = new Command(() => {
                database.InsertOrUpdateActivity(new Activities(ActivityName, ActivityLocation, 1, false));
                navigationService.GoBack();
            });

            OpenImageSelector = new Command(() =>
            {
                //once i get the image selecor in it'll go here
                //navigationService.NavigateTo();
                navigationService.NavigateTo(ViewModelLocator.ImagePickerPageKey);
            });
        }
		public AddActivityViewModel(IMyNavigationService navigationService)
		{
			var database = new ActivityDatabase();

			DemoButtonCommand = new Command(() => {
				//create new model for adding a step
				//Do something e.g:
				//navigationService.GoBack();
				// navigationService.NavigateTo(ViewModelLocator.SamplePagePageKey);
			});

			SaveAndQuit = new Command (() => {
				database.InsertOrUpdateActivity(new Activities(ActivityName, ActivityLocation, 1, false));
				navigationService.GoBack();
			});

			OpenImageSelector = new Command(() =>
			{
				//once i get the image selecor in it'll go here
				//navigationService.NavigateTo();
				navigationService.NavigateTo(ViewModelLocator.ImagePickerPageKey);

			});
		}
Example #18
0
        private void InitCommand()
        {
            DeleteCmd = new RelayCommand(() =>
            {
                try
                {
                    if (servObj.DeletePatientData(SelectedPatient.MRN))
                    {
                        MessageBox.Show("Succesfull",
                                        "Confirmation", MessageBoxButton.OK, MessageBoxImage.Information);
                        SelectedPatient = null;
                        LoadPatient();
                    }
                    else
                    {
                        MessageBox.Show("The problem occured with removal",
                                        "Confirmation", MessageBoxButton.OK, MessageBoxImage.Warning);
                    }
                    SelectedPatient = null;
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message,
                                    "Confirmation", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            });

            AddCmd = new RelayCommand(() =>
            {
                navigationService.NavigateTo(ViewModelLocator.AddPatientKey);
            });

            OnLoad = new RelayCommand(() =>
            {
                LoadPatient();
            });

            BackCmd = new RelayCommand(() =>
            {
                navigationService.NavigateTo(ViewModelLocator.ChoiceKey);
            });

            UpdateCmd = new RelayCommand(() =>
            {
                if (SelectedPatient == null)
                {
                    ViewModelLocator.SearchPatient = null;
                }
                else
                {
                    ViewModelLocator.SearchPatient = SelectedPatient;
                }

                navigationService.NavigateTo(ViewModelLocator.ChangePatientKey);
            });

            DisplayOrderCmd = new RelayCommand(() =>
            {
                if (SelectedPatient == null)
                {
                    ViewModelLocator.SearchPatient = null;
                }
                else
                {
                    ViewModelLocator.SearchPatient = SelectedPatient;
                }

                navigationService.NavigateTo(ViewModelLocator.OrderKey);
            });
        }
Example #19
0
        private void InitCommand()
        {
            BackCmd = new RelayCommand(() =>
            {
                PatientFirstName = PatientSecondName = PatientMRN = null;
                ViewModelLocator.SearchPatient = null;
                if (!navigationService.GoBackToMenu())
                {
                    navigationService.NavigateTo(ViewModelLocator.ChoiceKey);
                }
                else
                {
                    navigationService.NavigateTo(ViewModelLocator.PatientKey);
                }
            });

            AddOrderCmd = new RelayCommand(() =>
            {
                ViewModelLocator.PatientMRNViewModel = PatientMRN;
                ViewModelLocator.TestModelList.Clear();
                navigationService.NavigateTo(ViewModelLocator.AddOrderKey);
            });

            OnLoad = new RelayCommand(() =>
            {
                SearchOrder = "";
                Orders.Clear();
                if (ViewModelLocator.SearchPatient == null)
                {
                    LoadOrders();
                }
                else
                {
                    LoadOrders(ViewModelLocator.SearchPatient.MRN);
                }
                LoadSearchPatient();
            });

            DelOrderCmd = new RelayCommand(() =>
            {
                servObj.DeleteOrderData(ConverterDataBase.orderModelToDataBase(SelectedOrder));
                SelectedOrder = null;
                if (ViewModelLocator.SearchPatient == null)
                {
                    LoadOrders();
                }
                else
                {
                    LoadOrders(ViewModelLocator.SearchPatient.MRN);
                }
            });

            AddTestCmd = new RelayCommand(() =>
            {
                ViewModelLocator.OrderNumberViewModel = SelectedOrder.OrderNumber;
                navigationService.NavigateTo(ViewModelLocator.AddTestKey);
            });

            DelTestCmd = new RelayCommand(() =>
            {
                if (SelectedOrder.SelectedTest != null)
                {
                    servObj.DeleteTestData(SelectedOrder.SelectedTest.TestId);
                    MessageBox.Show("Succesfull",
                                    "Confirmation", MessageBoxButton.OK, MessageBoxImage.Information);
                    AllOrder = Orders;
                }
            });
        }
Example #20
0
        private void InitCommand()
        {
            SelectTestCmd = new RelayCommand(() =>
            {
                navigationService.NavigateTo(ViewModelLocator.AddTestKey);
                // SelectTestViewModel selectedTestViewModel = new SelectTestViewModel();

                // var selectTestView = new SelectTestView()
                // {
                //     DataContext = selectedTestViewModel
                // };
                // selectTestView.ShowDialog();

                // SelectedTitles = new ObservableCollection<string>();

                // if (selectedTestViewModel.SelectedTests.Count != 0)
                //{
                //     SelectedTests = selectedTestViewModel.SelectedTests;

                //     foreach (var test in SelectedTests)
                //     {
                //         string title = test.Title;
                //         SelectedTitles.Add(title);
                //     }
                //     CanAdd = true;
                // }
                // isLoad = false;
            });

            BackCmd = new RelayCommand(() =>
            {
                isLoad = true;
                navigationService.NavigateTo(ViewModelLocator.OrderKey);
            });

            AddOrderCmd = new RelayCommand(() =>
            {
                if (EndDate < StartDate)
                {
                    MessageBox.Show("Check your End Date",
                                    "Confirmation", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
                else
                {
                    Order ord = new Order {
                        EndDate = EndDate, OrderNumber = servObj.NextIdOrder(), patientMRN = "", StartDate = StartDate
                    };
                    servObj.CreateOrderData(ord, ViewModelLocator.PatientMRNViewModel);
                    List <Test> tests = ConverterDataBase.toDataBase(SelectedTests.ToArray());
                    foreach (var item in tests)
                    {
                        servObj.CreateTestData(item);
                    }
                    isLoad = true;
                    navigationService.NavigateTo(ViewModelLocator.OrderKey);
                }
            });

            OnLoad = new RelayCommand(() =>
            {
                StartDate     = DateTime.Now;
                EndDate       = DateTime.Now;
                SelectedTests = ViewModelLocator.TestModelList;
                LoadAllTitle();
            });
        }