private async void BtnAdd_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var AnalizeBlood = new AnalizeBlood()
                {
                    Analizi = new Analizi()
                    {
                        Client       = pageClient.Input as Client,
                        Laborant     = pageLaborant.Input as Laborant,
                        IdAnalizType = HelpDb.IdTypeForBlood
                    }
                };

                AnalizeBlood.Blood                = float.Parse(pageBlood.Input);
                AnalizeBlood.Zhelezo              = float.Parse(pageZhelezo.Input);
                AnalizeBlood.Analizi.IdClient     = (pageClient.Input as Client).Id;
                AnalizeBlood.Analizi.Client       = null;
                AnalizeBlood.Analizi.IdLaborant   = (pageLaborant.Input as Laborant).Id;
                AnalizeBlood.Analizi.Laborant     = null;
                AnalizeBlood.Analizi.IdAnalizType = HelpDb.IdTypeForBlood;
                await Task.Run(() => controller.AddAnalizeBlood(AnalizeBlood));

                GoodClose();
            }
            catch (Exception ex)
            {
                HelpMessageBox.MessageBoxError(ex.Message, Title);
            }
        }
Esempio n. 2
0
 private void BtnDelete_Click(object sender, RoutedEventArgs e)
 {
     if (CheckSelected(out AnalizeShit AnalizeShit) && HelpMessageBox.MessageBoxQuest("Вы уверены?") == MessageBoxResult.Yes)
     {
         controller.DeleteAnalizeShit(AnalizeShit);
     }
     UpdateList();
 }
Esempio n. 3
0
        private bool CheckSelected(out AnalizeShit AnalizeShit)
        {
            var selected = ClList.SelectedItem;

            if (selected == null)
            {
                HelpMessageBox.MessageBoxError("Объект не выбран");
                AnalizeShit = null;
                return(false);
            }
            else
            {
                AnalizeShit = selected as AnalizeShit;
                return(true);
            }
        }
Esempio n. 4
0
        private bool CheckSelected(out Client client)
        {
            var selected = ClList.SelectedItem;

            if (selected == null)
            {
                HelpMessageBox.MessageBoxError("Объект не выбран");
                client = null;
                return(false);
            }
            else
            {
                client = selected as Client;
                return(true);
            }
        }
Esempio n. 5
0
        private async void UpdateList()
        {
            try
            {
                List <AnalizeShit> list = new List <AnalizeShit>();
                await Task.Run(() =>
                {
                    list = controller.GetAnalizeShits();
                });

                ClList.ItemsSource = list;
                ClList.Items.Refresh();
            }
            catch (Exception ex)
            {
                HelpMessageBox.MessageBoxError(ex.Message);
            }
        }
Esempio n. 6
0
        private async void BtnSave_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Laborant.Fio           = pageFio.Input;
                Laborant.Salary        = decimal.Parse(pageSalary.Input);
                Laborant.Laboratory    = null;
                Laborant.IdLaboratory  = (pageLab.Input as Laboratory).Id;
                Laborant.Birthday      = pageDate.Input.GetValueOrDefault();
                Laborant.User.IdType   = HelpDb.IdTypeForLaborant;
                Laborant.User.Login    = pageLogin.Input;
                Laborant.User.Password = pagePassword.Input;
                await Task.Run(() => controller.UpdateLaborant(Laborant));

                GoodClose();
            }
            catch (Exception ex)
            {
                HelpMessageBox.MessageBoxError(ex.Message, Title);
            }
        }
Esempio n. 7
0
        private async void BtnSave_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                client.Name          = pageName.Input;
                client.Surname       = pageSurname.Input;
                client.Middlename    = pageMiddlename.Input;
                client.Birthday      = pageDate.Input.GetValueOrDefault();
                client.User.Login    = pageLogin.Input;
                client.User.Password = pagePassword.Input;
                await Task.Run(() =>
                {
                    controller.UpdateClient(client);
                });

                GoodClose();
            }
            catch (Exception ex)
            {
                HelpMessageBox.MessageBoxError(ex.Message, Title);
            }
        }
Esempio n. 8
0
        void HelpLabel_MouseClick(object sender, MouseEventArgs e)
        {
            Point pt = new Point(Width, 0);
            //--- Popup Help Message ---//
            String message = "The Help Key has not been set for this item.";

            if (!String.IsNullOrEmpty(helpMessageKey))
            {
                message = MessageManager.getMessage(helpMessageKey);
            }
            string newMessageText = HelpMessageBox.Show(message,
                                                        "Information",
                                                        HelpMessageBox.enumMessageIcon.Information,
                                                        HelpMessageBox.enumMessageButton.OK, this.PointToScreen(pt));

            if (HelpMessageBox.EditMode &&                 //--- Make sure we are in edit mode          ---//
                !String.IsNullOrEmpty(helpMessageKey) &&   //--- Must have a help message key set       ---//
                !newMessageText.Equals(message))           //--- Make sure the message actually changed ---//
            {                                              //----------------------------------------------//
                MessageManager.saveMessage(helpMessageKey, newMessageText);
            }
        }
        private async void BtnSave_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                AnalizeMocha.Mocha                = float.Parse(pageMocha.Input);
                AnalizeMocha.ZhelezoMocha         = float.Parse(pageZhelezo.Input);
                AnalizeMocha.Analizi.IdClient     = (pageClient.Input as Client).Id;
                AnalizeMocha.Analizi.Client       = null;
                AnalizeMocha.Analizi.IdLaborant   = (pageLaborant.Input as Laborant).Id;
                AnalizeMocha.Analizi.Laborant     = null;
                AnalizeMocha.Analizi.IdAnalizType = HelpDb.IdTypeForMocha;
                await Task.Run(() =>
                {
                    controller.UpdateAnalizeMocha(AnalizeMocha);
                });

                GoodClose();
            }
            catch (Exception ex)
            {
                HelpMessageBox.MessageBoxError(ex.Message, Title);
            }
        }
