private void InitializeComponent()
        {
            // resolve property descriptor to a value
            object appointmentImage = _imageStyleProperty.GetValue(_objectItem);
            // get inner properties using converter to get proper property type converters
            PropertyDescriptorCollection properties = _imageStyleProperty.Converter.GetProperties(appointmentImage);
            PropertyDescriptor           source     = properties[ImageStyle.SourcePropertyName];
            PropertyDescriptor           value      = properties[ImageStyle.ValuePropertyName];
            PropertyDescriptor           mimeType   = properties[ImageStyle.MimeTypePropertyName];

            HorizontalPanel panel1 = new HorizontalPanel();

            using (new SuspendLayoutTransaction(this))
                using (new SuspendLayoutTransaction(panel1))
                {
                    panel1.AutoSize = AutoSize = true;
                    panel1.Margin   = Utils.UpdateMarginByIndent(System.Windows.Forms.Padding.Empty, _serviceProvider, 1);
                    //
                    // _imageStyleLabel
                    //
                    ControlGroupHeadingLabel _imageStyleLabel = new ControlGroupHeadingLabel(_serviceProvider);
                    _imageStyleLabel.Dock = DockStyle.Top;
                    _imageStyleLabel.Text = Resources.ImageLabel;
                    //
                    // sourceEditor
                    //
                    sourceEditor =
                        new TypedValueEditor(_serviceProvider, Resources.SourceLabel,
                                             ComponentProperty.Create(source, appointmentImage));
                    sourceEditor.Validated += OnImageEditorChanged;
                    sourceEditor.Margin     = System.Windows.Forms.Padding.Empty;
                    //
                    // value Value
                    //
                    valueEditor =
                        new TypedValueEditor(_serviceProvider, Resources.ValueTypeLabel,
                                             ComponentProperty.Create(value, appointmentImage));
                    valueEditor.Validated += OnImageEditorChanged;
                    valueEditor.Margin     = Utils.UpdateMarginByIndent(System.Windows.Forms.Padding.Empty, valueEditor.ControlInfo, 1);
                    //
                    //style Value
                    //
                    mimeTypeEditor =
                        new TypedValueEditor(_serviceProvider, Resources.MimeTypeLabel,
                                             ComponentProperty.Create(mimeType, appointmentImage));
                    mimeTypeEditor.Validated += OnImageEditorChanged;
                    mimeTypeEditor.Margin     = System.Windows.Forms.Padding.Empty;

                    panel1.Controls.Add(sourceEditor);
                    panel1.Controls.Add(mimeTypeEditor);

                    Controls.Add(_imageStyleLabel);
                    Controls.Add(panel1);
                    Controls.Add(valueEditor);
                }
            isInitialized = true;
        }
        private void InitializeComponent()
        {
            // resolve property descriptor to a value
            object appointmentImage = _lineStyleProperty.GetValue(_objectItem);
            // get inner properties using converter to get proper property type converters
            PropertyDescriptorCollection properties = _lineStyleProperty.Converter.GetProperties(appointmentImage);
            PropertyDescriptor           color      = properties[DesignLineStyle.LineColorPropertyName];
            PropertyDescriptor           width      = properties[DesignLineStyle.LineWidthPropertyName];
            PropertyDescriptor           style      = properties[DesignLineStyle.LineStylePropertyName];

            using (new SuspendLayoutTransaction(this))
            {
                this.AutoSize = true;
                //
                // _imageStyleLabel
                //
                ControlGroupHeadingLabel lineStyleLabel = new ControlGroupHeadingLabel(_serviceProvider);
                lineStyleLabel.Dock = DockStyle.Top;
                lineStyleLabel.Text = Resources.LineStyleLabel;
                Controls.Add(lineStyleLabel);

                HorizontalPanel horzPanel = new HorizontalPanel();
                horzPanel.AutoSize = true;
                horzPanel.Dock     = DockStyle.Top;
                horzPanel.Margin   = Utils.UpdateMarginByIndent(System.Windows.Forms.Padding.Empty, _serviceProvider, 1);
                Controls.Add(horzPanel);
                //
                // styleEditor
                //
                styleEditor =
                    new TypedValueEditor(_serviceProvider, Resources.LineStyle,
                                         ComponentProperty.Create(style, appointmentImage));
                styleEditor.Validated += OnLineStyleEditorChanged;
                styleEditor.Margin     = System.Windows.Forms.Padding.Empty;
                horzPanel.Controls.Add(styleEditor);
                //
                // widthEditor
                //
                widthEditor =
                    new TypedValueEditor(_serviceProvider, Resources.LineWidth,
                                         ComponentProperty.Create(width, appointmentImage));
                widthEditor.Validated += OnLineStyleEditorChanged;
                widthEditor.Margin     = System.Windows.Forms.Padding.Empty;
                horzPanel.Controls.Add(widthEditor);
                //
                // colorEditor
                //
                colorEditor =
                    new TypedValueEditor(_serviceProvider, Resources.LineColor,
                                         ComponentProperty.Create(color, appointmentImage));
                colorEditor.Validated += OnLineStyleEditorChanged;
                colorEditor.Margin     = Utils.UpdateMarginByIndent(System.Windows.Forms.Padding.Empty, colorEditor.ControlInfo, 1);
                Controls.Add(colorEditor);
            }
            isInitialized = true;
        }
