Esempio n. 1
0
        /// <summary>
        /// Open the Shortn dialog window.  Used internally after the Shortn button is pressed, and by Ribbon for the debugging
        /// </summary>
        /// <param name="data"></param>
        public static void openShortnDialog(ShortnData data)
        {
            System.Windows.Forms.Form newForm = new System.Windows.Forms.Form();
            newForm.Width = 1200;
            newForm.Height = int.MaxValue;
            newForm.BackColor = System.Drawing.Color.White;

            // Create the ElementHost control for hosting the
            // WPF UserControl.
            ElementHost host = new ElementHost();
            host.Dock = System.Windows.Forms.DockStyle.Fill;

            // Create the WPF UserControl.
            ShortnDialog sd = new ShortnDialog(data);

            // Assign the WPF UserControl to the ElementHost control's
            // Child property.
            host.Child = sd;

            newForm.Visible = false;
            // Add the ElementHost control to the form's
            // collection of child controls.
            newForm.Controls.Add(host);
            newForm.Show();

            // set the form's height based on what the textbox wants to be
            int dialogHeight = (int)sd.grid.DesiredSize.Height;
            newForm.Height = (int)(sd.DesiredSize.Height + newForm.Padding.Vertical + System.Windows.Forms.SystemInformation.CaptionHeight + System.Windows.SystemParameters.ScrollWidth);
            sd.grid.Height = sd.grid.DesiredSize.Height;
            newForm.Width = 1200;
            host.MaximumSize = new System.Drawing.Size(1200, System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height);
            newForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;

            newForm.Visible = true;
        }
Esempio n. 2
0
        /// <summary>
        /// Open the Shortn dialog window.  Used internally after the Shortn button is pressed, and by Ribbon for the debugging
        /// </summary>
        /// <param name="data"></param>
        public static void openShortnDialog(ShortnData data)
        {
            System.Windows.Forms.Form newForm = new System.Windows.Forms.Form();
            newForm.Width     = 1200;
            newForm.Height    = int.MaxValue;
            newForm.BackColor = System.Drawing.Color.White;

            // Create the ElementHost control for hosting the
            // WPF UserControl.
            ElementHost host = new ElementHost();

            host.Dock = System.Windows.Forms.DockStyle.Fill;

            // Create the WPF UserControl.
            ShortnDialog sd = new ShortnDialog(data);

            // Assign the WPF UserControl to the ElementHost control's
            // Child property.
            host.Child = sd;

            newForm.Visible = false;
            // Add the ElementHost control to the form's
            // collection of child controls.
            newForm.Controls.Add(host);
            newForm.Show();

            // set the form's height based on what the textbox wants to be
            int dialogHeight = (int)sd.grid.DesiredSize.Height;

            newForm.Height          = (int)(sd.DesiredSize.Height + newForm.Padding.Vertical + System.Windows.Forms.SystemInformation.CaptionHeight + System.Windows.SystemParameters.ScrollWidth);
            sd.grid.Height          = sd.grid.DesiredSize.Height;
            newForm.Width           = 1200;
            host.MaximumSize        = new System.Drawing.Size(1200, System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height);
            newForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;

            newForm.Visible = true;
        }
Esempio n. 3
0
        private void button2_Click(object sender, RibbonControlEventArgs e)
        {
            //I is trying to learn how to write gooder.
            TurKitSocKit.TurKitFindFixVerifyPatch p1 = new TurKitSocKit.TurKitFindFixVerifyPatch();
            p1.start = 4; p1.end = 24;
            p1.options = new List<TurKitSocKit.TurKitFindFixVerifyOption>();
            TurKitSocKit.TurKitFindFixVerifyOption option = new TurKitSocKit.TurKitFindFixVerifyOption();
            option.editsText = true;
            option.field = "revision";
            option.alternatives = new List<TurKitSocKit.TurKitFindFixVerifyAlternative>();
            p1.options.Add(option);

            TurKitSocKit.TurKitFindFixVerifyAlternative p1a = new TurKitSocKit.TurKitFindFixVerifyAlternative();
            TurKitSocKit.TurKitFindFixVerifyAlternative p1b = new TurKitSocKit.TurKitFindFixVerifyAlternative();
            TurKitSocKit.TurKitFindFixVerifyAlternative p1c = new TurKitSocKit.TurKitFindFixVerifyAlternative();
            p1a.text="figuring"; p1b.text="trying to figure"; p1c.text="working out";

            option.alternatives.Add(p1a); option.alternatives.Add(p1b); option.alternatives.Add(p1c);

            TurKitSocKit.TurKitFindFixVerifyPatch p2 = new TurKitSocKit.TurKitFindFixVerifyPatch();
            p2.start = 64; p2.end = 70;

            TurKitSocKit.TurKitFindFixVerifyOption option2 = new TurKitSocKit.TurKitFindFixVerifyOption();
            option2.editsText = true;
            option2.field = "revision";
            option2.alternatives = new List<TurKitSocKit.TurKitFindFixVerifyAlternative>();

            TurKitSocKit.TurKitFindFixVerifyAlternative p2a = new TurKitSocKit.TurKitFindFixVerifyAlternative();
            TurKitSocKit.TurKitFindFixVerifyAlternative p2b = new TurKitSocKit.TurKitFindFixVerifyAlternative();
            TurKitSocKit.TurKitFindFixVerifyAlternative p2c = new TurKitSocKit.TurKitFindFixVerifyAlternative();
            p2a.text = "proper"; p2b.text = "right"; p2c.text = "yes";
            option2.alternatives.Add(p2a); option2.alternatives.Add(p2b); option2.alternatives.Add(p2c);

            TurKitSocKit.TurKitFindFixVerify tks = new TurKitSocKit.TurKitFindFixVerify();
            tks.job = 1; tks.paragraph = 1; tks.patches = new List<TurKitSocKit.TurKitFindFixVerifyPatch>();
            tks.patches.Add(p1); tks.patches.Add(p2);

            ShortnData shortenData = Globals.Soylent.soylentMap[Globals.Soylent.Application.ActiveDocument].jobMap[tks.job] as ShortnData;
            shortenData.processSocKitMessage(tks);

            System.Windows.Forms.Form newForm = new System.Windows.Forms.Form();
            //newForm.Width = 1195;
            //newForm.Height = 380;
            newForm.BackColor = System.Drawing.Color.White;

            // Create the ElementHost control for hosting the
            // WPF UserControl.
            ElementHost host = new ElementHost();
            host.Width = newForm.Width;
            host.Height = newForm.Height;

            // Create the WPF UserControl.
            //Word.Range toShorten = Globals.Soylent.Application.Selection.Range;
            ShortnDialog sd = new ShortnDialog(Globals.Soylent.soylentMap[Globals.Soylent.Application.ActiveDocument].jobMap[1] as ShortnData);

            // Assign the WPF UserControl to the ElementHost control's
            // Child property.

            host.Child = sd;

            // Add the ElementHost control to the form's
            // collection of child controls.
            newForm.Controls.Add(host);
            newForm.Show();
        }