Exemplo n.º 1
0
        public override void NativeFormLoaded(object sender, FormOpenedArgs e)
        {
            openedForm = e.OpenForm;
            if (openedForm == null || (openedForm.IsDisposed || !openedForm.Text.Contains("Trigger")))
            {
                return;
            }

            RuleCDOHelper.DownloadCDO();
            RuleLockCDO  cdo    = RuleCDOHelper.CDO;
            int          id     = ((EllieMae.EMLite.Setup.TriggerEditor)openedForm.ActiveControl.TopLevelControl).Trigger.RuleID;
            RuleLockInfo locked = cdo.Rules?.FirstOrDefault(x => x.RuleID.Equals(id)) ?? (RuleLockInfo)null;

            TextBox comments = openedForm.AllControls <TextBox>().FirstOrDefault(x => x.Name.Equals("commentsTxt"));

            if (comments == null)
            {
                return;
            }

            Button ok = openedForm.AllControls <Button>().FirstOrDefault(x => x.Name.Equals("okBtn"));

            if (ok == null)
            {
                return;
            }

            ok.Click += Ok_Click;

            FlowLayoutPanel p = new FlowLayoutPanel();

            openedForm.Controls.Add(p);
            p.Left          = comments.Left;
            p.Top           = comments.Bottom + 20;
            p.Size          = comments.Size;
            p.FlowDirection = FlowDirection.LeftToRight;

            Locked = new CheckBox();
            p.Controls.Add(Locked);
            Locked.Text = "Lock Rule";

            TextBox lockedBy = new TextBox();

            p.Controls.Add(lockedBy);

            Button diff = new Button();

            p.Controls.Add(diff);
            diff.Text   = "Diff";
            diff.Click += Diff_Click;

            if (locked != null)
            {
                lockedBy.Text  = $"Locked By {locked.ID}";
                Locked.Checked = locked.Locked;
                ok.Enabled     = locked.Locked && locked.ID.Equals(EncompassHelper.User.ID) ? false : true;
            }
        }
Exemplo n.º 2
0
        private void Tree_AfterSelect(object sender, TreeViewEventArgs e)
        {
            this.Grid = SettingsForm.AllControls <GridView>().FirstOrDefault <GridView>();
            if (this.Grid == null || !this.Grid.Items.Any <GVItem>())
            {
                return;
            }
            if (!Loading)
            {
                this.AllDataGrid = new GridView();
                foreach (GVItem gvItem in (IEnumerable <GVItem>) this.Grid.Items)
                {
                    this.AllDataGrid.Items.Add(gvItem);
                }
                Panel control = this.GetControl((Control)this.SettingsForm, "gpHeader") as Panel;
                if (control == null)
                {
                    return;
                }
                if (!control.Controls.ContainsKey(this.key))
                {
                    searchPanel = this.GetSearchPanel(control.Width, this.key);
                    control.Controls.Add((Control)searchPanel);
                    ((IEnumerable <Control>)control.Controls.Find(this.key, true)).FirstOrDefault <Control>().BringToFront();

                    Loading = true;
                    (searchPanel.Controls[0] as TextBox).Text = "_";
                    Timer t = new Timer();
                    t.Interval = 50;
                    t.Enabled  = true;
                    t.Tick    += T_Tick;
                }
            }
        }