Beispiel #3
0
        private void ShowNoSession()
        {
            _layout.ContainerControl.DisposeChildren();
            EditingSessionPlugin.Instance.SessionState = EditingSessionPlugin.State.NoSession;

            var p = new Panel()
            {
                Parent       = _layout.ContainerControl,
                AnchorPreset = AnchorPresets.StretchAll
            };
            var hp = new HorizontalPanel()
            {
                Parent       = p,
                AnchorPreset = AnchorPresets.MiddleCenter,
                Height       = 70,
                Spacing      = 15
            };

            var joinButton = new Button()
            {
                Parent       = hp,
                Text         = "   Join   ",
                Width        = 120,
                AnchorPreset = AnchorPresets.MiddleCenter
            };

            joinButton.Clicked += () => ShowJoin();
            var hostButton = new Button()
            {
                Parent       = hp,
                Text         = "   Host   ",
                Width        = 120,
                AnchorPreset = AnchorPresets.MiddleCenter
            };

            hostButton.Clicked += () => ShowHost();
            hp.Location        -= hp.Size / 2;
        }
Beispiel #4
0
        private void DisplayPromoteForm(string option)
        {
            string str  = base.Dispatch.EitherField("ErrCode");
            string str1 = base.Dispatch.EitherField("id");
            string str2 = "";

            if (str == "1")
            {
                str2 = string.Format(base.Metadata.GetTranslation("Company_Promote", "EnterId"), base.Metadata.GetTranslation("Company_Promote", this._comp_type));
            }
            else if (str == "2")
            {
                str2 = string.Format(base.Metadata.GetTranslation("Company_Promote", "Exists"), this._comp_type, str1, this._database);
            }
            if (!string.IsNullOrEmpty(str2))
            {
                base.AddContent(string.Format("<br/><br/><h4>{0}</h4><br/>", str2));
            }
            base.AddContent(base.HTML.Form());
            string contextInfo    = base.GetContextInfo("Company", "comp_database");
            string contextInfo1   = base.GetContextInfo("Company", "comp_CompanyId");
            Record record         = base.FindRecord("Company", string.Format("comp_CompanyId = '{0}'", contextInfo1));
            string fieldAsString  = record.GetFieldAsString("Comp_IdCust");
            string fieldAsString1 = record.GetFieldAsString("Comp_IdVend");
            bool   empty          = fieldAsString != string.Empty;
            bool   flag           = fieldAsString1 != string.Empty;
            string str3           = "";

            base.AddContent(base.HTML.InputHidden("HiddenMode", ""));
            if (!(empty | flag))
            {
                string translation = base.Metadata.GetTranslation("Company_Promote", "SelectAccpacDatabase");
                base.AddContent(string.Concat("<h3>", translation, "</h3>"));
                string str4 = string.Concat(base.Metadata.GetTranslation("Company_Promote", "CompanyName"), ":");
                str3 = string.Concat("<h4>", str4, "<h4>");
                str3 = string.Concat(str3, this.BuildDatabaseDropDown(contextInfo));
                string str5 = "";
                string str6 = string.Format("<h4>{0} / {1}</h4><div><input type ='textbox' id='txtId' name='txtId' value='{2}' maxlength='12'></div><br />", base.Metadata.GetTranslation("ColNames", "Comp_IdCust"), base.Metadata.GetTranslation("ColNames", "Comp_IdVend"), str5);
                str3 = string.Concat(str3, str6);
                string str7 = string.Format(base.Metadata.GetTranslation("Company_Promote", "PromoteEntity"), base.Metadata.GetTranslation("ainq_selection", "arCustomer"));
                string str8 = string.Format(base.Metadata.GetTranslation("Company_Promote", "PromoteEntity"), base.Metadata.GetTranslation("ainq_selection", "apVendor"));
                PromoteCompany.Sage300HttpClientHandler = new HttpClientHandler()
                {
                    Credentials = new NetworkCredential(this.userId, this.userKey)
                };
                bool flag1 = true;
                if (!string.IsNullOrEmpty(contextInfo))
                {
                    this._database = contextInfo;
                    flag1          = this.CheckExist(contextInfo1, "CRMCompany");
                }
                base.AddSubmitButton(str7, "Save.gif", "javascript:document.EntryForm.HiddenMode.value='PromoteCustomer';$('#sage300Loading').show();");
                if (flag1)
                {
                    base.AddSubmitButton(str8, "Save.gif", "javascript:document.EntryForm.HiddenMode.value='PromoteVendor';$('#sage300Loading').show();");
                }
            }
            else
            {
                string str9           = (empty ? base.Metadata.GetTranslation("ainq_selection", "arCustomer") : base.Metadata.GetTranslation("ainq_selection", "apVendor"));
                string str10          = (empty ? fieldAsString : fieldAsString1);
                string fieldAsString2 = record.GetFieldAsString("Comp_IdGrp");
                string fieldAsString3 = record.GetFieldAsString("Comp_CodeTaxGrp");
                string fieldAsString4 = record.GetFieldAsString("Comp_CodeTerm");
                string str11          = (empty ? base.Metadata.GetTranslation("ColNames", "Comp_IdCust") : base.Metadata.GetTranslation("ColNames", "Comp_IdVend"));
                string str12          = string.Format(base.Metadata.GetTranslation("Company_Promote", "Integration"), str9);
                base.AddContent(string.Concat("<h3>", str12, "</h3>"));
                str3 = string.Concat(str3, string.Format("<h4>{0}</h4><input type ='textbox' id='{1}' name='{2}' value='{3}' readonly><br />", new object[] { str11, "id", "id", str10 }));
                str3 = string.Concat(str3, string.Format("<h4>{0}</h4><input type ='textbox' id='{1}' name='{2}' value='{3}' readonly><br />", new object[] { base.Metadata.GetTranslation("ColNames", "Comp_IdGrp"), "groupcode", "groupcode", fieldAsString2 }));
                str3 = string.Concat(str3, string.Format("<h4>{0}</h4><input type ='textbox' id='{1}' name='{2}' value='{3}' readonly><br />", new object[] { base.Metadata.GetTranslation("ColNames", "Comp_CodeTaxGrp"), "taxgroup", "taxgroup", fieldAsString3 }));
                str3 = string.Concat(str3, string.Format("<h4>{0}</h4><input type ='textbox' id='{1}' name='{2}' value='{3}' readonly><br />", new object[] { base.Metadata.GetTranslation("ColNames", "Comp_CodeTerm"), "termscode", "termscode", fieldAsString4 }));
                string str13 = (empty ? "UnlinkCustomer" : "UnlinkVendor");
                base.AddConfirmButton(string.Format(base.Metadata.GetTranslation("Company_Promote", "UnlinkEntity"), str9), "Save.gif", base.Metadata.GetTranslation("Company_Promote", "ConfirmUnlink"), "HiddenMode", str13);
            }
            HorizontalPanel horizontalPanel = new HorizontalPanel();

            horizontalPanel.HTMLId = "ImportPageId";
            HorizontalPanel horizontalPanel1 = horizontalPanel;

            horizontalPanel1.AddAttribute("width", "100%");
            horizontalPanel1.AddAttribute("valign", "bottom");
            ContentBox contentBox = new ContentBox();
            HTMLString hTMLString = new HTMLString();

            hTMLString.Html  = str3;
            contentBox.Inner = hTMLString;
            horizontalPanel1.Add(contentBox);
            base.AddContent(horizontalPanel1);
        }
