コード例 #1
0
ファイル: Plot.xaml.cs プロジェクト: FIVIL/Fourier-series
 private Syncfusion.UI.Xaml.Charts.FastLineSeries newseries(int n, bool setorclear, ViewModel vm)
 {
     Syncfusion.UI.Xaml.Charts.FastLineSeries retvalue = new Syncfusion.UI.Xaml.Charts.FastLineSeries()
     {
         DataContext     = vm,
         ShowTooltip     = true,
         EnableAnimation = true,
         YBindingPath    = "Y",
         XBindingPath    = "X"
     };
     if (n == 1)
     {
         retvalue.ItemsSource = new Binding("Points");
     }
     else if (n == 2)
     {
         retvalue.ItemsSource = new Binding("Points2");
     }
     else if (n == 3)
     {
         retvalue.ItemsSource = new Binding("Points3");
     }
     else if (n == 4)
     {
         retvalue.ItemsSource = new Binding("Points4");
     }
     else if (n == 5)
     {
         retvalue.ItemsSource = new Binding("Points5");
     }
     return(retvalue);
 }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: dangost/PhoneBook
        void IMainView.ShowAddEditDialog(ViewModel viewModel, AddEditViewModel addEditView)
        {
            selectedContact      = addEditView.selectedContact;
            selectedDepartment   = addEditView.selectedDepartment;
            selectedContactModel = addEditView.selectedContactModel;

            if (viewModel.Form == "add")
            {
                AddEditDialog addDialog = new AddEditDialog(addEditView);
                addDialog.Title          = "Create";
                addDialog.button.Content = "Create";

                List <string> depsNames = new List <string> {
                };

                foreach (var d in viewModel.PhoneBook.GetAllDepartments())
                {
                    depsNames.Add(d.Department);
                }
                addDialog.comboBoxDepartment.ItemsSource = depsNames;
                addDialog.ShowDialog();
            }

            else if (viewModel.Form == "addDep")
            {
                AddEditDepartament addDepDialog = new AddEditDepartament(addEditView);
                addDepDialog.Title          = "Create";
                addDepDialog.button.Content = "Create";


                addDepDialog.ShowDialog();
            }

            else if (viewModel.Form == "edit")
            {
                AddEditDialog editDialog = new AddEditDialog(addEditView);
                editDialog.Title          = "Edit";
                editDialog.button.Content = "Save";

                editDialog.textBoxName.Text    = selectedContactModel.Name;
                editDialog.textBoxSurname.Text = selectedContactModel.Surname;
                editDialog.textBoxNumber.Text  = selectedContactModel.Number;
                editDialog.textBoxEmail.Text   = selectedContactModel.Email;
                editDialog.button.IsEnabled    = false;

                List <string> depsNames = new List <string> {
                };

                foreach (var d in viewModel.PhoneBook.GetAllDepartments())
                {
                    depsNames.Add(d.Department);
                }
                editDialog.comboBoxDepartment.ItemsSource = depsNames;

                editDialog.comboBoxDepartment.Text = selectedContactModel.Department;

                /*
                 * foreach (var d in viewModel.PhoneBook.GetAllDepartments())
                 * {
                 *  if(selectedContact.DepId == d.Id)
                 *  {
                 *      editDialog.comboBoxDepartment.Text = d.Name;
                 *      break;
                 *  }
                 * }*/

                editDialog.ShowDialog();
            }

            else if (viewModel.Form == "editDep")
            {
                AddEditDepartament editDepDialog = new AddEditDepartament(addEditView);
                editDepDialog.Title          = "Edit";
                editDepDialog.button.Content = "Save";

                editDepDialog.textBoxName.Text = selectedDepartment.Department;

                editDepDialog.ShowDialog();
            }
        }
コード例 #3
0
ファイル: Plot.xaml.cs プロジェクト: FIVIL/Fourier-series
        public void Draw(Func <double, double> f, double minx, double maxx, double step, int n)
        {
            ViewModel vm = (Chart.DataContext as ViewModel);

            if (n == 1)
            {
                vm.Points.Clear();
            }
            if (n == 2)
            {
                vm.Points2.Clear();
            }
            if (n == 3)
            {
                vm.Points3.Clear();
            }
            if (n == 4)
            {
                vm.Points4.Clear();
            }
            if (n == 5)
            {
                vm.Points5.Clear();
            }
            double maxY = 0;

            for (double i = minx; i <= maxx; i += step)
            {
                var temp = f(i);
                if (temp > maxY)
                {
                    maxY = temp;
                }
                if (n == 1)
                {
                    vm.Points.Add(new ViewModel.Point
                    {
                        X = i,
                        Y = temp
                    });
                }
                else if (n == 2)
                {
                    vm.Points2.Add(new ViewModel.Point
                    {
                        X = i,
                        Y = temp
                    });
                }
                else if (n == 3)
                {
                    vm.Points3.Add(new ViewModel.Point
                    {
                        X = i,
                        Y = temp
                    });
                }
                else if (n == 4)
                {
                    vm.Points4.Add(new ViewModel.Point
                    {
                        X = i,
                        Y = temp
                    });
                }
                else if (n == 5)
                {
                    vm.Points5.Add(new ViewModel.Point
                    {
                        X = i,
                        Y = temp
                    });
                }
            }
            Points = vm.Points;
            Pointses.Add(Points);
            YColumn.Maximum   = maxY * 1.5;
            YColumn.Minimum   = maxY * -1.5;
            Chart.DataContext = vm;
        }