Ejemplo n.º 1
0
        // Cancel
        public object ExecuteCancel(object parameter)
        {
            AddDrugDialogV addDrugUC = (AddDrugDialogV)parameter;

            addDrugUC.Hide();
            return(null);
        }
Ejemplo n.º 2
0
        public async Task ExecuteAsyncAdd(object parameter)
        {
            AddDrugDialogV addDrugUC = (AddDrugDialogV)parameter;

            addDrugUC.addNewDrugProggressBar.IsIndeterminate = true;
            String errorMessage = null;
            await Task.Run(() =>
            {
                try
                {
                    ExecuteSyncAdd();
                }
                catch (Exception e)
                {
                    errorMessage = e.Message + e.InnerException != null ? e.InnerException.Message: "";
                }
            });

            if (errorMessage == null)
            {
                addDrugUC.Hide();
            }
            else
            {
                System.Windows.MessageBox.Show("Error: " + errorMessage, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            addDrugUC.addNewDrugProggressBar.IsIndeterminate = false;
        }
Ejemplo n.º 3
0
        // Add Doctor
        public bool CanExecuteAdd(object parameter)
        {
            AddDrugDialogV addDrugUC = (AddDrugDialogV)parameter;

            if (addDrugUC == null)
            {
                return(false);
            }
            return(!string.IsNullOrEmpty(addDrugUC.DrugName.Text) &&
                   !string.IsNullOrEmpty(addDrugUC.Manufacturer.Text) &&
                   !string.IsNullOrEmpty(addDrugUC.Expiration.Text) &&
                   !string.IsNullOrEmpty(addDrugUC.Miligram.Text) &&
                   !string.IsNullOrEmpty(addDrugUC.DrugType.Text) &&
                   !string.IsNullOrEmpty(addDrugUC.ImgSrc.Text) &&
                   !string.IsNullOrEmpty(addDrugUC.Active.Text));
        }
Ejemplo n.º 4
0
        // Choose Image
        public object ExecuteChoose(object parameter)
        {
            AddDrugDialogV addDrugUC = (AddDrugDialogV)parameter;
            OpenFileDialog op        = new OpenFileDialog();

            op.Title  = "Select a picture";
            op.Filter = "All supported graphics|*.jpg;*.jpeg;*.png|" +
                        "JPEG (*.jpg;*.jpeg)|*.jpg;*.jpeg|" +
                        "Portable Network Graphic (*.png)|*.png";
            if (op.ShowDialog() == DialogResult.OK)
            {
                addDrugUC.ImgSrc.Text = op.FileName;
                NewDrug.ImgSrc        = op.FileName;
                //imgPhoto.Source = new BitmapImage(new Uri(op.FileName));
            }
            return(null);
        }