Beispiel #5
0
        internal static VisualTreeElement Serialize(XmlNode node, Control root)
        {
            ElementPair parse = null;

            switch (node.Name)
            {
            case "Control":
                parse = Control.ParseNested(node, root);
                break;

            case "VerticalPanel":
                parse = VerticalPanel.Parse(node, root);
                break;

            case "HorizontalPanel":
                parse = HorizontalPanel.Parse(node, root);
                break;

            case "Button":
                parse = Button.Parse(node, root);
                break;

            case "Label":
                parse = Label.Parse(node, root);
                break;

            case "Text":
                parse = Textbox.Parse(node, root);
                break;

            case "ListBox":
                parse = ListBox.Parse(node, root);
                break;

            case "Grid":
                parse = Grid.Parse(node, root);
                break;

            case "Calendar":
                parse = Calendar.Parse(node, root);
                break;

            case "Panel":
                parse = Panel.Parse(node, root);
                break;

            case "VerticalSlider":
                parse = VerticalSlider.Parse(node, root);
                break;

            case "HorizontalSlider":
                parse = HorizontalSlider.Parse(node, root);
                break;

            default:
                break;
            }
            if (parse != null)
            {
                parse.Element.BindWidgetProperties(node, root);
                foreach (XmlNode child in node.ChildNodes)
                {
                    if (child.NodeType == XmlNodeType.Comment)
                    {
                        continue;
                    }
                    var nextElement = Serialize(child, root);
                    if (parse.Element is IAttachable)
                    {
                        ((IAttachable)parse.Element).AttachProperties(nextElement, child);
                    }
                    if (nextElement != null)
                    {
                        parse.AddToElement(nextElement);
                    }
                }
                return(parse.Element);
            }
            return(null);
        }
