コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FunctionListVM"/> class.
        /// </summary>
        /// <param name="functionalListVMContainer"> The container file of the saved <see cref="FunctionListVM"/>. </param>
        /// <param name="smallestXValue"> The smallest value on x axis. </param>
        /// <param name="biggestXValue"> The biggest value on x axis. </param>
        /// <param name="smallestYValue"> The smallest value on y axis. </param>
        /// <param name="biggestYvalue"> The biggest value on y axis. </param>
        public FunctionListVM(FunctionalListVMContainer functionalListVMContainer, double smallestXValue, double biggestXValue, double smallestYValue, double biggestYvalue)
        {
            this.TrigFunctions = new ObservableCollection <TrigFunctionVM>();
            this.PolyFunctions = new ObservableCollection <PolyFunctionVM>();
            this.removeCommand = new Command(obj =>
            {
                var functionVM = obj as TrigFunctionVM;

                if (functionVM != null)
                {
                    this.TrigFunctions.Remove(functionVM);
                    this.CalculateBiggestYANDSmallestY();
                }
            });
            this.removeCommandPoly = new Command(obj =>
            {
                var functionVM = obj as PolyFunctionVM;

                if (functionVM != null)
                {
                    this.PolyFunctions.Remove(functionVM);
                    this.CalculateBiggestYANDSmallestY();
                }
            });

            foreach (var item in functionalListVMContainer.PolyFunctionVMContainers)
            {
                var temp = new PolyFunctionVM(item, this.removeCommandPoly);
                temp.OnPolyFunctionChanged += this.DrawNewPolyLineForPolyFunction;
                this.PolyFunctions.Add(temp);
            }

            foreach (var item in functionalListVMContainer.TrigFunctionVMContainers)
            {
                var temp = new TrigFunctionVM(item, this.removeCommand);
                temp.OnTrigFunctionChanged += this.DrawNewPolyLineForTrigFunction;
                this.TrigFunctions.Add(temp);
            }

            this.smallestxValue          = smallestXValue;
            this.bigestxValue            = biggestXValue;
            this.smallestyValue          = smallestYValue;
            this.bigestyValue            = biggestYvalue;
            this.DegreeOfPolyFunction    = 2;
            this.saveFileDialogue        = new SaveFileDialog();
            this.openFileDialog1         = new OpenFileDialog();
            this.saveFileDialogue.Filter = "dat files (*.dat)|*.dat";
            this.openFileDialog1.Filter  = "dat files (*.dat)|*.dat";
            this.DrawNewPolyLines();
        }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MasterVMContainer"/> class.
 /// </summary>
 /// <param name="gridVM"> The grid of the view. </param>
 /// <param name="functionListVM"> The functions of the view. </param>
 public MasterVMContainer(GridVM gridVM, FunctionListVM functionListVM)
 {
     this.GridVMContainer           = new GridVMContainer(gridVM);
     this.FunctionalListVMContainer = new FunctionalListVMContainer(functionListVM);
 }