Exemplo n.º 1
0
        public void DockPanelLayoutTest()
        {
            DockPanel panel = new DockPanel();
            panel.InvalidateMeasure();

            FrameworkElement child1 = new FrameworkElement { Width = 100 };
            FrameworkElement child2 = new FrameworkElement { Height = 100 };
            FrameworkElement child3 = new FrameworkElement { Width = 100 };
            FrameworkElement child4 = new FrameworkElement { Height = 100 };
            FrameworkElement child5 = new FrameworkElement();

            panel.Children.Add(child1);
            panel.Children.Add(child2);
            panel.Children.Add(child3);
            panel.Children.Add(child4);
            panel.Children.Add(child5);

            DockPanel.SetDock(child1, Dock.Left);
            DockPanel.SetDock(child2, Dock.Top);
            DockPanel.SetDock(child3, Dock.Right);
            DockPanel.SetDock(child4, Dock.Bottom);

            panel.Measure(new Size(1000, 1000));

            Assert.AreEqual(new Size(200, 200), panel.DesiredSize);

            panel.Arrange(new Rect(1000, 1000));

            Assert.AreEqual(new Size(1000, 1000), panel.VisualSize);

            Assert.AreEqual(new Size(100, 1000), child1.VisualSize);
            Assert.AreEqual(new Size(900, 100), child2.VisualSize);
            Assert.AreEqual(new Size(100, 900), child3.VisualSize);
            Assert.AreEqual(new Size(800, 100), child4.VisualSize);
            Assert.AreEqual(new Size(800, 800), child5.VisualSize);

            Assert.AreEqual(new Point(0, 0), child1.VisualOffset);
            Assert.AreEqual(new Point(100, 0), child2.VisualOffset);
            Assert.AreEqual(new Point(900, 100), child3.VisualOffset);
            Assert.AreEqual(new Point(100, 900), child4.VisualOffset);
            Assert.AreEqual(new Point(100, 100), child5.VisualOffset);
        }
Exemplo n.º 2
0
        Window CreateNodeDialog(out RichTextBox richBox) {
            var window = new Window {Width = 200, Height = 200};
            var mp = Mouse.GetPosition(_dockPanel);
            window.Left = mp.X;
            window.Top = mp.Y;
            var panel = new DockPanel();

            window.Content = panel;

            var textBox = new TextBox {Text = "Please modify the node label:"};

            DockPanel.SetDock(textBox, Dock.Top);
            panel.Children.Add(textBox);

            richBox = new RichTextBox();
            richBox.FontSize *= 1.5;
            richBox.AppendText("Label");
            richBox.FontFamily = new FontFamily("Consoles");
            richBox.Width = window.Width;
            DockPanel.SetDock(richBox, Dock.Top);
            panel.Children.Add(richBox);
            panel.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
            panel.Width = textBox.Width;
            var button = new Button {Content = "OK"};
            button.Click += (a, b) => window.Close();
            DockPanel.SetDock(button, Dock.Bottom);
            button.IsDefault = true;
            button.Width = 40;
            button.Height = 40;
            panel.Children.Add(button);
            panel.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
            window.SizeToContent = SizeToContent.WidthAndHeight;
            return window;
        }
        /*
         * printMenuItem_Click
         *   Handles the printMenuItem_Click event - builds a DockPanel showing the sample grid and other stuff for print format - then sends to a PrintDlg
         *
         */
        private void printMenuItem_Click(object sender, RoutedEventArgs e)
        {
            Grid printSampleGrid = new Grid();
            printSampleGrid.Name = "printSampleGrid";
            printSampleGrid.ShowGridLines = false;
            RowDefinition sampleRowdef1 = new RowDefinition();
            sampleRowdef1.Height = new GridLength(1, GridUnitType.Star);
            RowDefinition sampleRowdef2 = new RowDefinition();
            sampleRowdef2.Height = new GridLength(1, GridUnitType.Star);
            RowDefinition sampleRowdef3 = new RowDefinition();
            sampleRowdef3.Height = new GridLength(1, GridUnitType.Star);
            RowDefinition sampleRowdef4 = new RowDefinition();
            sampleRowdef4.Height = new GridLength(1, GridUnitType.Star);
            RowDefinition sampleRowdef5 = new RowDefinition();
            sampleRowdef5.Height = new GridLength(1, GridUnitType.Star);
            RowDefinition sampleRowdef6 = new RowDefinition();
            sampleRowdef6.Height = new GridLength(1, GridUnitType.Star);

            ColumnDefinition sampleColdef1 = new ColumnDefinition();
            sampleColdef1.Width = new GridLength(1, GridUnitType.Star);
            ColumnDefinition sampleColdef2 = new ColumnDefinition();
            sampleColdef2.Width = new GridLength(1, GridUnitType.Star);
            ColumnDefinition sampleColdef3 = new ColumnDefinition();
            sampleColdef3.Width = new GridLength(1, GridUnitType.Star);
            ColumnDefinition sampleColdef4 = new ColumnDefinition();
            sampleColdef4.Width = new GridLength(1, GridUnitType.Star);
            ColumnDefinition sampleColdef5 = new ColumnDefinition();
            sampleColdef5.Width = new GridLength(1, GridUnitType.Star);
            printSampleGrid.RowDefinitions.Add(sampleRowdef1);
            printSampleGrid.RowDefinitions.Add(sampleRowdef2);
            printSampleGrid.RowDefinitions.Add(sampleRowdef3);
            printSampleGrid.RowDefinitions.Add(sampleRowdef4);
            printSampleGrid.RowDefinitions.Add(sampleRowdef5);
            printSampleGrid.RowDefinitions.Add(sampleRowdef6);
            printSampleGrid.ColumnDefinitions.Add(sampleColdef1);
            printSampleGrid.ColumnDefinitions.Add(sampleColdef2);
            printSampleGrid.ColumnDefinitions.Add(sampleColdef3);
            printSampleGrid.ColumnDefinitions.Add(sampleColdef4);
            printSampleGrid.ColumnDefinitions.Add(sampleColdef5);

            addStationControlToGrid(printSampleGrid);
            colorDisabledStations(printSampleGrid);
            updateSampleGrid(printSampleGrid);

            DockPanel printDockPanel = new DockPanel();
            printDockPanel.Margin = new Thickness(80, 60, 80, 60);

            TextBlock nameLabelText = new TextBlock();
            nameLabelText.Text = "Name: ________________________________";
            nameLabelText.Padding = new Thickness(20, 0, 0, 20);
            nameLabelText.FontSize = 20;
            printDockPanel.Children.Add(nameLabelText);
            DockPanel.SetDock(nameLabelText, Dock.Top);

            printDockPanel.Children.Add(printSampleGrid);
            DockPanel.SetDock(printSampleGrid, Dock.Bottom);

            PrintDialog printDlg = new PrintDialog();
            if (printDlg.ShowDialog() == true)
            {

                var printCapabilities = printDlg.PrintQueue.GetPrintCapabilities(printDlg.PrintTicket);

                var size = new Size(printCapabilities.PageImageableArea.ExtentWidth,
                     printCapabilities.PageImageableArea.ExtentHeight);

                printDockPanel.Measure(size);
                printDockPanel.Arrange(new Rect(new Point(printCapabilities.PageImageableArea.OriginWidth,
                    printCapabilities.PageImageableArea.OriginHeight), size));

                try
                {
                    printDlg.PrintVisual(printDockPanel, "Adherent Oven Sample Run");
                }
                catch (Exception ex)
                {
                    logger.Warn("Error occurred while printing", ex);
                    MessageBox.Show("Error occurred while printing - check log for details");
                }
            }
        }