Beispiel #6
0
        public override void OnEnable()
        {
            mainVertPanel = new VerticalPanel {
                AnchorPreset = AnchorPresets.VerticalStretchLeft,
                Width        = 250,
                TopMargin    = offset.Y,
                LeftMargin   = offset.X,
                BottomMargin = 0,
                Parent       = uiRoot.GUI,
            };

            hostBtn = new Button
            {
                Parent  = mainVertPanel,
                Text    = "Host a server",
                Visible = false,
                Font    = font,
            };
            clientPanel = new HorizontalPanel {
                Parent  = mainVertPanel,
                Height  = 30,
                Visible = false,
            };
            clientBtn = new Button
            {
                Parent = clientPanel,
                Text   = "Connect as client",
                Font   = font,
            };
            clientAddress = new TextBox
            {
                Parent = clientPanel,
                Font   = font,
            };
            serverBtn = new Button
            {
                Parent  = mainVertPanel,
                Text    = "Start Server",
                Visible = false,
                Font    = font,
            };
            connecting = new Label
            {
                Parent  = mainVertPanel,
                Text    = "Connecting to server",
                Visible = false,
                Font    = font,
            };
            cancelConnect = new Button
            {
                Parent  = mainVertPanel,
                Text    = "Cancel connection attempt",
                Visible = false,
                Font    = font,
            };

            transport = new Label
            {
                Parent     = mainVertPanel,
                Text       = "Transport is",
                Visible    = false,
                Font       = font,
                AutoHeight = true,
                Wrapping   = TextWrapping.WrapWords,
            };
            address = new Label
            {
                Parent  = mainVertPanel,
                Text    = "address is",
                Visible = false,
                Font    = font,
            };

            clientReadyBtn = new Button
            {
                Parent  = mainVertPanel,
                Text    = "Client Ready",
                Visible = false,
                Font    = font,
            };

            cancelHostBtn = new Button
            {
                Parent  = mainVertPanel,
                Text    = "Stop hosting",
                Visible = false,
                Font    = font,
            };
            cancelClientBtn = new Button
            {
                Parent  = mainVertPanel,
                Text    = "Disconnect",
                Visible = false,
                Font    = font,
            };
            cancelServerBtn = new Button
            {
                Parent  = mainVertPanel,
                Text    = "Stop server",
                Visible = false,
                Font    = font,
            };

            hostBtn.Clicked += () =>
            {
                manager.StartHost();
            };
            clientBtn.Clicked += () =>
            {
                manager.StartClient();
            };
            clientAddress.TextChanged += () =>
            {
                manager.networkAddress = clientAddress.Text;
            };
            serverBtn.Clicked += () =>
            {
                manager.StartServer();
            };
            cancelConnect.Clicked += () =>
            {
                manager.StopClient();
            };

            clientReadyBtn.Clicked += () =>
            {
                ClientScene.Ready(NetworkClient.connection);

                if (ClientScene.localPlayer == null)
                {
                    ClientScene.AddPlayer(NetworkClient.connection);
                }
            };

            cancelHostBtn.Clicked += () =>
            {
                manager.StopHost();
            };
            cancelClientBtn.Clicked += () =>
            {
                manager.StopClient();
            };
            cancelServerBtn.Clicked += () =>
            {
                manager.StopServer();
            };
        }