Esempio n. 10
0
        private async void Auth_Click(object sender, RoutedEventArgs e)
        {
            string login    = TbLogin.Text;
            string password = TbPassword.Password;
            int    id       = -1;

            IsEnabled = false;
            try
            {
                await Task.Run(() =>
                {
                    id = controller.Auth(login, password);
                });
            }catch (Exception ex)
            {
                HelpMessageBox.MessageBoxError(ex.Message);
            }
            IsEnabled = true;
            switch (id)
            {
            case 3: new Menu().ShowDialog(); break;
            }
        }
Esempio n. 11
0
        private async void BtnAdd_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var client = new Client()
                {
                    User = new User()
                };
                client.Name          = pageName.Input;
                client.Surname       = pageSurname.Input;
                client.Middlename    = pageMiddlename.Input;
                client.Birthday      = pageDate.Input.GetValueOrDefault();
                client.User.Login    = pageLogin.Input;
                client.User.IdType   = HelpDb.IdTypeForClient;
                client.User.Password = pagePassword.Input;
                await Task.Run(() => controller.AddClient(client));

                GoodClose();
            }
            catch (Exception ex)
            {
                HelpMessageBox.MessageBoxError(ex.Message, Title);
            }
        }
        private void Return(object sender, RoutedEventArgs routedEventArgs)
        {
            if (_minPixelsForBaseDisc == null)
            {
                MessageBox.Show("Please mark the area in the image that contains just the base disc.");
                return;
            }
            else if (_minPixelsForBaseDisc < 10)
            {
                MessageBox.Show("The height of the base disc should at least be 10 pixels.");
                return;
            }

            var quickProcessingWindow  = new QuickProcessingWindowHelper(ParentCanvas);
            var processor              = new AutoConfigureImgPoints.Processor();
            var markerPrcoessingParams = new MarkerProcessingParams
            {
                MarkerColorVariationPercent = 10,
                MarkerWidthPercent          = 5,
                MaximumMarkerCount          = 10
            };
            var @params = new AutoConfigureImgPointsParams
            {
                MarkerProcessingParams        = markerPrcoessingParams,
                BackgroundColor               = _backgroundColor,
                BackgroundStrippingParams     = _backgroundStrippingParams,
                MinPixelsForBaseDisc          = _minPixelsForBaseDisc.Value,
                MinPixelsForBaseDiscEndOfEdge = 10,
                ResizeHeight = 500,
                ResizeWidth  = 500
            };
            var clickPositions = processor.GetClickPositionsForImgFolder(_folderPath, @params);



            var gotResults = clickPositions != null && clickPositions.Count > 0 &&
                             clickPositions.Any(x => (x.ClickPositionListForImages != null && x.ClickPositionListForImages.Count > 0));

            if (!gotResults)
            {
                var statusMessages = new List <string>
                {
                    "Autoconfigure was unsuccessful. No image positions could be determined.",
                    "Please click on the 'Requirements' button to check how to take photos to support autoconfigure.",
                    "Press the cancel button to go back to entering the positions manually."
                };
                quickProcessingWindow.Close();
                var messageBox = new HelpMessageBox(statusMessages, null);
                messageBox.ShowDialog();
                return;
            }

            var fileCount           = GetImageFilesHelper.GetImageFilesFromLocation(_folderPath);
            var requiredCount       = GetRequiredClickInputsCount(fileCount);
            var identifiedCount     = 0;
            var innerStatusMessages = new List <string>();

            for (var ctr = 0; ctr < clickPositions.Count; ctr++)
            {
                var clickInput = clickPositions[ctr];
                var count      = clickInput != null && clickInput.ClickPositionListForImages != null? clickInput.ClickPositionListForImages.Count : 0;
                identifiedCount += count;

                if (ctr == 0)
                {
                    innerStatusMessages.Add(string.Format("{0}: {1} identified out of required 5.", clickInput == null? (ctr + 1).ToString() : clickInput.ImageName, count));
                }
                else
                {
                    innerStatusMessages.Add(string.Format("{0}: {1} identified out of required 4.", clickInput == null ? (ctr + 1).ToString() : clickInput.ImageName, count));
                }
            }

            quickProcessingWindow.Close();

            if (identifiedCount == requiredCount)
            {
                var statusMessages = new List <string>
                {
                    "AutoConfigure Successful!",
                    string.Format("All required {0} click positions were identified.", requiredCount),
                    "We will now display all the click positions for your review.."
                };

                var messageBox = new HelpMessageBox(statusMessages, null);
                messageBox.ShowDialog();
            }
            else
            {
                var statusMessages = new List <string>
                {
                    "AutoConfigure was partially successful in identifying the click positions.",
                    string.Format("{0} out of total of {1} positions could be identified.", identifiedCount, requiredCount),
                    "Below is a break down of the identified positions.",
                    "Click close to to review the identified positions and fill in the missed ones..."
                };

                var messageBox = new HelpMessageBox(statusMessages, innerStatusMessages);
                messageBox.ShowDialog();
            }

            if (AutoConfigured != null)
            {
                AutoConfigured(this,
                               new AutoConfigureSettingsEventArgs
                {
                    ClickInputs = new ClickInputs
                    {
                        ImageClickInputDetailsList = clickPositions,
                        Angles = null
                    }
                });
            }
        }