Ejemplo n.º 1
0
		private void InitializeComponent()
		{
			this.m_view = new SIL.FieldWorks.LexText.Controls.PatternView();
			this.m_insertionControl = new InsertionControl();
			this.m_panel.SuspendLayout();
			this.SuspendLayout();
			//
			// m_panel
			//
			this.m_panel.Location = new System.Drawing.Point(225, 0);
			this.m_panel.Size = new System.Drawing.Size(22, 20);
			//
			// m_btnLauncher
			//
			this.m_btnLauncher.Dock = System.Windows.Forms.DockStyle.Bottom;
			this.m_btnLauncher.Size = new System.Drawing.Size(22, 20);
			//
			// m_view
			//
			this.m_view.BackColor = System.Drawing.SystemColors.Window;
			this.m_view.Dock = System.Windows.Forms.DockStyle.Left;
			this.m_view.DoSpellCheck = false;
			this.m_view.Group = null;
			this.m_view.IsTextBox = false;
			this.m_view.Location = new System.Drawing.Point(0, 0);
			this.m_view.Mediator = null;
			this.m_view.Name = "m_view";
			this.m_view.ReadOnlyView = false;
			this.m_view.ScrollMinSize = new System.Drawing.Size(0, 0);
			this.m_view.ScrollPosition = new System.Drawing.Point(0, 0);
			this.m_view.ShowRangeSelAfterLostFocus = false;
			this.m_view.Size = new System.Drawing.Size(226, 20);
			this.m_view.SizeChangedSuppression = false;
			this.m_view.TabIndex = 3;
			this.m_view.WritingSystemFactory = null;
			this.m_view.WsPending = -1;
			this.m_view.Zoom = 1F;
			//
			// m_insertionControl
			//
			this.m_insertionControl.Dock = System.Windows.Forms.DockStyle.Bottom;
			this.m_insertionControl.Location = new System.Drawing.Point(0, 20);
			this.m_insertionControl.Name = "m_insertionControl";
			this.m_insertionControl.Size = new System.Drawing.Size(247, 23);
			this.m_insertionControl.TabIndex = 2;
			//
			// RuleFormulaControl
			//
			this.Controls.Add(this.m_view);
			this.Controls.Add(this.m_insertionControl);
			this.Name = "RuleFormulaControl";
			this.Size = new System.Drawing.Size(247, 43);
			this.Controls.SetChildIndex(this.m_insertionControl, 0);
			this.Controls.SetChildIndex(this.m_view, 0);
			this.Controls.SetChildIndex(this.m_panel, 0);
			this.m_panel.ResumeLayout(false);
			this.ResumeLayout(false);

		}
Ejemplo n.º 2
0
        private void Refresh()
        {
            PatternView patEdit = ChangeNoteValues.PatEditor;

            if (patEdit != null)
            {
                if (patEdit.InvokeRequired)
                {
                    patEdit.Invoke((MethodInvoker)(() => { patEdit.Invalidate(true); }));
                }
                else
                {
                    patEdit.Invalidate(true);
                }
            }
        }
        public static CRUDPattern CreateTests(PatternView pattern,
                                              IEnumerable <AdminFormElementView> Questions)
        {
            var question_answerViews = new List <QuestionAnswersView>();

            foreach (var item in Questions)
            {
                var question = ((QuestionView)item.Context);

                question.Name = item.Name;

                question.question = item.QuestionText;

                question.Answers = new List <int>();

                var variants = new List <AnswerView>();

                foreach (var subItem in item.HighSubElements)
                {
                    var answer = ((AnswerView)subItem.Context);

                    answer.answer = subItem.Name;

                    answer.IsTrue = subItem.IsChecked;

                    variants.Add(answer);
                }

                question_answerViews.Add(new QuestionAnswersView()
                {
                    Question = question,
                    Variants = variants
                });
            }

            return(new CRUDPattern()
            {
                Pattern = pattern,
                Diagram = new Diagram(),
                Tests = new TestView()
                {
                    Pattern = pattern,
                    Questions = question_answerViews
                }
            });
        }