Beispiel #7
0
        public override void init()
        {
            BackColor   = Color.FromArgb(0x2e, 0x2e, 0x2e);
            allControls = new List <Control>();
            Text        = "Text Editor";
            setScreenSizePercentage(.75);
            editor = new Editor(backColor: BackColor)
            {
                Dock = DockStyle.Fill
            };
            int             colorBase = 0x88;
            HorizontalPanel topPanel  = new HorizontalPanel()
            {
                Dock      = DockStyle.Top,
                Height    = topHeight,
                BackColor = Color.FromArgb(colorBase, colorBase, colorBase)
            };

            topPanel.addControl(new TopButton(click: delegate {
                save(SysSettings.getSetting(openFileSetting, null));
            }, text: "Save"));
            topPanel.addControl(new TopButton(click: delegate { open(); }, text: "Open"));
            topPanel.addControl(new TopButton(click: delegate {
                SysSettings.deleteSetting(openFileSetting);
                editor.Text = string.Empty;
            }, text: "Close File"));
            this.addControl(topPanel);
            Panel editorContainer = new Panel()
            {
                Padding = new Padding(5),
                Dock    = DockStyle.Bottom
            };

            editor.scrollEvent += delegate {
            };
            Action <Control> addToList = null;

            addToList = (Control c) => {
                if (c == null)
                {
                    return;
                }
                allControls.Add(c);
                foreach (Control subC in c.Controls)
                {
                    addToList(subC);
                }
            };
            editorContainer.addControl(editor);
            this.addControl(editorContainer);
            addToList(this);
            async(() => {
                string openFile = SysSettings.getSetting(openFileSetting, null);
                if (openFile != null)
                {
                    editor.runOnUiThread(() => { open(openFile); });
                }
            });

            KeyEventHandler keyHandler = (object o, KeyEventArgs args) => {
                if (args.Control)
                {
                    switch (args.KeyCode)
                    {
                    case Keys.O:
                        open();
                        break;

                    case Keys.S:
                        save(SysSettings.getSetting(openFileSetting, null));
                        break;

                    case Keys.A:
                        editor.SelectAll();
                        break;
                    }
                }
            };

            KeyDown += keyHandler;
            foreach (Control c in allControls)
            {
                c.KeyDown += keyHandler;
            }
            resizeHandler = delegate {
                editorContainer.Height = ClientSize.Height - (topHeight + 10);
            };
        }
        private void InitializeComponent()
        {
            // resolve property descriptor to a value
            object textStyleValue = _textStyleProperty.GetValue(_objectItem);
            // get inner properties using converter to get proper property type converters
            PropertyDescriptorCollection properties     = _textStyleProperty.Converter.GetProperties(textStyleValue);
            PropertyDescriptor           familyProp     = properties[DesignTextStyle.FontFamilyPropertyName];
            PropertyDescriptor           sizeProp       = properties[DesignTextStyle.FontSizePropertyName];
            PropertyDescriptor           styleProp      = properties[DesignTextStyle.FontStylePropertyName];
            PropertyDescriptor           weightProp     = properties[DesignTextStyle.FontWeightPropertyName];
            PropertyDescriptor           decorationProp = properties[DesignTextStyle.FontDecorationPropertyName];
            PropertyDescriptor           colorProp      = properties[DesignTextStyle.FontColorPropertyName];

            // panels
            HorizontalPanel mainPanel = new HorizontalPanel();
            VerticalPanel   panel1    = new VerticalPanel();
            VerticalPanel   panel2    = new VerticalPanel();

            using (new SuspendLayoutTransaction(this))
                using (new SuspendLayoutTransaction(mainPanel))
                    using (new SuspendLayoutTransaction(panel1))
                        using (new SuspendLayoutTransaction(panel2))
                        {
                            AutoSize           = true;
                            mainPanel.AutoSize = true;
                            panel1.AutoSize    = true;
                            panel2.AutoSize    = true;
                            mainPanel.Margin   = System.Windows.Forms.Padding.Empty;
                            panel1.Margin      = Utils.UpdateMarginByIndent(System.Windows.Forms.Padding.Empty, _serviceProvider, 1);
                            panel2.Margin      = System.Windows.Forms.Padding.Empty;

                            //
                            // headLabel
                            //
                            ControlGroupHeadingLabel headLabel = new ControlGroupHeadingLabel(_serviceProvider);
                            headLabel.Dock = DockStyle.Top;
                            headLabel.Text = Resources.CalendarSmartPanelFontLabel;
                            //
                            // familyEditor
                            //
                            familyEditor = new TypedValueEditor(_serviceProvider,
                                                                Resources.CalendarSmartPanelFontFamilyLabel, ComponentProperty.Create(familyProp, textStyleValue));
                            familyEditor.Validated += OnTextStyleEditorChanged;
                            familyEditor.Margin     = System.Windows.Forms.Padding.Empty;
                            //
                            // sizeEditor
                            //
                            sizeEditor = new TypedValueEditor(_serviceProvider,
                                                              Resources.CalendarSmartPanelFontSizeLabel, ComponentProperty.Create(sizeProp, textStyleValue));
                            sizeEditor.Validated += OnTextStyleEditorChanged;
                            sizeEditor.Margin     = System.Windows.Forms.Padding.Empty;
                            //
                            // styleEditor
                            //
                            styleEditor = new TypedValueEditor(_serviceProvider,
                                                               Resources.CalendarSmartPanelFontStyleLabel, ComponentProperty.Create(styleProp, textStyleValue));
                            styleEditor.Validated += OnTextStyleEditorChanged;
                            styleEditor.Margin     = System.Windows.Forms.Padding.Empty;
                            //
                            // colorEditor
                            //
                            colorEditor = new TypedValueEditor(_serviceProvider,
                                                               Resources.CalendarSmartPanelFontColorLabel, ComponentProperty.Create(colorProp, textStyleValue));
                            colorEditor.Validated += OnTextStyleEditorChanged;
                            colorEditor.Margin     = System.Windows.Forms.Padding.Empty;
                            //
                            // weight editor
                            //
                            weightEditor = new TypedValueEditor(_serviceProvider,
                                                                Resources.CalendarSmartPanelFontWeightLabel, ComponentProperty.Create(weightProp, textStyleValue));
                            weightEditor.Validated += OnTextStyleEditorChanged;
                            weightEditor.Margin     = System.Windows.Forms.Padding.Empty;
                            //
                            // decoration editor
                            //
                            decorationEditor = new TypedValueEditor(_serviceProvider,
                                                                    Resources.CalendarSmartPanelFontDecorationLabel, ComponentProperty.Create(decorationProp, textStyleValue));
                            decorationEditor.Validated += OnTextStyleEditorChanged;
                            decorationEditor.Margin     = System.Windows.Forms.Padding.Empty;
                            // panel1
                            //
                            panel1.Controls.Add(familyEditor);
                            panel1.Controls.Add(styleEditor);
                            panel1.Controls.Add(colorEditor);
                            //
                            // panel2
                            //
                            panel2.Controls.Add(sizeEditor);
                            panel2.Controls.Add(weightEditor);
                            panel2.Controls.Add(decorationEditor);

                            //
                            // mainPanel
                            //
                            mainPanel.Controls.Add(panel1);
                            mainPanel.Controls.Add(panel2);

                            Controls.Add(headLabel);
                            Controls.Add(mainPanel);
                        }

            isInitialized = true;
        }