Exemplo n.º 4
0
        Window CreateNodeFindDialog(out TextBox textBox) {
            var window = new Window { Width = 200,Height = 200 };
            var mp = Mouse.GetPosition(dockPanel);
            window.Left = mp.X;
            window.Top = mp.Y;
            var panel = new DockPanel();
            window.Title = "Enter a node label substring";
 
            window.Content = panel;
         
            textBox = new TextBox();
            textBox.FontSize *= 1.5;
            textBox.FontFamily = new FontFamily("Consoles");
            textBox.Width = 400;
            DockPanel.SetDock(textBox,Dock.Top);
            panel.Children.Add(textBox);
            panel.Measure(new Size(double.PositiveInfinity,double.PositiveInfinity));
            var button = new Button { Content = "OK" };
            button.Click += (a,b) => window.Close();
            DockPanel.SetDock(button,Dock.Bottom);
            button.IsDefault = true;
            button.Width = 40;
            button.Height = 40;
            
            panel.Children.Add(button);
            panel.Measure(new Size(double.PositiveInfinity,double.PositiveInfinity));
            window.SizeToContent = SizeToContent.WidthAndHeight;
            textBox.Focus();
            return window;
        
        }
        private async void FindDiagnosis()
        {
            var panelgradient = new LinearGradientBrush()
            {
                StartPoint = new Point(0.5, 0),
                EndPoint = new Point(0.5, 1)
            };
            panelgradient.GradientStops.Add(new GradientStop() {Color = Color.FromArgb(255, 255, 255, 255), Offset = 0});
            panelgradient.GradientStops.Add(new GradientStop() {Color = Color.FromArgb(198, 250, 225, 4), Offset = 1});
            var panelAllDiagnosis = new DockPanel
            {
                Background = panelgradient,
                Margin = new Thickness(15, 15, 15, 15),
                Visibility = Visibility.Hidden
            };
            var labelstartdiagnosis = new Label
            {
                Content = "Діагнози",
                Foreground = Brushes.MediumBlue,
                FontWeight = FontWeights.Bold
            };
            DockPanel.SetDock(labelstartdiagnosis, Dock.Top);
            panelAllDiagnosis.Children.Add(labelstartdiagnosis);
            DockPanel.SetDock(panelAllDiagnosis, Dock.Top);
            PatientPanel.Children.Add(panelAllDiagnosis);

            foreach (var disease in _listPatientDiagnosis.Where(disease => CheckBoxViewDiagnosisDepartment.IsChecked == null || (!CheckBoxViewDiagnosisDepartment.IsChecked.Value || disease.IdDepartment == Worker.IdDepartment)))
            {
                panelAllDiagnosis.Visibility = Visibility.Visible;
                if (disease.IdWorker == "0" && disease.Snp == "0")
                {
                    WpfMessageBox.Show("Відсутнє підключення до сервера. \n Зверніться до адміністратора!");
                    Close();
                }
                var paneldiagnosis1 = new DockPanel
                {
                    Background = Brushes.LightSkyBlue,
                    Margin = new Thickness(15, 15, 15, 15)
                };
                var paneldiagnosis = new DockPanel
                {
                    Background = Brushes.WhiteSmoke,
                    Margin = new Thickness(3, 3, 3, 3)
                };
                var photoDiagnosisScrollViewer = new ScrollViewer
                {
                    VerticalScrollBarVisibility = ScrollBarVisibility.Disabled,
                    HorizontalScrollBarVisibility = ScrollBarVisibility.Auto,
                    CanContentScroll = true
                };
                var paneldiagnosisphoto = new DockPanel
                {
                    Background = Brushes.WhiteSmoke,
                    Margin = new Thickness(3, 3, 3, 3)
                };
                var disease2 = disease;
                foreach (var loadPhotoDiagnosis in LoadPhotoDiagnosis.PhotoDiagnosis.Where(loadPhotoDiagnosis => loadPhotoDiagnosis.IdDiagnosis == disease2.IdDiagnosis))
                {
                    var photo = await LoadPhoto(loadPhotoDiagnosis.Photo);
                    var buttonPhotoDiagnosis = new Button
                    {
                        Background = new ImageBrush(photo),
                        Foreground = Brushes.MediumBlue,
                        FontWeight = FontWeights.Bold,
                        Content = " ",
                        Height = 160,
                        Width = 160,
                        HorizontalAlignment = HorizontalAlignment.Left,
                    };
                    buttonPhotoDiagnosis.Click += (o, args) =>
                    {
                        var form = new PhotoInfo(photo);
                        form.Show();
                    };
                    DockPanel.SetDock(paneldiagnosisphoto, Dock.Top);
                    paneldiagnosisphoto.Children.Add(buttonPhotoDiagnosis);
                }
                var labeldiagnosis = new Label
                {

                    Content = string.Format(
                        "Захворювання: {0} \n Діагноз: {1} \n Лікування: {2} \n Дата встановлення захворювання: {3}\n Лікар: {4}",
                        disease.NameDisease,
                        disease.Disease,
                        disease.Treatment,
                        disease.DateOnset,
                        disease.Snp),
                    Margin = new Thickness(10, 10, 10, 10),
                };

                var panelallprocedure = new DockPanel
                {
                    Background = Brushes.LightSkyBlue,
                    Margin = new Thickness(0, 0, 0, 0),
                };
                var intProcedure = 0;
                foreach (var procedure in Procedure.ListProcedure)
                {
                    if (procedure.IdDiagnosis != disease.IdDiagnosis) continue;
                    var panelprocedure1 = new DockPanel
                    {
                        Background = new SolidColorBrush(Color.FromRgb(244, 244, 40)),
                        Margin = new Thickness(5, 5, 5, 5),
                    };

                    var panelprocedure = new DockPanel
                    {
                        Background = Brushes.LightSteelBlue,
                        Margin = new Thickness(3, 3, 3, 3),
                    };
                    var photoProcedureScrollViewer = new ScrollViewer
                    {
                        VerticalScrollBarVisibility = ScrollBarVisibility.Disabled,
                        HorizontalScrollBarVisibility = ScrollBarVisibility.Auto,
                        CanContentScroll = true
                    };
                    var panelprocedurephoto = new DockPanel
                    {
                        Background = Brushes.WhiteSmoke,
                        Margin = new Thickness(3, 3, 3, 3)
                    };
                    foreach (var loadPhotoProcedure in LoadPhotoProcedure.PhotoProcedures)
                    {
                        if (loadPhotoProcedure.IdProcedure != procedure.IdProcedure)
                        {
                            var photo = await LoadPhoto(loadPhotoProcedure.Photo);
                            var buttonPhotoProcedure = new Button
                            {
                                Background = new ImageBrush(photo),
                                Foreground = Brushes.MediumBlue,
                                FontWeight = FontWeights.Bold,
                                Content = " ",
                                Height = 160,
                                Width = 160,
                                HorizontalAlignment = HorizontalAlignment.Left,
                            };
                            buttonPhotoProcedure.Click += (o, args) =>
                            {
                                var form = new PhotoInfo(photo);
                                form.Show();
                            };
                            DockPanel.SetDock(buttonPhotoProcedure, Dock.Left);
                            panelprocedurephoto.Children.Add(buttonPhotoProcedure);

                        }
                    }
                    var labelprocedure = new Label
                    {
                        Content = string.Format(
                            "Процедура: {0} \n Результат: {1} \n Дата: {2} \n Лікар: {3}",
                            procedure.NameProcedure,
                            procedure.Result,
                            procedure.DateOnset,
                            procedure.Snp),
                        Margin = new Thickness(10, 10, 10, 10),
                    };
                    intProcedure = intProcedure + 1;
                    photoProcedureScrollViewer.Content = panelprocedurephoto;
                    photoProcedureScrollViewer.PreviewMouseWheel += (o, args) =>
                    {
                        if (args.Delta > 0)
                        {
                            ScrollViewerFull.ScrollToVerticalOffset(ScrollViewerFull.VerticalOffset - 48);
                        }

                        else
                        {
                            ScrollViewerFull.ScrollToVerticalOffset(ScrollViewerFull.VerticalOffset + 48);
                        }
                    };
                    DockPanel.SetDock(panelprocedurephoto, Dock.Top);
                    DockPanel.SetDock(panelprocedure1, Dock.Top);
                    DockPanel.SetDock(panelprocedure, Dock.Top);
                    DockPanel.SetDock(labelprocedure, Dock.Top);
                    panelprocedure.Children.Add(labelprocedure);
                    panelprocedure.Children.Add(photoProcedureScrollViewer);
                    panelprocedure1.Children.Add(panelprocedure);
                    panelallprocedure.Children.Add(panelprocedure1);
                    var procedure1 = procedure;
                    labelprocedure.MouseDoubleClick += (o, args) =>
                    {
                        var form = new WorkerInfo(procedure1.IdWorker);
                        form.ShowDialog();
                    };
                }
                if (intProcedure != 0)
                {
                    var gradient = new LinearGradientBrush {StartPoint = new Point(0, 0), EndPoint = new Point(1, 1)};
                    var buttonopenprocedure = new Button
                    {
                        Background = gradient,
                        Foreground = Brushes.MediumBlue,
                        FontWeight = FontWeights.Bold,
                        Content = "Переглянути процедури",
                        Height = 20,
                        Width = 450
                    };
                    gradient.GradientStops.Add(new GradientStop
                    {
                        Color = Color.FromArgb(255, 249, 249, 200),
                        Offset = 0
                    });
                    gradient.GradientStops.Add(new GradientStop
                    {
                        Color = Color.FromArgb(255, 251, 228, 0),
                        Offset = 1
                    });
                    DockPanel.SetDock(buttonopenprocedure, Dock.Bottom);
                    paneldiagnosis1.Children.Add(buttonopenprocedure);
                    panelallprocedure.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
                    panelallprocedure.Arrange(new Rect(new Point(0, 0), panelallprocedure.DesiredSize));
                    var panelHeight = panelallprocedure.ActualHeight;
                    panelallprocedure.Height = 0;
                    var isToggle = new bool();
                    buttonopenprocedure.Click += (o, args) =>
                    {
                        var da = new DoubleAnimation();
                        if (!isToggle)
                        {
                            da.From = 450;
                            da.To = 800;
                            da.Duration = TimeSpan.FromSeconds(0.5);
                            buttonopenprocedure.BeginAnimation(WidthProperty, da);
                            da.From = 0;
                            da.To = panelHeight;
                            da.Duration = TimeSpan.FromSeconds(0.5);
                            panelallprocedure.BeginAnimation(HeightProperty, da);
                            isToggle = true;
                            buttonopenprocedure.Content = "Закрити";

                        }
                        else
                        {
                            da.From = 800;
                            da.To = 450;
                            da.Duration = TimeSpan.FromSeconds(0.5);
                            buttonopenprocedure.BeginAnimation(WidthProperty, da);
                            da.From = panelHeight;
                            da.To = 0;
                            da.Duration = TimeSpan.FromSeconds(0.5);
                            panelallprocedure.BeginAnimation(HeightProperty, da);
                            isToggle = false;
                            buttonopenprocedure.Content = "Переглянути процедури";
                        }
                    };
                }
                DockPanel.SetDock(paneldiagnosis1, Dock.Top);
                DockPanel.SetDock(panelallprocedure, Dock.Top);
                DockPanel.SetDock(paneldiagnosis, Dock.Top);
                photoDiagnosisScrollViewer.Content = paneldiagnosisphoto;
                photoDiagnosisScrollViewer.PreviewMouseWheel += (o, args) =>
                {
                    if (args.Delta > 0)
                    {
                        ScrollViewerFull.ScrollToVerticalOffset(ScrollViewerFull.VerticalOffset - 48);
                    }

                    else
                    {
                        ScrollViewerFull.ScrollToVerticalOffset(ScrollViewerFull.VerticalOffset + 48);
                    }
                };
                DockPanel.SetDock(paneldiagnosisphoto, Dock.Top);
                DockPanel.SetDock(labeldiagnosis, Dock.Top);
                paneldiagnosis.Children.Add(labeldiagnosis);
                paneldiagnosis.Children.Add(photoDiagnosisScrollViewer);
                paneldiagnosis1.Children.Add(paneldiagnosis);
                paneldiagnosis1.Children.Add(panelallprocedure);
                panelAllDiagnosis.Children.Add(paneldiagnosis1);
                var disease1 = disease;
                labeldiagnosis.MouseDoubleClick += (o, args) =>
                {
                    var form = new WorkerInfo(disease1.IdWorker);
                    form.ShowDialog();
                };
                PatientPanel.Visibility = Visibility.Visible;
            }
        }
        private async void FindVisit()
        {
            foreach (var acceptance in Acceptance.ListAcceptance)
            {
                if (DateTime.Parse(acceptance.Date).Date>= DateTime.Now.Date && acceptance.PatientIdPatient==Patient.IdPatient)
                {
                    WpfMessageBox.Show("Пацієнт записаний на прийом!\n "+"Дата: "+acceptance.Date+" Час: "+acceptance.Time);
                }
            }
            var panelgradient = new LinearGradientBrush()
            {
                StartPoint = new Point(0.5, 0),
                EndPoint = new Point(0.5, 1)
            };
            panelgradient.GradientStops.Add(new GradientStop {Color = Color.FromArgb(255, 255, 255, 255), Offset = 0});
            panelgradient.GradientStops.Add(new GradientStop {Color = Color.FromArgb(128, 255, 255, 255), Offset = 1});
            var panelAllVisit = new DockPanel
            {

                Margin = new Thickness(15, 15, 15, 15),
                Visibility = Visibility.Hidden,
                Background = panelgradient
            };

            var labelstartvisit = new Label
            {
                Content = "Записи",
                Foreground = Brushes.MediumBlue,
                FontWeight = FontWeights.Bold
            };
            DockPanel.SetDock(labelstartvisit, Dock.Top);
            panelAllVisit.Children.Add(labelstartvisit);
            DockPanel.SetDock(panelAllVisit, Dock.Top);
            PatientPanel.Children.Add(panelAllVisit);
            foreach (var visit in _listPatientVisits.Where(visit => CheckBoxViewDiagnosisDepartment.IsChecked == null || (!CheckBoxViewDiagnosisDepartment.IsChecked.Value || visit.IdDepartment == Worker.IdDepartment)))
            {
                panelAllVisit.Visibility = Visibility.Visible;
                if (visit.IdWorker == "0" && visit.Snp == "0")
                {
                    WpfMessageBox.Show("Відсутнє підключення до сервера. \n Зверніться до адміністратора!");
                    Close();
                }
                var panelvisit1 = new DockPanel
                {
                    Background = Brushes.LightSkyBlue,
                    Margin = new Thickness(15, 15, 15, 15),
                };

                var panelvisit = new DockPanel
                {
                    Background = Brushes.WhiteSmoke,
                    Margin = new Thickness(3, 3, 3, 3),
                };
                var photoVisitsScrollViewer = new ScrollViewer
                {
                    VerticalScrollBarVisibility = ScrollBarVisibility.Disabled,
                    HorizontalScrollBarVisibility = ScrollBarVisibility.Auto,
                    CanContentScroll = true

                };
                var panelvisitphoto = new DockPanel
                {
                    Background = Brushes.WhiteSmoke,
                    Margin = new Thickness(3, 3, 3, 3)
                };
                var visit2 = visit;
                foreach (var loadPhotoVisits in LoadPhotoVisits.PhotoVisits.Where(loadPhotoVisits => loadPhotoVisits.IdVisits == visit2.IdVisit))
                {
                    var photo = await LoadPhoto(loadPhotoVisits.Photo);
                    var buttonPhotoVisits = new Button
                    {
                        Background = new ImageBrush(photo),
                        Foreground = Brushes.MediumBlue,
                        FontWeight = FontWeights.Bold,
                        Content = " ",
                        Height = 160,
                        Width = 160,
                        HorizontalAlignment = HorizontalAlignment.Left
                    };

                    buttonPhotoVisits.Click += (o, args) =>
                    {
                        var form = new PhotoInfo(photo);
                        form.Show();
                    };
                    DockPanel.SetDock(panelvisitphoto, Dock.Top);
                    panelvisitphoto.Children.Add(buttonPhotoVisits);
                }
                var labelvisit = new Label
                {

                    Content = string.Format(
                        "Причина: {0} \n Скарги: {1} \n Огляд: {2} \n Дата: {3}\n Лікар: {4} ",
                        visit.Reason,
                        visit.Complaints,
                        visit.Inspection,
                        visit.VisitDateOnset,
                        visit.Snp),
                    Margin = new Thickness(10, 10, 10, 10),
                };

                var panelallanalysis = new DockPanel
                {
                    Background = Brushes.LightSkyBlue,
                    Margin = new Thickness(0, 0, 0, 0),
                };
                var intAnalysis = 0;
                foreach (var analysis in Analysis.ListAnalysis)
                {
                    if (analysis.IdVisit != visit.IdVisit) continue;
                    var panelanalysis1 = new DockPanel
                    {
                        Background = new SolidColorBrush(Color.FromRgb(244, 244, 40)),
                        Margin = new Thickness(5, 5, 5, 5),
                    };

                    var panelanalysis = new DockPanel
                    {
                        Background = Brushes.LightSteelBlue,
                        Margin = new Thickness(3, 3, 3, 3),
                    };
                    var photoAnalysisScrollViewer = new ScrollViewer
                    {
                        VerticalScrollBarVisibility = ScrollBarVisibility.Disabled,
                        HorizontalScrollBarVisibility = ScrollBarVisibility.Auto,
                        CanContentScroll = true

                    };
                    var panelanalysisphoto = new DockPanel
                    {
                        Background = Brushes.WhiteSmoke,
                        Margin = new Thickness(3, 3, 3, 3)
                    };
                    foreach (var loadPhotoAnalysis in LoadPhotoAnalysis.PhotoAnalysis)
                    {
                        if (loadPhotoAnalysis.IdAnalysis == analysis.IdAnalysis)
                        {
                            var photo = await LoadPhoto(loadPhotoAnalysis.Photo);
                            var buttonPhotoAnalysis = new Button
                            {
                                Background = new ImageBrush(photo),
                                Foreground = Brushes.MediumBlue,
                                FontWeight = FontWeights.Bold,
                                Content = " ",
                                Height = 160,
                                Width = 160,
                                HorizontalAlignment = HorizontalAlignment.Left,
                            };
                            buttonPhotoAnalysis.Click += (o, args) =>
                            {
                                var form = new PhotoInfo(photo);
                                form.Show();
                            };
                            DockPanel.SetDock(buttonPhotoAnalysis, Dock.Left);
                            panelanalysisphoto.Children.Add(buttonPhotoAnalysis);
                        }
                    }
                    var labelanalysis = new Label
                    {

                        Content = string.Format(
                            "Назва: {0} \n Показники: {1} \n Заключення: {2} \n Дата: {3} \n Лікар: {4}",
                            analysis.NameAnalysis,
                            analysis.Indicators,
                            analysis.Result,
                            analysis.AnalysisDateOnset,
                            analysis.Snp),
                        Margin = new Thickness(10, 10, 10, 10),
                    };
                    intAnalysis = intAnalysis + 1;
                    photoAnalysisScrollViewer.Content = panelanalysisphoto;
                    photoAnalysisScrollViewer.PreviewMouseWheel += (o, args) =>
                    {
                        if (args.Delta > 0)
                        {
                            ScrollViewerFull.ScrollToVerticalOffset(ScrollViewerFull.VerticalOffset - 48);
                        }

                        else
                        {
                            ScrollViewerFull.ScrollToVerticalOffset(ScrollViewerFull.VerticalOffset + 48);
                        }
                    };
                    DockPanel.SetDock(panelallanalysis, Dock.Top);
                    DockPanel.SetDock(panelanalysis1, Dock.Top);
                    DockPanel.SetDock(panelanalysis, Dock.Top);
                    DockPanel.SetDock(labelanalysis, Dock.Top);
                    panelanalysis.Children.Add(labelanalysis);
                    panelanalysis.Children.Add(photoAnalysisScrollViewer);
                    panelanalysis1.Children.Add(panelanalysis);
                    panelallanalysis.Children.Add(panelanalysis1);
                    var analysis1 = analysis;
                    labelanalysis.MouseDoubleClick += (o, args) =>
                    {
                        var form = new WorkerInfo(analysis1.IdWorker);
                        form.ShowDialog();
                    };
                }
                if (intAnalysis != 0)
                {
                    var gradient = new LinearGradientBrush {StartPoint = new Point(0, 0), EndPoint = new Point(1, 1)};
                    var buttonopenanalisis = new Button
                    {
                        Background = gradient,
                        Foreground = Brushes.MediumBlue,
                        FontWeight = FontWeights.Bold,
                        Content = "Переглянути аналізи",
                        Height = 20,
                        Width = 450
                    };
                    gradient.GradientStops.Add(new GradientStop
                    {
                        Color = Color.FromArgb(255, 249, 249, 200),
                        Offset = 0
                    });
                    gradient.GradientStops.Add(new GradientStop
                    {
                        Color = Color.FromArgb(255, 251, 228, 0),
                        Offset = 1
                    });

                    DockPanel.SetDock(buttonopenanalisis, Dock.Bottom);
                    panelvisit1.Children.Add(buttonopenanalisis);
                    panelallanalysis.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
                    panelallanalysis.Arrange(new Rect(new Point(0, 0), panelallanalysis.DesiredSize));
                    var panelHeight = panelallanalysis.ActualHeight;
                    panelallanalysis.Height = 0;
                    var isToggle = new bool();
                    buttonopenanalisis.Click += (o, args) =>
                    {
                        var da = new DoubleAnimation();
                        if (!isToggle)
                        {
                            da.From = 450;
                            da.To = 800;
                            da.Duration = TimeSpan.FromSeconds(0.5);
                            buttonopenanalisis.BeginAnimation(WidthProperty, da);
                            da.From = 0;
                            da.To = panelHeight;
                            da.Duration = TimeSpan.FromSeconds(0.5);
                            panelallanalysis.BeginAnimation(HeightProperty, da);
                            isToggle = true;
                            buttonopenanalisis.Content = "Закрити";

                        }
                        else
                        {
                            da.From = 800;
                            da.To = 450;
                            da.Duration = TimeSpan.FromSeconds(0.5);
                            buttonopenanalisis.BeginAnimation(WidthProperty, da);
                            da.From = panelHeight;
                            da.To = 0;
                            da.Duration = TimeSpan.FromSeconds(0.5);
                            panelallanalysis.BeginAnimation(HeightProperty, da);
                            isToggle = false;
                            buttonopenanalisis.Content = "Переглянути аналізи";
                        }
                    };
                }
                DockPanel.SetDock(panelvisit1, Dock.Top);
                DockPanel.SetDock(panelallanalysis, Dock.Top);
                DockPanel.SetDock(panelvisit, Dock.Top);
                photoVisitsScrollViewer.Content = panelvisitphoto;
                photoVisitsScrollViewer.PreviewMouseWheel += (o, args) =>
                {
                    if (args.Delta > 0)
                    {
                        ScrollViewerFull.ScrollToVerticalOffset(ScrollViewerFull.VerticalOffset - 48);
                    }

                    else
                    {
                        ScrollViewerFull.ScrollToVerticalOffset(ScrollViewerFull.VerticalOffset + 48);
                    }
                };
                DockPanel.SetDock(panelvisitphoto, Dock.Top);
                DockPanel.SetDock(labelvisit, Dock.Top);
                panelvisit.Children.Add(labelvisit);
                panelvisit.Children.Add(photoVisitsScrollViewer);
                panelvisit1.Children.Add(panelvisit);
                panelvisit1.Children.Add(panelallanalysis);
                panelAllVisit.Children.Add(panelvisit1);
                var visit1 = visit;
                labelvisit.MouseDoubleClick += (o, args) =>
                {
                    var form = new WorkerInfo(visit1.IdWorker);
                    form.ShowDialog();
                };
                PatientPanel.Visibility = Visibility.Visible;
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Creates the property panel.
        /// </summary>
        /// <param name="pi">
        /// The pi.
        /// </param>
        /// <param name="instance">
        /// The instance.
        /// </param>
        /// <param name="maxLabelWidth">
        /// Width of the max label.
        /// </param>
        /// <returns>
        /// The property panel.
        /// </returns>
        private UIElement CreatePropertyPanel(PropertyItem pi, object instance, ref double maxLabelWidth)
        {
            var propertyPanel = new DockPanel { Margin = new Thickness(2) };
            var propertyLabel = this.CreateLabel(pi);
            var propertyControl = this.CreatePropertyControl(pi);
            if (propertyControl != null)
            {
                if (!double.IsNaN(pi.Width))
                {
                    propertyControl.Width = pi.Width;
                    propertyControl.HorizontalAlignment = HorizontalAlignment.Left;
                }

                if (!double.IsNaN(pi.Height))
                {
                    propertyControl.Height = pi.Height;
                }

                if (!double.IsNaN(pi.MinimumHeight))
                {
                    propertyControl.MinHeight = pi.MinimumHeight;
                }

                if (!double.IsNaN(pi.MaximumHeight))
                {
                    propertyControl.MaxHeight = pi.MaximumHeight;
                }

                if (pi.IsOptional)
                {
                    if (pi.OptionalDescriptor != null)
                    {
                        propertyControl.SetBinding(IsEnabledProperty, new Binding(pi.OptionalDescriptor.Name));
                    }
                    else
                    {
                        propertyControl.SetBinding(
                            IsEnabledProperty, new Binding(pi.Descriptor.Name) { Converter = NullToBoolConverter });
                    }
                }

                if (instance is IDataErrorInfo)
                {
                    if (this.ValidationTemplate != null)
                    {
                        Validation.SetErrorTemplate(propertyControl, this.ValidationTemplate);
                    }

                    if (this.ValidationErrorStyle != null)
                    {
                        propertyControl.Style = this.ValidationErrorStyle;
                    }

                    var errorControl = new ContentControl { ContentTemplate = this.ValidationErrorTemplate };
                    errorControl.SetBinding(
                        VisibilityProperty,
                        new Binding("(Validation.HasError)")
                            {
                                Source = propertyControl,
                                Converter = BoolToVisibilityConverter
                            });
                    errorControl.SetBinding(
                        ContentControl.ContentProperty, new Binding("(Validation.Errors)") { Source = propertyControl });

                    // replace the property control by a stack panel containig the property control and the error control.
                    var sp = new StackPanel();
                    sp.VerticalAlignment = VerticalAlignment.Center;
                    sp.Children.Add(propertyControl);
                    sp.Children.Add(errorControl);
                    propertyControl = sp;
                }
            }

            var actualHeaderPlacement = pi.HeaderPlacement;

            if (!this.ShowCheckBoxHeaders && propertyControl is CheckBox)
            {
                actualHeaderPlacement = HeaderPlacement.Collapsed;
                var cb = propertyControl as CheckBox;
                cb.Content = propertyLabel;

                propertyLabel = null;
            }

            switch (actualHeaderPlacement)
            {
                case HeaderPlacement.Hidden:
                    {
                        var labelPanel = new DockPanel();
                        labelPanel.SetBinding(MinWidthProperty, new Binding("ActualLabelWidth") { Source = this });
                        propertyPanel.Children.Add(labelPanel);
                        break;
                    }

                case HeaderPlacement.Collapsed:
                    break;
                default:
                    {
                        // create the label panel
                        var labelPanel = new DockPanel();
                        if (pi.HeaderPlacement == HeaderPlacement.Left)
                        {
                            DockPanel.SetDock(labelPanel, Dock.Left);
                            labelPanel.SetBinding(MinWidthProperty, new Binding("ActualLabelWidth") { Source = this });
                        }
                        else
                        {
                            DockPanel.SetDock(labelPanel, Dock.Top);
                        }

                        propertyPanel.Children.Add(labelPanel);

                        if (propertyLabel != null)
                        {
                            DockPanel.SetDock(propertyLabel, Dock.Left);
                            labelPanel.Children.Add(propertyLabel);
                        }

                        if (this.ShowDescriptionIcons && this.DescriptionIcon != null)
                        {
                            if (!string.IsNullOrWhiteSpace(pi.Description))
                            {
                                var descriptionIconImage = new Image
                                    {
                                        Source = this.DescriptionIcon,
                                        Stretch = Stretch.None,
                                        Margin = new Thickness(0, 4, 4, 4),
                                        VerticalAlignment = VerticalAlignment.Top
                                    };

                                // RenderOptions.SetBitmapScalingMode(descriptionIconImage, BitmapScalingMode.NearestNeighbor);
                                descriptionIconImage.HorizontalAlignment = this.DescriptionIconAlignment;
                                labelPanel.Children.Add(descriptionIconImage);
                                if (!string.IsNullOrWhiteSpace(pi.Description))
                                {
                                    descriptionIconImage.ToolTip = this.CreateToolTip(pi.Description);
                                }
                            }
                        }
                        else
                        {
                            labelPanel.ToolTip = this.CreateToolTip(pi.Description);
                        }

                        // measure the size of the label and tooltip icon
                        labelPanel.Measure(new Size(this.ActualWidth, this.ActualHeight));
                        maxLabelWidth = Math.Max(maxLabelWidth, labelPanel.DesiredSize.Width);
                    }

                    break;
            }

            // add the property control
            if (propertyControl != null)
            {
                propertyPanel.Children.Add(propertyControl);
            }

            if (pi.IsEnabledDescriptor != null)
            {
                propertyPanel.SetBinding(IsEnabledProperty, new Binding(pi.IsEnabledDescriptor.Name));
            }

            if (pi.IsVisibleDescriptor != null)
            {
                propertyPanel.SetBinding(
                    VisibilityProperty,
                    new Binding(pi.IsVisibleDescriptor.Name) { Converter = BoolToVisibilityConverter });
            }

            return propertyPanel;
        }
Exemplo n.º 8
0
        private void FindVisit(List<Visit> list)
        {
            LinearGradientBrush panelgradient = new LinearGradientBrush()
            {
                StartPoint = new Point(0.5, 0),
                EndPoint = new Point(0.5, 1)
            };
            panelgradient.GradientStops.Add(new GradientStop() {Color = Color.FromArgb(255, 255, 255, 255), Offset = 0});
            panelgradient.GradientStops.Add(new GradientStop() {Color = Color.FromArgb(128, 255, 255, 255), Offset = 1});
            DockPanel panelAllVisit = new DockPanel
            {

                Margin = new Thickness(15, 15, 15, 15),
                Visibility = Visibility.Hidden,
                Background = panelgradient
            };

            Label labelstartvisit = new Label
            {
                Content = "Записи",
                Foreground = Brushes.MediumBlue,
                FontWeight = FontWeights.Bold
            };
            DockPanel.SetDock(labelstartvisit, Dock.Top);
            panelAllVisit.Children.Add(labelstartvisit);
            DockPanel.SetDock(panelAllVisit, Dock.Top);
            PatientsPanel.Children.Add(panelAllVisit);
            foreach (Visit visit in list)
            {
                panelAllVisit.Visibility = Visibility.Visible;
                if (visit.IdWorker == "0" && visit.Snp == "0")
                {
                    WpfMessageBox.Show("Відсутнє підключення до сервера. \n Зверніться до адміністратора!");
                    Close();
                }
                DockPanel panelvisit1 = new DockPanel
                {
                    Background = Brushes.LightSkyBlue,
                    Margin = new Thickness(15, 15, 15, 15),
                };

                DockPanel panelvisit = new DockPanel
                {
                    Background = Brushes.WhiteSmoke,
                    Margin = new Thickness(3, 3, 3, 3),
                };


                Label labelvisit = new Label
                {

                    Content = string.Format(
                        "Причина: {0} \n Скарги: {1} \n Огляд: {2} \n Дата: {3}\n Лікар: {4} ",
                        visit.Reason,
                        visit.Complaints,
                        visit.Inspection,
                        visit.VisitDateOnset,
 visit.Snp),
                    Margin = new Thickness(10, 10, 10, 10),
                };

                DockPanel panelallanalysis = new DockPanel
                {
                    Background = Brushes.LightSkyBlue,
                    Margin = new Thickness(0, 0, 0, 0),
                };
                int intAnalysis = 0;
                foreach (var analysis in Analysis.ListAnalysis)
                {
                    if (analysis.IdVisit == visit.IdVisit)
                    {
                        DockPanel panelanalysis1 = new DockPanel
                        {
                            Background = new SolidColorBrush(Color.FromRgb(244, 244, 40)),
                            Margin = new Thickness(5, 5, 5, 5),
                        };

                        DockPanel panelanalysis = new DockPanel
                        {
                            Background = Brushes.LightSteelBlue,
                            Margin = new Thickness(3, 3, 3, 3),
                        };


                        Label labelanalysis = new Label
                        {

                            Content = string.Format(
                                "Назва: {0} \n Показники: {1} \n Заключення: {2} \n Дата: {3} \n Лікар: {4}",
                                analysis.NameAnalysis,
                                analysis.Indicators,
                                analysis.Result,
                                analysis.AnalysisDateOnset,
                                analysis.Snp),
                            Margin = new Thickness(10, 10, 10, 10),
                        };
                        intAnalysis = intAnalysis + 1;
                        DockPanel.SetDock(panelanalysis1, Dock.Top);
                        DockPanel.SetDock(panelanalysis, Dock.Top);
                        DockPanel.SetDock(labelanalysis, Dock.Top);
                        panelanalysis.Children.Add(labelanalysis);
                        panelanalysis1.Children.Add(panelanalysis);
                        panelallanalysis.Children.Add(panelanalysis1);
                        var analysis1 = analysis;
                        labelanalysis.MouseDoubleClick += (o, args) =>
                        {
                            PatientInfo form = new PatientInfo(analysis1.IdPatient);
                            form.ShowDialog();
                        };
                    }
                }
                if (intAnalysis != 0)
                {
                    LinearGradientBrush gradient = new LinearGradientBrush();
                    gradient.StartPoint = new Point(0, 0);
                    gradient.EndPoint = new Point(1, 1);
                    Button buttonopenanalisis = new Button
                    {
                        Background = gradient,
                        Foreground = Brushes.MediumBlue,
                        FontWeight = FontWeights.Bold,
                        Content = "Переглянути аналізи",
                        Height = 20,
                        Width = 450
                    };
                    gradient.GradientStops.Add(new GradientStop()
                    {
                        Color = Color.FromArgb(255, 249, 249, 200),
                        Offset = 0
                    });
                    gradient.GradientStops.Add(new GradientStop()
                    {
                        Color = Color.FromArgb(255, 251, 228, 0),
                        Offset = 1
                    });

                    DockPanel.SetDock(buttonopenanalisis, Dock.Bottom);
                    panelvisit1.Children.Add(buttonopenanalisis);
                    panelallanalysis.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
                    panelallanalysis.Arrange(new Rect(new Point(0, 0), panelallanalysis.DesiredSize));
                    double panelHeight = panelallanalysis.ActualHeight;
                    panelallanalysis.Height = 0;
                    bool isToggle = new bool();
                    buttonopenanalisis.Click += (o, args) =>
                    {
                        DoubleAnimation da = new DoubleAnimation();
                        if (!isToggle)
                        {
                            da.From = 450;
                            da.To = 800;
                            da.Duration = TimeSpan.FromSeconds(1);
                            buttonopenanalisis.BeginAnimation(WidthProperty, da);
                            da.From = 0;
                            da.To = panelHeight;
                            da.Duration = TimeSpan.FromSeconds(1);
                            panelallanalysis.BeginAnimation(HeightProperty, da);
                            isToggle = true;
                            buttonopenanalisis.Content = "Закрити";

                        }
                        else
                        {
                            da.From = 800;
                            da.To = 450;
                            da.Duration = TimeSpan.FromSeconds(1);
                            buttonopenanalisis.BeginAnimation(WidthProperty, da);
                            da.From = panelHeight;
                            da.To = 0;
                            da.Duration = TimeSpan.FromSeconds(1);
                            panelallanalysis.BeginAnimation(HeightProperty, da);
                            isToggle = false;
                            buttonopenanalisis.Content = "Переглянути процедури";
                        }
                    };
                }
                DockPanel.SetDock(panelvisit1, Dock.Top);
                DockPanel.SetDock(panelallanalysis, Dock.Top);
                DockPanel.SetDock(panelvisit, Dock.Top);
                DockPanel.SetDock(labelvisit, Dock.Top);
                panelvisit.Children.Add(labelvisit);
                panelvisit1.Children.Add(panelvisit);
                panelvisit1.Children.Add(panelallanalysis);
                panelAllVisit.Children.Add(panelvisit1);
                var visit1 = visit;
                labelvisit.MouseDoubleClick += (o, args) =>
                {
                    PatientInfo form = new PatientInfo(visit1.IdPatient);
                    form.ShowDialog();
                };
                PatientsPanel.Visibility = Visibility.Visible;
            }
        }
Exemplo n.º 9
0
        private void FindDiagnosis(List<Diagnosis> list)
        {
            LinearGradientBrush panelgradient = new LinearGradientBrush()
            {
                StartPoint = new Point(0.5, 0),
                EndPoint = new Point(0.5, 1)
            };
            panelgradient.GradientStops.Add(new GradientStop() {Color = Color.FromArgb(255, 255, 255, 255), Offset = 0});
            panelgradient.GradientStops.Add(new GradientStop() {Color = Color.FromArgb(198, 250, 225, 4), Offset = 1});
            DockPanel panelAllDiagnosis = new DockPanel
            {
                Background = panelgradient,
                Margin = new Thickness(15, 15, 15, 15),
                Visibility = Visibility.Hidden
            };
            Label labelstartdiagnosis = new Label
            {
                Content = "Діагнози",
                Foreground = Brushes.MediumBlue,
                FontWeight = FontWeights.Bold
            };
            DockPanel.SetDock(panelAllDiagnosis, Dock.Top);
            PatientsPanel.Children.Add(panelAllDiagnosis);
            DockPanel.SetDock(labelstartdiagnosis, Dock.Top);
            panelAllDiagnosis.Children.Add(labelstartdiagnosis);

            foreach (Diagnosis disease in list)
            {
                panelAllDiagnosis.Visibility = Visibility.Visible;
                if (disease.IdWorker == "0" && disease.Snp == "0")
                {
                    WpfMessageBox.Show("Відсутнє підключення до сервера. \n Зверніться до адміністратора!");
                    Close();
                }
                DockPanel paneldiagnosis1 = new DockPanel
                {
                    Background = Brushes.LightSkyBlue,
                    Margin = new Thickness(15, 15, 15, 15),
                };

                DockPanel paneldiagnosis = new DockPanel
                {
                    Background = Brushes.WhiteSmoke,
                    Margin = new Thickness(3, 3, 3, 3),
                };


                Label labeldiagnosis = new Label
                {

                    Content = string.Format(
                        "Назва: {0} \n Діагноз: {1} \n Лікування: {2} \n Дата встановлення захворювання: {3}\n Лікар: {4}",
                        disease.Disease,
                        disease.Disease,
                        disease.Treatment,
                        disease.DateOnset,
                        disease.Snp),
                    Margin = new Thickness(10, 10, 10, 10),
                };

                DockPanel panelallprocedure = new DockPanel
                {
                    Background = Brushes.LightSkyBlue,
                    Margin = new Thickness(0, 0, 0, 0),
                };
                int intProcedure = 0;
                foreach (var procedure in Procedure.ListProcedure)
                {
                    if (procedure.IdDiagnosis == disease.IdDiagnosis)
                    {
                        DockPanel panelprocedure1 = new DockPanel
                        {
                            Background = new SolidColorBrush(Color.FromRgb(244, 244, 40)),
                            Margin = new Thickness(5, 5, 5, 5),
                        };

                        DockPanel panelprocedure = new DockPanel
                        {
                            Background = Brushes.LightSteelBlue,
                            Margin = new Thickness(3, 3, 3, 3),
                        };


                        Label labelprocedure = new Label
                        {

                            Content = string.Format(
                                "Процедура: {0} \n Результат: {1} \n Дата: {2} \n Лікар: {3}",
                                procedure.NameProcedure,
                                procedure.Result,
                                procedure.DateOnset,
                                procedure.Snp),
                            Margin = new Thickness(10, 10, 10, 10),
                        };
                        intProcedure = intProcedure + 1;
                        DockPanel.SetDock(panelprocedure1, Dock.Top);
                        DockPanel.SetDock(panelprocedure, Dock.Top);
                        DockPanel.SetDock(labelprocedure, Dock.Top);
                        panelprocedure.Children.Add(labelprocedure);
                        panelprocedure1.Children.Add(panelprocedure);
                        panelallprocedure.Children.Add(panelprocedure1);
                        var procedure1 = procedure;
                        labelprocedure.MouseDoubleClick += (o, args) =>
                        {
                            PatientInfo form = new PatientInfo(procedure1.IdPatient);
                            form.ShowDialog();
                        };
                    }
                }
                if (intProcedure != 0)
                {
                    LinearGradientBrush gradient = new LinearGradientBrush();
                    gradient.StartPoint = new Point(0, 0);
                    gradient.EndPoint = new Point(1, 1);
                    Button buttonopenprocedure = new Button
                    {
                        Background = gradient,
                        Foreground = Brushes.MediumBlue,
                        FontWeight = FontWeights.Bold,
                        Content = "Переглянути процедури",
                        Height = 20,
                        Width = 450
                    };
                    gradient.GradientStops.Add(new GradientStop()
                    {
                        Color = Color.FromArgb(255, 249, 249, 200),
                        Offset = 0
                    });
                    gradient.GradientStops.Add(new GradientStop()
                    {
                        Color = Color.FromArgb(255, 251, 228, 0),
                        Offset = 1
                    });

                    DockPanel.SetDock(buttonopenprocedure, Dock.Bottom);
                    paneldiagnosis1.Children.Add(buttonopenprocedure);
                    panelallprocedure.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
                    panelallprocedure.Arrange(new Rect(new Point(0, 0), panelallprocedure.DesiredSize));
                    double panelHeight = panelallprocedure.ActualHeight;
                    panelallprocedure.Height = 0;
                    bool isToggle = new bool();
                    buttonopenprocedure.Click += (o, args) =>
                    {
                        DoubleAnimation da = new DoubleAnimation();
                        if (!isToggle)
                        {
                            da.From = 450;
                            da.To = 800;
                            da.Duration = TimeSpan.FromSeconds(1);
                            buttonopenprocedure.BeginAnimation(WidthProperty, da);
                            da.From = 0;
                            da.To = panelHeight;
                            da.Duration = TimeSpan.FromSeconds(1);
                            panelallprocedure.BeginAnimation(HeightProperty, da);
                            isToggle = true;
                            buttonopenprocedure.Content = "Закрити";

                        }
                        else
                        {
                            da.From = 800;
                            da.To = 450;
                            da.Duration = TimeSpan.FromSeconds(1);
                            buttonopenprocedure.BeginAnimation(WidthProperty, da);
                            da.From = panelHeight;
                            da.To = 0;
                            da.Duration = TimeSpan.FromSeconds(1);
                            panelallprocedure.BeginAnimation(HeightProperty, da);
                            isToggle = false;
                            buttonopenprocedure.Content = "Переглянути процедури";
                        }
                    };
                }
                DockPanel.SetDock(paneldiagnosis1, Dock.Top);
                DockPanel.SetDock(panelallprocedure, Dock.Top);
                DockPanel.SetDock(paneldiagnosis, Dock.Top);
                DockPanel.SetDock(labeldiagnosis, Dock.Top);
                paneldiagnosis.Children.Add(labeldiagnosis);
                paneldiagnosis1.Children.Add(paneldiagnosis);
                paneldiagnosis1.Children.Add(panelallprocedure);
                panelAllDiagnosis.Children.Add(paneldiagnosis1);
                var disease1 = disease;
                labeldiagnosis.MouseDoubleClick += (o, args) =>
                {
                    PatientInfo form = new PatientInfo(disease1.IdPatient);
                    form.ShowDialog();
                };
                PatientsPanel.Visibility = Visibility.Visible;
            }
        }