Ejemplo n.º 4
0
        public void SavePatterns(Dictionary <string, IPattern> repo)
        {
            SqlConnection con = new SqlConnection(this.ConnectionString);

            try
            {
                con.Open();
                foreach (var item in repo)
                {
                    var        p             = new PatternView(item.Value);
                    var        commandString = string.Format(@"EXECUTE [dbo].[SavePatterns] '{0}', '{1}', '{2}', {3}, {4}", p.Name, p.Symbol, p.Interval, p.DefaultStopLossThreshold, p.DynamicStopLossThreshold);
                    SqlCommand command       = new SqlCommand(commandString, con);
                    command.ExecuteNonQuery();
                }
                con.Close();
            }
            catch (Exception e)
            {
                _logger.Info("Failed to save Patterns.\n" + e.ToString());
                throw;
            }
        }
        public void _AddPattern_Exec(object parameter)
        {
            NewPattern = new PatternView()
            {
                Id = 0
            };

            SubjectElements = new ObservableCollection <AdminFormElementView>();

            ReferenceElements = new ObservableCollection <AdminFormElementView>();

            CreatedTypes = new ObservableCollection <SubjectView>();

            AllTypes = new ObservableCollection <SubjectView>(_BasicTypes);

            PatternVisibility = Visibility.Collapsed;

            PanelVisibility = Visibility.Visible;

            OpenPanelVisibility = Visibility.Collapsed;

            TestVisibility = Visibility.Collapsed;
        }
Ejemplo n.º 6
0
 private void PatternRefreshMenuItem_Click(object sender, EventArgs e)
 {
     PatternView.Refresh();
 }
Ejemplo n.º 7
0
 private void CopyPatternToClipboardMenuItem_Click(object sender, EventArgs e)
 {
     PatternView.ScreenshotToClipboard();
 }
Ejemplo n.º 8
0
 private void SavePatternScreenshotMenuItem_Click(object sender, EventArgs e)
 {
     PatternView.Screenshot();
 }
        public static CRUDPattern Create(PatternView pattern,
                                         IEnumerable <AdminFormElementView> subjects,
                                         IEnumerable <AdminFormElementView> references)
        {
            var subjectViews   = new List <SubjectView>();
            var referenceViews = new List <SubjectReferenceView>();
            var propertyViews  = new List <SubjectPropertyView>();
            var methodViews    = new List <SubjectMethodView>();
            var parameterViews = new List <MethodParameterView>();

            //References---------------------------------------
            foreach (var item in references)
            {
                var context = ((SubjectReferenceView)item.Context);

                context.subject_Id = (int)item.Start.GetId();

                context.target_Id = (int)item.End.GetId();

                context.type = item.SelectedReferenceType.Type;

                referenceViews.Add(context);
            }

            foreach (var item in subjects)
            {
                //Subjects------------------------------------------
                var context = ((SubjectView)item.Context);

                context.type = item.SelectedSubjectType.Type;

                subjectViews.Add(context);

                //Properties-----------------------------------------
                foreach (var property in item.HighSubElements)
                {
                    var propertyView = ((SubjectPropertyView)property.Context);

                    propertyView.Name = property.Name;

                    propertyView.Type_Id = (int)property.SelectedElement.GetId();

                    propertyViews.Add(propertyView);
                }

                //Methods----------------------------------------------
                foreach (var method in item.LowSubElements)
                {
                    var methodView = ((SubjectMethodView)method.Context);

                    methodView.Name = method.Name;

                    methodView.ReturnValue_Id = (int)method.SelectedElement.GetId();

                    methodView.parameters = new List <int>();

                    methodViews.Add(methodView);

                    //Parameters---------------------------------------
                    foreach (var parameter in method.HighSubElements)
                    {
                        var paramView = ((MethodParameterView)parameter.Context);

                        paramView.Name = parameter.Name;

                        paramView.type_id = (int)parameter.SelectedElement.GetId();

                        parameterViews.Add(paramView);
                    }
                }
            }

            var diagram = new Diagram()
            {
                Pattern           = pattern,
                Subjects          = subjectViews,
                SubjectReferences = referenceViews,
                SubjectProperties = propertyViews,
                SubjectMethods    = methodViews,
                MethodParameters  = parameterViews
            };

            return(new CRUDPattern()
            {
                Pattern = pattern,
                Diagram = diagram,
                Tests = new TestView()
            });
        }