public Navigator UseWindow(int windowIndex)
 {
     _windowId = windowIndex;
     _container = _runningApp.GetWindows()[windowIndex];
     _button = null;
     _checkBox = null;
     _label = null;
     _radioButton = null;
     _textBox = null;
     _comboBox = null;
     _image = null;
     _tab = null;
     _treeView = null;
     _panel = null;
     return this;
 }
Ejemplo n.º 2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

			var vm = (IssueLabelsViewModel)ViewModel;
			NavigationItem.LeftBarButtonItem = new UIBarButtonItem(Theme.CurrentTheme.BackButton, UIBarButtonItemStyle.Plain, (s, e) => vm.SaveLabelChoices.Execute(null));

			BindCollection(vm.Labels, x => 
            {
				var e = new LabelElement(x);
                e.Tapped += () =>
                {
                    if (e.Accessory == UITableViewCellAccessory.Checkmark)
						vm.SelectedLabels.Items.Remove(x);
                    else
						vm.SelectedLabels.Items.Add(x);
                };

				e.Accessory = vm.SelectedLabels.Contains(x) ? 
				               UITableViewCellAccessory.Checkmark : 
				               UITableViewCellAccessory.None;
                return e;
            });

			vm.BindCollection(x => x.SelectedLabels, x =>
			{
				if (Root.Count == 0)
					return;

				var elements = Root[0].Elements;
				foreach (var el in elements.Cast<LabelElement>())
				{
					el.Accessory = vm.SelectedLabels.Contains(el.Label) ? 
					               UITableViewCellAccessory.Checkmark : 
					               UITableViewCellAccessory.None;
				}

				Root.Reload(Root[0], UITableViewRowAnimation.None);
			}, true);

			var _hud = new Hud(View);
			vm.Bind(x => x.IsSaving, x =>
			{
				if (x) _hud.Show("Saving...");
				else _hud.Hide();
			});
        }
Ejemplo n.º 3
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as RelatedArtifact;

            if (dest == null)
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }

            base.CopyTo(dest);
            if (TypeElement != null)
            {
                dest.TypeElement = (Code <Hl7.Fhir.Model.RelatedArtifact.RelatedArtifactType>)TypeElement.DeepCopy();
            }
            if (LabelElement != null)
            {
                dest.LabelElement = (Hl7.Fhir.Model.FhirString)LabelElement.DeepCopy();
            }
            if (DisplayElement != null)
            {
                dest.DisplayElement = (Hl7.Fhir.Model.FhirString)DisplayElement.DeepCopy();
            }
            if (Citation != null)
            {
                dest.Citation = (Hl7.Fhir.Model.Markdown)Citation.DeepCopy();
            }
            if (UrlElement != null)
            {
                dest.UrlElement = (Hl7.Fhir.Model.FhirUrl)UrlElement.DeepCopy();
            }
            if (Document != null)
            {
                dest.Document = (Hl7.Fhir.Model.Attachment)Document.DeepCopy();
            }
            if (ResourceElement != null)
            {
                dest.ResourceElement = (Hl7.Fhir.Model.Canonical)ResourceElement.DeepCopy();
            }
            return(dest);
        }
Ejemplo n.º 4
0
        private void OnLabelUpdate(int id, string name)
        {
            var uiElement = _elementsGraph[id];

            if (!string.IsNullOrEmpty(name))
            {
                if (!uiElement.IsLabel)
                {
                    var label = new LabelElement(this, name);
                    label.Attach(uiElement);
                    label.UpdatePosition();
                }
                else
                {
                    uiElement.LabelName = name;
                }
            }
            else
            {
                uiElement.DetachLabel();
            }
        }
Ejemplo n.º 5
0
        private UIElement getUIElement(int i)
        {
            var env   = new EnvironmentExtender();
            var row   = new RowContainer();
            var group = new GroupContainer {
                DataContext = "{Tasks[" + i + "]}",
                CaptionHtml = "{Title}",
                Width       = "350px",
                Height      = "80px"
            };

            var stackRight = new StackContainer {
                LabelWidth = "20",
            };

            var labelAddress2 = new LabelElement {
                CaptionHtml = "{Commit.Description}",
                Width       = "100"
            };

            stackRight.Elements.Add(labelAddress2);

            row.Elements.Add(stackRight);

            if (env.IsHtml)
            {
                stackRight.Class = new[] { UIClass.Tight }
            }
            ;

            group.Elements.Add(row);
            group.Elements.Add(new GapElement {
                Height = "1",
                Width  = "0"
            });

            return(group);
        }
    }
Ejemplo n.º 6
0
        public override void ViewDidLoad()
        {
            Title = "Labels";
            //NoItemsText = "No Labels";

            base.ViewDidLoad();

            NavigationItem.LeftBarButtonItem = new UIBarButtonItem(Images.BackButton, UIBarButtonItemStyle.Plain,
                                                                   (s, e) =>
            {
                if (ViewModel.SaveOnSelect)
                {
                    ViewModel.SelectLabelsCommand.ExecuteIfCan();
                }
            });


            this.BindList(ViewModel.Labels, label =>
            {
                var element     = new LabelElement(label);
                element.Tapped += () =>
                {
                    if (ViewModel.SelectedLabels.Contains(label))
                    {
                        ViewModel.SelectedLabels.Remove(label);
                    }
                    else
                    {
                        ViewModel.SelectedLabels.Add(label);
                    }
                };
                element.Accessory = ViewModel.SelectedLabels.Contains(label)
                           ? UITableViewCellAccessory.Checkmark
                           : UITableViewCellAccessory.None;
                return(element);
            });

            ViewModel.SelectedLabels.Changed.Subscribe(x => ViewModel.Labels.Reset());
        }
Ejemplo n.º 7
0
        public static void SetTextBoxLocation(BaseElement el, TextBox tb)
        {
            if (!(el is ILabelElement))
            {
                return;
            }

            LabelElement lab = ((ILabelElement)el).Label;

            el.Invalidate();
            lab.Invalidate();

            if (lab.Text.Length > 0)
            {
                tb.Location = lab.Location;
                tb.Size     = lab.Size;
            }
            else
            {
                string tmpText = "XXXXXXX";
                Size   sizeTmp = DiagramUtil.MeasureString(tmpText, lab.Font, lab.Size.Width, lab.Format);

                if (el is BaseLinkElement)
                {
                    tb.Size     = sizeTmp;
                    tb.Location = new Point(el.Location.X + el.Size.Width / 2 - sizeTmp.Width / 2,
                                            el.Location.Y + el.Size.Height / 2 - sizeTmp.Height / 2);
                }
                else
                {
                    sizeTmp.Width = el.Size.Width;
                    tb.Size       = sizeTmp;
                    tb.Location   = new Point(el.Location.X,
                                              el.Location.Y + el.Size.Height / 2 - sizeTmp.Height / 2);
                }
            }

            SetTextBoxBorder(tb);
        }
Ejemplo n.º 8
0
        private void UpdateLinkPosition(NodeElement node)
        {
            foreach (ConnectorElement conn in node.Connectors)
            {
                foreach (BaseElement el in conn.Links)
                {
                    BaseLinkElement lnk  = (BaseLinkElement)el;
                    IController     ctrl = ((IControllable)lnk).GetController();
                    if (ctrl is IMoveController)
                    {
                        IMoveController mctrl = (IMoveController)ctrl;
                        if (!mctrl.IsMoving)
                        {
                            lnk.NeedCalcLink = true;
                        }
                    }
                    else
                    {
                        lnk.NeedCalcLink = true;
                    }

                    if (lnk is ILabelElement)
                    {
                        LabelElement label = ((ILabelElement)lnk).Label;

                        ILabelController lblCtrl = ControllerHelper.GetLabelController(lnk);
                        if (lblCtrl != null)
                        {
                            lblCtrl.SetLabelPosition();
                        }
                        else
                        {
                            label.PositionBySite(lnk);
                        }
                        label.Invalidate();
                    }
                }
            }
        }
Ejemplo n.º 9
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var vm = (IssueLabelsViewModel)ViewModel;
            BindCollection(vm.Labels, x =>
            {
                var e = new LabelElement(x);
                e.Tapped += () =>
                {
                    if (e.Accessory == UITableViewCellAccessory.Checkmark)
                        vm.SelectedLabels.Items.Remove(x);
                    else
                        vm.SelectedLabels.Items.Add(x);
                };

                e.Accessory = vm.SelectedLabels.Contains(x) ?
                               UITableViewCellAccessory.Checkmark :
                               UITableViewCellAccessory.None;
                return e;
            });

            vm.BindCollection(x => x.SelectedLabels, x =>
            {
                if (Root.Count == 0)
                    return;

                var elements = Root[0].Elements;
                foreach (var el in elements.Cast<LabelElement>())
                {
                    el.Accessory = vm.SelectedLabels.Contains(el.Label) ?
                                   UITableViewCellAccessory.Checkmark :
                                   UITableViewCellAccessory.None;
                }

                Root.Reload(Root[0], UITableViewRowAnimation.None);
            }, true);
        }
Ejemplo n.º 10
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as Identifier;

            if (dest != null)
            {
                base.CopyTo(dest);
                if (UseElement != null)
                {
                    dest.UseElement = (Code <Hl7.Fhir.Model.Identifier.IdentifierUse>)UseElement.DeepCopy();
                }
                if (LabelElement != null)
                {
                    dest.LabelElement = (Hl7.Fhir.Model.FhirString)LabelElement.DeepCopy();
                }
                if (SystemElement != null)
                {
                    dest.SystemElement = (Hl7.Fhir.Model.FhirUri)SystemElement.DeepCopy();
                }
                if (ValueElement != null)
                {
                    dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopy();
                }
                if (Period != null)
                {
                    dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopy();
                }
                if (Assigner != null)
                {
                    dest.Assigner = (Hl7.Fhir.Model.ResourceReference)Assigner.DeepCopy();
                }
                return(dest);
            }
            else
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }
        }
Ejemplo n.º 11
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var vm = (IssueLabelsViewModel)ViewModel;

            NavigationItem.LeftBarButtonItem = new UIBarButtonItem(Theme.CurrentTheme.BackButton, UIBarButtonItemStyle.Plain, (s, e) => vm.SaveLabelChoices.Execute(null));

            BindCollection(vm.Labels, x =>
            {
                var e     = new LabelElement(x);
                e.Tapped += () =>
                {
                    if (e.Accessory == UITableViewCellAccessory.Checkmark)
                    {
                        vm.SelectedLabels.Items.Remove(x);
                    }
                    else
                    {
                        vm.SelectedLabels.Items.Add(x);
                    }
                };

                e.Accessory = vm.SelectedLabels.Contains(x) ?
                              UITableViewCellAccessory.Checkmark :
                              UITableViewCellAccessory.None;
                return(e);
            });

            vm.BindCollection(x => x.SelectedLabels, x =>
            {
                if (Root.Count == 0)
                {
                    return;
                }

                var elements = Root[0].Elements;
                foreach (var el in elements.Cast <LabelElement>())
                {
                    el.Accessory = vm.SelectedLabels.Contains(el.Label) ?
                                   UITableViewCellAccessory.Checkmark :
                                   UITableViewCellAccessory.None;
                }

                Root.Reload(Root[0], UITableViewRowAnimation.None);
            }, true);

            var _hud = new Hud(View);

            vm.Bind(x => x.IsSaving, x =>
            {
                if (x)
                {
                    _hud.Show("Saving...");
                }
                else
                {
                    _hud.Hide();
                }
            });
        }
Ejemplo n.º 12
0
 public ChooseDeckScreen(GameState state, string name = "Choose Deck") : base(state, name)
 {
     Events.instance.AddListener <UpdateDeckListEvent> (OnUpdateDeckListEvent);
     title = new LabelElement(Copy.ChooseDeckClient, 0);
     ScreenElements.AddEnabled("title", title);
 }
Ejemplo n.º 13
0
        private StringWriter CreateBareScript()
        {
            StringWriter sw_Script = new StringWriter();
            //ArrayList al_Buttons = new ArrayList();
            //ArrayList al_Texts = new ArrayList();

            List <string> GumpCommands = new List <string>();
            List <string> GumpTexts    = new List <string>();


            sw_Script.WriteLine("// Created {0}, with Gump Studio.", DateTime.Now);
            sw_Script.WriteLine("// Exported with {0} ver {1}.", this.GetPluginInfo().PluginName, this.GetPluginInfo().Version);
            sw_Script.WriteLine("");

            if (!m_Designer.GumpProperties.Moveable)
            {
                GumpCommands.Add("NoMove");
            }

            if (!m_Designer.GumpProperties.Closeable)
            {
                GumpCommands.Add("NoClose");
            }

            if (!m_Designer.GumpProperties.Disposeable)
            {
                GumpCommands.Add("NoDispose");
            }

            if (m_Designer.Stacks.Count > 0)
            {
                int radiogroup = -1;
                int pageindex  = 0;
                // =================

                foreach (GroupElement ge_Elements in m_Designer.Stacks)
                {
                    GumpCommands.Add(Gump_WritePage(ref pageindex)); // "page pageid"
                    if (ge_Elements == null)
                    {
                        continue;
                    }

                    foreach (BaseElement be_Element in ge_Elements.GetElementsRecursive())
                    {
                        if (be_Element == null)
                        {
                            continue;
                        }

                        Type ElementType = be_Element.GetType();

                        if (ElementType == typeof(HTMLElement))
                        {
                            HTMLElement elem = be_Element as HTMLElement;
                            if (elem.TextType == HTMLElementType.HTML)
                            {
                                string cmd = Gump_WriteHTMLGump(elem, ref GumpTexts);
                                GumpCommands.Add(cmd);
                            }
                            else
                            {
                                string cmd = Gump_WriteXMFHtmlGump(elem);
                                GumpCommands.Add(cmd);
                            }
                        }
                        else if (ElementType == typeof(TextEntryElement))
                        {
                            TextEntryElement elem = be_Element as TextEntryElement;
                            string           cmd  = Gump_WriteTextEntry(elem, ref GumpTexts);
                            GumpCommands.Add(cmd);
                        }
                        else if (ElementType == typeof(LabelElement))
                        {
                            LabelElement elem = be_Element as LabelElement;
                            string       cmd  = Gump_WriteText(elem, ref GumpTexts);
                            GumpCommands.Add(cmd);
                        }

                        else if (ElementType == typeof(AlphaElement))
                        {
                            AlphaElement elem = be_Element as AlphaElement;
                            string       cmd  = Gump_WriteCheckerTrans(elem);
                            GumpCommands.Add(cmd);
                        }
                        else if (ElementType == typeof(BackgroundElement))
                        {
                            BackgroundElement elem = be_Element as BackgroundElement;
                            string            cmd  = Gump_WriteResizePic(elem);
                            GumpCommands.Add(cmd);
                        }
                        else if (ElementType == typeof(ImageElement))
                        {
                            ImageElement elem = be_Element as ImageElement;
                            string       cmd  = Gump_WriteGumpPic(elem);
                            GumpCommands.Add(cmd);
                        }
                        else if (ElementType == typeof(ItemElement))
                        {
                            ItemElement elem = be_Element as ItemElement;
                            string      cmd  = Gump_WriteTilePic(elem);
                            GumpCommands.Add(cmd);
                        }
                        else if (ElementType == typeof(TiledElement))
                        {
                            TiledElement elem = be_Element as TiledElement;
                            string       cmd  = Gump_WriteGumpPicTiled(elem);
                            GumpCommands.Add(cmd);
                        }

                        else if (ElementType == typeof(ButtonElement))
                        {
                            ButtonElement elem = be_Element as ButtonElement;
                            string        cmd  = Gump_WriteButton(elem);
                            GumpCommands.Add(cmd);
                        }

                        else if (ElementType == typeof(CheckboxElement))
                        {
                            CheckboxElement elem = be_Element as CheckboxElement;
                            string          cmd  = Gump_WriteCheckBox(elem);
                            GumpCommands.Add(cmd);
                        }
                        else if (ElementType == typeof(RadioElement))
                        {
                            RadioElement elem = be_Element as RadioElement;
                            if (elem.Group != radiogroup)
                            {
                                GumpCommands.Add("group " + elem.Group);
                                radiogroup = elem.Group;
                            }
                            string cmd = Gump_WriteRadioBox(elem);
                            GumpCommands.Add(cmd);
                        }
                    }
                }
            }
            sw_Script.WriteLine("");
            sw_Script.WriteLine("use uo;");
            sw_Script.WriteLine("use os;");
            sw_Script.WriteLine("");
            sw_Script.WriteLine("program gump_{0}(who)", frm_POLExportForm.GumpName);
            sw_Script.WriteLine("");

            sw_Script.WriteLine("\tvar gump := array {");

            int i = 1;

            foreach (string tmpCmd in GumpCommands)
            {
                sw_Script.Write("\t\t\"{0}\"", tmpCmd);

                if (i == GumpCommands.Count)
                {
                    sw_Script.WriteLine("");
                }
                else
                {
                    sw_Script.WriteLine(",", tmpCmd);
                }
                i++;
            }
            sw_Script.WriteLine("\t};");

            sw_Script.WriteLine("\tvar data := array {");

            i = 1;
            foreach (string tmpSe in GumpTexts)
            {
                sw_Script.Write("\t\t\"{0}\"", tmpSe);
                if (i == GumpTexts.Count)
                {
                    sw_Script.WriteLine("");
                }
                else
                {
                    sw_Script.WriteLine(",");
                }
                i++;
            }
            sw_Script.WriteLine("\t};");
            sw_Script.WriteLine("");
            sw_Script.WriteLine("\tSendDialogGump(who, gump, data{0});", Gump_Location(m_Designer.GumpProperties.Location));
            sw_Script.WriteLine("");
            sw_Script.WriteLine("endprogram");
            return(sw_Script);
        }
Ejemplo n.º 14
0
        public static Dalssoft.DiagramNet.BaseElement GetGenericElement(RaspiImporter.BaseElement Element)
        {
            Type elemType = Element.GetType();
            int  cuantos  = itemsPerType.ContainsKey(elemType) ? itemsPerType[elemType] : 0;

            var old = Element;

            Element = (RaspiImporter.BaseElement)Activator.CreateInstance(Element.GetType());

            Element.Name              = old.Name + (++cuantos);
            Element.ClassType         = old.ClassType;
            Element.InternalClassName = old.InternalClassName;

            itemsPerType[elemType] = cuantos;

            List <ElementInputType>        inputs    = new List <ElementInputType>();
            List <ElementOutputType>       outputs   = new List <ElementOutputType>();
            List <BaseElementFunctionInfo> functions = new List <BaseElementFunctionInfo>();
            List <ElementPropertyType>     props     = new List <ElementPropertyType>();

            foreach (var input in old.Inputs)
            {
                inputs.Add(new ElementInputType {
                    InputName = input.InputName, InputType = input.InputType, Parent = Element
                });
            }
            foreach (var output in old.Outputs)
            {
                outputs.Add(new ElementOutputType {
                    OutputName = output.OutputName, OutputType = output.OutputType, Parent = Element
                });
            }

            foreach (var func in old.Functions)
            {
                var newFunc = (BaseElementFunctionInfo)Activator.CreateInstance(func.GetType());
                newFunc.Parent       = Element;
                newFunc.FunctionName = func.FunctionName;
                functions.Add(newFunc);
            }

            foreach (var prop in old.Properties)
            {
                props.Add(new ElementPropertyType {
                    PropertyName = prop.PropertyName, PropertyType = prop.PropertyType, Parent = Element
                });
            }

            Element.Inputs     = inputs.ToArray();
            Element.Outputs    = outputs.ToArray();
            Element.Functions  = functions.ToArray();
            Element.Properties = props.ToArray();

            int addedCols = 0;            //(int)Math.Ceiling(Element.Properties.Length / 2F);

            int sInputs  = (Element.Inputs.Length + addedCols) * (itemHeight + padding) + padding;
            int sOutputs = (Element.Outputs.Length + addedCols) * (itemHeight + padding) + padding;
            //int sProperties = Element.Properties.Length * (itemHeight + padding) + padding;



            int maxSize = Math.Max(sOutputs, sInputs);

            RectangleGroup group = new RectangleGroup(0, 0, containerWidth, maxSize + labelHeight);

            group.FillColor1 = Color.FromArgb(255, 80, 80, 80);
            group.FillColor2 = Color.DarkGray;

            LabelElement elem = new LabelElement(0, 0, containerWidth, labelNameHeight);

            elem.Text       = Element.Name;
            elem.ForeColor1 = Color.White;
            elem.Font       = new Font(new FontFamily("Arial"), 12, FontStyle.Bold);

            group.Add("label", elem);

            LabelElement elemC = new LabelElement(0, labelNameHeight, containerWidth, 16);

            elemC.Text       = Element.ClassName;
            elemC.ForeColor1 = Color.White;
            elemC.Font       = new Font(new FontFamily("Arial"), 8, FontStyle.Bold);

            group.Add("class", elemC);

            int sPos = sInputs + addedCols >= maxSize ? padding + labelHeight : ((maxSize - sInputs) / 2) + labelHeight;

            foreach (var input in Element.Inputs)
            {
                RectangleNode node = new RectangleNode(sPos, padding, itemWidth, itemHeight);
                node.Label.Text = input.InputName;
                node.Label.Font = new Font(node.Label.Font.FontFamily, 7);

                node.FillColor1 = input.InputType == IOType.Integer ? Color.Coral : input.InputType == IOType.Buffer ? Color.FromArgb(255, 125, 229, 255) : input.InputType == IOType.Byte ? Color.Yellow : Color.GreenYellow;
                node.FillColor2 = Color.Empty;
                node.Tag        = input;

                group.Add(input.InputName, node);

                sPos += itemHeight + padding;
            }

            sPos = sOutputs + addedCols >= maxSize ? padding + labelHeight : ((maxSize - sOutputs) / 2) + labelHeight;

            foreach (var output in Element.Outputs)
            {
                RectangleNode node = new RectangleNode(sPos, containerWidth - (itemWidth + padding), itemWidth, itemHeight);
                node.Label.Text = output.OutputName;
                node.Label.Font = new Font(node.Label.Font.FontFamily, 7);
                node.FillColor1 = output.OutputType == IOType.Integer ? Color.Coral : output.OutputType == IOType.Buffer ? Color.FromArgb(255, 125, 229, 255) : output.OutputType == IOType.Byte ? Color.Yellow : Color.GreenYellow;
                node.FillColor2 = Color.Empty;
                node.Tag        = output;

                group.Add(output.OutputName, node);

                sPos += itemHeight + padding;
            }

            /*
             *
             * sPos = (maxSize - (addedCols - 1) * (itemHeight + padding)) + padding / 2;
             * bool left = true;
             *
             * foreach (var prop in Element.Properties)
             * {
             *
             *      RectangleNode node = new RectangleNode(sPos, left ? padding : containerWidth - (itemWidth + padding), itemWidth, itemHeight);
             *      node.Label.Text = prop.PropertyName;
             *      node.Label.Font = new Font(node.Label.Font.FontFamily, 7);
             *      node.FillColor1 = Color.NavajoWhite;//peachpuff
             *      node.FillColor2 = Color.Empty;
             *      node.Tag = prop;
             *
             *      group.Add(prop.PropertyName, node);
             *
             *      if(!left)
             *              sPos += itemHeight + padding;
             *
             *      left = !left;
             *
             * }
             */

            group.Tag = Element;

            Element.NameChanged += (o, e) => {
                if (Element.ClassType == typeof(RaspBuffer))
                {
                    BufferConverter.bufferList.Remove(elem.Text);
                    BufferConverter.bufferList.Add(Element.Name, Element);
                }

                elem.Text = Element.Name;
            };

            if (Element.ClassType == typeof(RaspBuffer))
            {
                BufferConverter.bufferList.Add(Element.Name, Element);
            }

            group.RemovedFromDocument += (o, e) => {
                if (Element.ClassType == typeof(RaspBuffer))
                {
                    BufferConverter.bufferList.Remove(elem.Text);
                }
            };

            return(group);
        }
 public LabelElement Label()
 {
     return _label ?? (_label = new LabelElement(_container));
 }
Ejemplo n.º 16
0
        public void Start(Point mousePoint, Document document, OnElementMovingDelegate onElementMovingDelegate)
        {
            this.document = document;
            this.onElementMovingDelegate = onElementMovingDelegate;

            // Get Controllers
            moveCtrl = new IMoveController[document.SelectedElements.Count];
            IMoveController[] moveLabelCtrl = new IMoveController[document.SelectedElements.Count];
            for (int i = document.SelectedElements.Count - 1; i >= 0; i--)
            {
                moveCtrl[i] = ControllerHelper.GetMoveController(document.SelectedElements[i]);

                if (moveCtrl[i] != null && moveCtrl[i].CanMove)
                {
                    onElementMovingDelegate(new ElementEventArgs(document.SelectedElements[i]));
                    moveCtrl[i].Start(mousePoint);

                    //ILabelElement - Move Label inside the element
                    if (document.SelectedElements[i] is ILabelElement &&
                        ControllerHelper.GetLabelController(document.SelectedElements[i]) == null)
                    {
                        LabelElement label = ((ILabelElement)document.SelectedElements[i]).Label;
                        moveLabelCtrl[i] = ControllerHelper.GetMoveController(label);
                        if (moveLabelCtrl[i] != null && moveLabelCtrl[i].CanMove)
                        {
                            moveLabelCtrl[i].Start(mousePoint);
                        }
                        else
                        {
                            moveLabelCtrl[i] = null;
                        }
                    }
                }
                else
                {
                    moveCtrl[i] = null;
                }
            }

            moveCtrl = (IMoveController[])ArrayHelper.Append(moveCtrl, moveLabelCtrl);
            moveCtrl = (IMoveController[])ArrayHelper.Shrink(moveCtrl, null);

            // Can't move only links
            bool isOnlyLink = true;

            foreach (IMoveController ctrl in moveCtrl)
            {
                // Verify
                if (ctrl != null)
                {
                    ctrl.OwnerElement.Invalidate();

                    if (!(ctrl.OwnerElement is BaseLinkElement) && !(ctrl.OwnerElement is LabelElement))
                    {
                        isOnlyLink = false;
                        break;
                    }
                }
            }
            if (isOnlyLink)
            {
                //End Move the Links
                foreach (IMoveController ctrl in moveCtrl)
                {
                    if (ctrl != null)
                    {
                        ctrl.End();
                    }
                }
                moveCtrl = new IMoveController[] { null };
            }

            //Upper selecion point controller
            UpdateUpperSelectionPoint();
            upperSelPointDragOffset.X = upperSelPoint.X - mousePoint.X;
            upperSelPointDragOffset.Y = upperSelPoint.Y - mousePoint.Y;

            isMoving = true;
        }
 public abstract void OnLabel(LabelElement element);
Ejemplo n.º 18
0
        public IFormElement Render()
        {
            IFormElement element;

            switch (Type)
            {
            case FormElementType.Entry:
                element = new EntryElement();
                break;

            case FormElementType.Address:
                element = new AddressElement();
                break;

            case FormElementType.DatePicker:
                element = new DatePickerElement();
                break;

            case FormElementType.Picker:
                element = new PickerElement();
                break;

            case FormElementType.Editor:
                element = new EditorElement();
                break;

            case FormElementType.Switch:
                element = new SwitchElement();
                break;

            case FormElementType.CheckboxList:
                element = new CheckboxListElement();
                break;

            case FormElementType.Hidden:
                element = new HiddenElement();
                break;

            case FormElementType.Button:
                element = new ButtonElement();
                break;

            case FormElementType.Label:
                element = new LabelElement();
                break;

            default:
                element = new EntryElement();
                break;
            }
            element.Label         = this.Label;
            element.Key           = Key;
            element.Keyboard      = Keyboard;
            element.HeightRequest = HeightRequest;
            element.Options       = Options;
            element.Required      = Required;
            element.Attributes    = Attributes;
            element.AutoPostBack  = AutoPostBack;

            if (!string.IsNullOrWhiteSpace(ElementBackgroundColor))
            {
                element.ElementBackgroundColor = (Color) new ColorTypeConverter().ConvertFromInvariantString(ElementBackgroundColor);
            }

            if (!string.IsNullOrWhiteSpace(ElementTextColor))
            {
                element.ElementTextColor = (Color) new ColorTypeConverter().ConvertFromInvariantString(ElementTextColor);
            }

            element.Render();
            if (!string.IsNullOrWhiteSpace(Value))
            {
                element.Value = Value;
            }

            return(element);
        }
Ejemplo n.º 19
0
 public void Init()
 {
     label = new LabelElement();
 }
Ejemplo n.º 20
0
        public UIElement GetStatisticPanel()
        {
            var stack     = new StackContainer();
            var mainGroup = new GroupContainer {
                CaptionHtml = "Statystyki wybranego autora", LabelHeight = "10", IsReadOnly = "{ReadOnlyMode}"
            };

            var commitCountGroup = new GroupContainer {
                CaptionHtml = "Ilość commitów ", LabelHeight = "10"
            };

            var countCommandRow = new RowContainer();
            var dateField       = new FieldElement {
                CaptionHtml = "Data", EditValue = "{CountCommandDate}", OuterWidth = "40"
            };

            countCommandRow.Elements.Add(dateField);
            commitCountGroup.Elements.Add(countCommandRow);

            var resultCountRow   = new RowContainer();
            var commitCountField = new FieldElement {
                CaptionHtml = "Ilość", EditValue = "{CommitCount}", OuterWidth = "25", IsReadOnly = "true"
            };
            var countCommitsCommand = new CommandElement {
                CaptionHtml = "Pokaż wartość", MethodName = "SetCommitCount", OuterWidth = "15"
            };

            resultCountRow.Elements.Add(commitCountField);
            resultCountRow.Elements.Add(countCommitsCommand);
            commitCountGroup.Elements.Add(resultCountRow);

            mainGroup.Elements.Add(commitCountGroup);

            var averageCountGroup = new GroupContainer {
                CaptionHtml = "Średnia ilość commitów ", LabelHeight = "10"
            };

            var rangeFromRow  = new RowContainer();
            var dateFromField = new FieldElement {
                CaptionHtml = "Od", EditValue = "{AverageDateFrom}", OuterWidth = "40"
            };

            rangeFromRow.Elements.Add(dateFromField);

            var rangeToRow  = new RowContainer();
            var dateToField = new FieldElement {
                CaptionHtml = "Do", EditValue = "{AverageDateTo}", OuterWidth = "40"
            };

            rangeToRow.Elements.Add(dateToField);

            averageCountGroup.Elements.Add(rangeFromRow);
            averageCountGroup.Elements.Add(rangeToRow);

            var averageCountRow   = new RowContainer();
            var averageCountField = new FieldElement {
                CaptionHtml = "Ilość", EditValue = "{AverageCommitCount}", OuterWidth = "25", IsReadOnly = "true"
            };
            var averageCountCommand = new CommandElement {
                CaptionHtml = "Pokaż wartość", MethodName = "SetAverageCommitCount", OuterWidth = "15"
            };
            var invalidRangeLabel = new LabelElement {
                CaptionHtml = "{InvalidRangeInfo}"
            };

            averageCountRow.Elements.Add(averageCountField);
            averageCountRow.Elements.Add(averageCountCommand);
            averageCountRow.Elements.Add(invalidRangeLabel);
            averageCountGroup.Elements.Add(averageCountRow);

            mainGroup.Elements.Add(averageCountGroup);

            stack.Elements.Add(mainGroup);
            return(stack);
        }
Ejemplo n.º 21
0
        public static new Element FromObj(object instance)
        {
            if (instance == null)
            {
                return(null);
            }
            try{
                string tagUrn  = (string)GetProperty(instance, "tagUrn");
                string tagName = (string)GetProperty(instance, "tagName");
                if (tagUrn == null || tagUrn == "")
                {
                    switch (tagName.ToLower())
                    {
                    case "!":                       return(CommentElement.FromObj(instance));

                    case "a":                       return(AElement.FromObj(instance));

                    case "area":            return(AreaElement.FromObj(instance));

                    case "base":            return(BaseElement.FromObj(instance));

                    case "basefont":        return(BaseFontElement.FromObj(instance));

                    case "bgsound":         return(BgsoundElement.FromObj(instance));

                    case "address":
                    case "pre":
                    case "center":
                    case "listing":
                    case "xmp":
                    case "plaintext":
                    case "blockquote":      return(BlockElement.FromObj(instance));

                    case "body":            return(BodyElement.FromObj(instance));

                    case "br":                      return(BrElement.FromObj(instance));

                    case "button":          return(ButtonElement.FromObj(instance));

                    case "dd":                      return(DdElement.FromObj(instance));

                    case "div":                     return(DivElement.FromObj(instance));

                    case "dl":                      return(DlElement.FromObj(instance));

                    case "dt":                      return(DtElement.FromObj(instance));

                    case "embed":           return(EmbedElement.FromObj(instance));

                    case "fieldset":        return(FieldsetElement.FromObj(instance));

                    case "font":            return(FontElement.FromObj(instance));

                    case "form":            return(FormElement.FromObj(instance));

                    case "frame":           return(FrameElement.FromObj(instance));

                    case "frameset":        return(FramesetElement.FromObj(instance));

                    case "head":            return(HeadElement.FromObj(instance));

                    case "h1":
                    case "h2":
                    case "h3":
                    case "h4":
                    case "h5":
                    case "h6":
                        return(HnElement.FromObj(instance));

                    case "hr":                      return(HrElement.FromObj(instance));

                    case "html":            return(HtmlElement.FromObj(instance));

                    case "iframe":          return(IframeElement.FromObj(instance));

                    case "img":                     return(ImgElement.FromObj(instance));

                    case "input":           return(InputElement.FromObj(instance));

                    case "isindex":         return(IsindexElement.FromObj(instance));

                    case "legend":          return(LegendElement.FromObj(instance));

                    case "label":           return(LabelElement.FromObj(instance));

                    case "li":                      return(LiElement.FromObj(instance));

                    case "link":            return(LinkElement.FromObj(instance));

                    case "map":                     return(MapElement.FromObj(instance));

                    case "marquee":         return(MarqueeElement.FromObj(instance));

                    case "meta":            return(MetaElement.FromObj(instance));

                    case "nextid":          return(NextidElement.FromObj(instance));

                    case "noembed":
                    case "noframes":
                    case "nolayer":
                    case "noscript":        return(NoshowElement.FromObj(instance));

                    case "applet":
                    case "object":          return(ObjectElement.FromObj(instance));

                    case "ol":                      return(OlElement.FromObj(instance));

                    case "optgroup":
                    case "option":          return(OptionElement.FromObj(instance));

                    case "p":                       return(PElement.FromObj(instance));

                    case "param":           return(ParamElement.FromObj(instance));

                    case "i":
                    case "u":
                    case "b":
                    case "q":
                    case "s":
                    case "strong":
                    case "del":
                    case "strike":
                    case "em":
                    case "small":
                    case "big":
                    case "ruby":
                    case "rp":
                    case "sub":
                    case "sup":
                    case "acronym":
                    case "bdo":
                    case "cite":
                    case "dfn":
                    case "ins":
                    case "code":
                    case "kbd":
                    case "samp":
                    case "var":
                    case "nobr":            return(PhraseElement.FromObj(instance));

                    case "script":          return(ScriptElement.FromObj(instance));

                    case "select":          return(SelectElement.FromObj(instance));

                    case "span":            return(SpanElement.FromObj(instance));

                    case "style":           return(StyleElement.FromObj(instance));

                    case "caption":         return(CaptionElement.FromObj(instance));

                    case "td":
                    case "th":                      return(TableCellElement.FromObj(instance));

                    case "table":           return(TableElement.FromObj(instance));

                    case "colgroup":
                    case "col":                     return(ColElement.FromObj(instance));

                    case "tr":                      return(TrElement.FromObj(instance));

                    case "thead":
                    case "tbody":
                    case "tfoot":           return(TableSectionElement.FromObj(instance));

                    case "textarea":        return(TextAreaElement.FromObj(instance));

                    case "wbr": return(TextElement.FromObj(instance));

                    case "title":           return(TitleElement.FromObj(instance));

                    case "dir":
                    case "menu":
                    case "ul":                      return(UlElement.FromObj(instance));
                        // optionbutton ?
                        // spanflow ?
                        // default:			return UnknownElement.FromObj(instance);
                    }
                }
            }catch {
                // IHTMLElement でない可能性
            }

            return(new Element(instance));
        }
Ejemplo n.º 22
0
 public TwoLabelOhlcPointElement(DataPoint point)
     : base(point)
 {
     secondLabel = CreateLabelElement(this);
     this.Children.Add(secondLabel);
 }
Ejemplo n.º 23
0
 public void SetLabelNameTest()
 {
     label = new LabelElement("Friends");
     Assert.AreEqual("Friends", label.LabelName,
                     "Label does not have correct value after setting");
 }
Ejemplo n.º 24
0
        private HtmlElement CreateFor(XElement element)
        {
            HtmlElement result;

            switch (element.Name.LocalName.ToLower())
            {
            case "form":
                result = new FormElement(element);
                break;

            case "input":
                string type = element.GetAttribute("type") ?? "";
                switch (type.ToLower())
                {
                case "radio":
                    result = new RadioInputElement(element);
                    break;

                case "checkbox":
                    result = new CheckboxInputElement(element);
                    break;

                case "submit":
                case "image":
                case "button":
                    string buttonType = element.GetAttribute("type");
                    result = new ButtonInputElement(element);
                    break;

                case "file":
                    result = new FileUploadElement(element);
                    break;

                default:
                    result = new InputElement(element);
                    break;
                }
                break;

            case "textarea":
                result = new TextAreaElement(element);
                break;

            case "select":
                result = new SelectElement(element);
                break;

            case "option":
                result = new OptionElement(element);
                break;

            case "iframe":
            case "frame":
                result = new FrameElement(element);
                break;

            case "a":
                result = new AnchorElement(element);
                break;

            case "label":
                result = new LabelElement(element);
                break;

            case "button":
                result = new ButtonInputElement(element);
                break;

            default:
                result = new HtmlElement(element);
                break;
            }
            _allActiveElements.Add(result);
            return(result);
        }
Ejemplo n.º 25
0
            /// <inheritdoc />
            protected override void Deinitialize()
            {
                _infoLabel = null;

                base.Deinitialize();
            }
Ejemplo n.º 26
0
 private void OnLabelRemoved(LabelElement label)
 {
     labels.Remove(label);
 }
Ejemplo n.º 27
0
        internal static HtmlElement CreateFor(XElement element)
        {
            HtmlElement result = null;

            switch (element.Name.LocalName.ToLower())
            {
            case "form":
                result = new FormElement(element);
                break;

            case "input":
                string type = element.GetAttribute("type") ?? "";
                switch (type.ToLower())
                {
                case "radio":
                    result = new RadioInputElement(element);
                    break;

                case "checkbox":
                    result = new CheckboxInputElement(element);
                    break;

                case "image":
                    result = new ImageInputElement(element);
                    break;

                case "submit":
                case "button":
                    result = new ButtonInputElement(element);
                    break;

                case "file":
                    result = new FileUploadElement(element);
                    break;

                case "email":
                    result = new EmailInputElement(element);
                    break;

                case "url":
                    result = new UrlInputElement(element);
                    break;

                case "datetime-local":
                case "date":
                case "month":
                case "week":
                case "time":
                    result = new DateTimeInputElement(element);
                    break;

                case "number":
                case "range":
                    result = new NumberInputElement(element);
                    break;

                case "color":
                    result = new ColorInputElement(element);
                    break;

                default:
                    result = new InputElement(element);
                    break;
                }
                break;

            case "textarea":
                result = new TextAreaElement(element);
                break;

            case "select":
                result = new SelectElement(element);
                break;

            case "option":
                result = new OptionElement(element);
                break;

            case "iframe":
            case "frame":
                var src = element.GetAttributeCI("src");
                if (!string.IsNullOrWhiteSpace(src))
                {
                    result = new FrameElement(element);
                }
                else
                {
                    result = default(HtmlElement);
                }
                break;

            case "a":
                result = new AnchorElement(element);
                break;

            case "label":
                result = new LabelElement(element);
                break;

            case "button":
                result = new ButtonInputElement(element);
                break;

            default:
                result = new HtmlElement(element);
                break;
            }
            return(result);
        }
Ejemplo n.º 28
0
        private string Gump_WriteText(LabelElement elem, ref List<string> texts)
        {
            int textid = texts.Count;

            string text = String.Concat("Text id.", textid);

            if (elem.Text != null)
            {
                text = (elem.Text == String.Empty) ? text : elem.Text;
            }

            texts.Add(text);

            return String.Format("text {0} {1} {2} {3}", elem.X, elem.Y, elem.Hue, textid);
        }
 public override void OnLabel(LabelElement element)
 {
     drawingAdapter.DrawString(element.text, element.position, element.color);
 }
Ejemplo n.º 30
0
        private StringWriter CreateDistroScript(bool bShowComment, bool bShowNames, bool bDefaultTexts)
        {
            StringWriter  sw_Script    = new StringWriter();
            List <string> GumpCommands = new List <string>();

            bGetDefaultText = bDefaultTexts; // define if plugin will set default text for empty elems

            string gump_name = GetGumpName();

            GumpCommands.Add(DistroGump_GFCreateGump(gump_name, m_Designer.GumpProperties.Location));
            GumpCommands.Add("");
            if (!m_Designer.GumpProperties.Moveable)
            {
                GumpCommands.Add(String.Format("GFMovable({0}, 0);", gump_name));
            }

            if (!m_Designer.GumpProperties.Closeable)
            {
                GumpCommands.Add(String.Format("GFClosable({0}, 0);", gump_name));
            }

            if (!m_Designer.GumpProperties.Disposeable)
            {
                GumpCommands.Add(String.Format("GFDisposable({0}, 0);", gump_name));
            }


            if (m_Designer.Stacks.Count > 0)
            {
                int radiogroup = -1;
                int pageindex  = 0;
                // =================

                foreach (GroupElement ge_Elements in m_Designer.Stacks)
                {
                    if (pageindex > 0)
                    {
                        GumpCommands.Add("");
                    }

                    GumpCommands.Add(DistroGump_GFPage(gump_name, ref pageindex)); // "page pageid"
                    if (ge_Elements == null)
                    {
                        continue;
                    }

                    foreach (BaseElement be_Element in ge_Elements.GetElementsRecursive())
                    {
                        if (be_Element == null)
                        {
                            continue;
                        }

                        if (bShowComment || bShowNames)
                        {
                            string comment = GetCommentString(be_Element, bShowComment, bShowNames);
                            if (comment != String.Empty)
                            {
                                GumpCommands.Add("");
                                GumpCommands.Add(comment);
                            }
                        }

                        Type ElementType = be_Element.GetType();

                        if (ElementType == typeof(HTMLElement))
                        {
                            HTMLElement elem = be_Element as HTMLElement;
                            if (elem.TextType == HTMLElementType.HTML)
                            {
                                GumpCommands.Add(DistroGump_GFHTMLArea(gump_name, elem));
                            }
                            else
                            {
                                GumpCommands.Add(DistroGump_GFAddHTMLLocalized(gump_name, elem));
                            }
                        }
                        else if (ElementType == typeof(TextEntryElement))
                        {
                            TextEntryElement elem = be_Element as TextEntryElement;
                            GumpCommands.Add(DistroGump_GFTextEntry(gump_name, elem));
                        }
                        else if (ElementType == typeof(LabelElement))
                        {
                            LabelElement elem = be_Element as LabelElement;
                            GumpCommands.Add(DistroGump_GFTextLine(gump_name, elem));
                        }

                        else if (ElementType == typeof(AlphaElement))
                        {
                            AlphaElement elem = be_Element as AlphaElement;
                            GumpCommands.Add(DistroGump_GFAddAlphaRegion(gump_name, elem));
                        }
                        else if (ElementType == typeof(BackgroundElement))
                        {
                            BackgroundElement elem = be_Element as BackgroundElement;
                            GumpCommands.Add(DistroGump_GFResizePic(gump_name, elem));
                        }
                        else if (ElementType == typeof(ImageElement))
                        {
                            ImageElement elem = be_Element as ImageElement;
                            GumpCommands.Add(DistroGump_GFGumpPic(gump_name, elem));
                        }
                        else if (ElementType == typeof(ItemElement))
                        {
                            ItemElement elem = be_Element as ItemElement;
                            GumpCommands.Add(DistroGump_GFTilePic(gump_name, elem));
                        }
                        else if (ElementType == typeof(TiledElement))
                        {
                            // TODO: Support "GFGumpPicTiled" when it´s in distro
                            TiledElement elem = be_Element as TiledElement;
                            GumpCommands.Add("");
                            GumpCommands.Add("//Gump package does not support GumpPicTiled");
                            GumpCommands.Add("//" + Gump_WriteGumpPicTiled(elem));
                            GumpCommands.Add("");
                        }

                        else if (ElementType == typeof(ButtonElement))
                        {
                            ButtonElement elem = be_Element as ButtonElement;
                            GumpCommands.Add(DistroGump_GFAddButton(gump_name, elem));
                        }

                        else if (ElementType == typeof(CheckboxElement))
                        {
                            CheckboxElement elem = be_Element as CheckboxElement;
                            GumpCommands.Add(DistroGump_GFCheckBox(gump_name, elem));
                        }
                        else if (ElementType == typeof(RadioElement))
                        {
                            RadioElement elem = be_Element as RadioElement;
                            if (elem.Group != radiogroup)
                            {
                                GumpCommands.Add(String.Format("GFSetRadioGroup({0}, {1});", gump_name, elem.Group));
                                radiogroup = elem.Group;
                            }
                            GumpCommands.Add(DistroGump_GFRadioButton(gump_name, elem));
                        }
                    }
                }
            }


            sw_Script.WriteLine("// Created {0}, with Gump Studio.", DateTime.Now);
            sw_Script.WriteLine("// Exported with {0} ver {1} for gump pkg", this.GetPluginInfo().PluginName, this.GetPluginInfo().Version);
            sw_Script.WriteLine();
            sw_Script.WriteLine("use uo;");
            sw_Script.WriteLine("use os;");
            sw_Script.WriteLine();
            sw_Script.WriteLine("include \":gumps:gumps\";");
            sw_Script.WriteLine();
            sw_Script.WriteLine("program gump_{0}(who)", gump_name);
            sw_Script.WriteLine();

            foreach (string cmd in GumpCommands)
            {
                sw_Script.WriteLine("\t" + cmd);
            }
            sw_Script.WriteLine();
            sw_Script.WriteLine("\tGFSendGump(who, {0});", gump_name);
            sw_Script.WriteLine();
            sw_Script.WriteLine("endprogram");


            return(sw_Script);
        }
Ejemplo n.º 31
0
        public StringWriter GetSphereScript(bool bIsRevision)
        {
            StringWriter stringWriter1 = new StringWriter();
            ArrayList    arrayList1    = new ArrayList();
            ArrayList    arrayList2    = new ArrayList();

            stringWriter1.WriteLine("// Created {0}, with Gump Studio.", (object)DateTime.Now);
            stringWriter1.WriteLine("// Exported with with {0} ver {1}.", (object)this.GetPluginInfo().PluginName, (object)this.GetPluginInfo().Version);
            stringWriter1.WriteLine("// Script for {0}", bIsRevision ? (object)"0.56/Revisions" : (object)"0.99/1.0");
            stringWriter1.WriteLine("");
            stringWriter1.WriteLine("[DIALOG {0}]", (object)this.frm_SphereExportForm.GumpName);
            StringWriter stringWriter2 = stringWriter1;
            string       format        = "{0}";
            int          num1          = bIsRevision ? 1 : 0;
            Point        location      = ((GumpProperties)this.m_Designer.GumpProperties).Location;
            int          x             = location.X;

            location = ((GumpProperties)this.m_Designer.GumpProperties).Location;
            int    y   = location.Y;
            string str = this.Gump_WriteLocation(num1 != 0, x, y);

            stringWriter2.WriteLine(format, (object)str);
            if (!((GumpProperties)this.m_Designer.GumpProperties).Closeable)
            {
                stringWriter1.WriteLine("{0}", bIsRevision ? (object)"NOCLOSE" : (object)"NoClose");
            }
            if (!((GumpProperties)this.m_Designer.GumpProperties).Moveable)
            {
                stringWriter1.WriteLine("{0}", bIsRevision ? (object)"NOMOVE" : (object)"NoMove");
            }
            if (!((GumpProperties)this.m_Designer.GumpProperties).Disposeable)
            {
                stringWriter1.WriteLine("{0}", bIsRevision ? (object)"NODISPOSE" : (object)"NoDispose");
            }
            if (((ArrayList)this.m_Designer.Stacks).Count > 0)
            {
                int id1  = 0;
                int id2  = 0;
                int id3  = 0;
                int num2 = -1;
                for (int iPage = 0; iPage < ((ArrayList)this.m_Designer.Stacks).Count; ++iPage)
                {
                    stringWriter1.WriteLine("{0}", (object)this.Gump_WritePage(bIsRevision, iPage));
                    GroupElement stack = ((ArrayList)this.m_Designer.Stacks)[iPage] as GroupElement;
                    if (stack != null)
                    {
                        ArrayList elementsRecursive = stack.GetElementsRecursive();
                        if (elementsRecursive.Count > 0)
                        {
                            for (int index = 0; index < elementsRecursive.Count; ++index)
                            {
                                BaseElement baseElement = elementsRecursive[index] as BaseElement;
                                if (baseElement != null)
                                {
                                    HTMLElement htmlElement = baseElement as HTMLElement;
                                    if (htmlElement != null)
                                    {
                                        if (htmlElement.TextType == HTMLElementType.HTML)
                                        {
                                            if (bIsRevision)
                                            {
                                                string text = "HtmlGump id." + id1.ToString();
                                                if (htmlElement.HTML != null)
                                                {
                                                    arrayList2.Add((object)new SphereExporter.SphereElement(htmlElement.HTML.Length == 0 ? text : htmlElement.HTML, id1));
                                                }
                                                else
                                                {
                                                    arrayList2.Add((object)new SphereExporter.SphereElement(text, id1));
                                                }
                                            }
                                            stringWriter1.WriteLine("{0}", (object)this.Gump_WriteHTML(bIsRevision, ((BaseElement)htmlElement).X, ((BaseElement)htmlElement).Y, ((ResizeableElement)htmlElement).Width, ((ResizeableElement)htmlElement).Height, htmlElement.ShowBackground, htmlElement.ShowScrollbar, ref id1, htmlElement.HTML));
                                        }
                                        else
                                        {
                                            stringWriter1.WriteLine("{0}", (object)this.Gump_WriteXFHTML(bIsRevision, ((BaseElement)htmlElement).X, ((BaseElement)htmlElement).Y, ((ResizeableElement)htmlElement).Width, ((ResizeableElement)htmlElement).Height, htmlElement.ShowBackground, htmlElement.ShowScrollbar, htmlElement.CliLocID));
                                        }
                                    }
                                    else
                                    {
                                        AlphaElement alphaElement = baseElement as AlphaElement;
                                        if (alphaElement != null)
                                        {
                                            stringWriter1.WriteLine("{0}", (object)this.Gump_WriteCheckerTrans(bIsRevision, ((BaseElement)alphaElement).X, ((BaseElement)alphaElement).Y, ((ResizeableElement)alphaElement).Width, ((ResizeableElement)alphaElement).Height));
                                        }
                                        else
                                        {
                                            BackgroundElement backgroundElement = baseElement as BackgroundElement;
                                            if (backgroundElement != null)
                                            {
                                                stringWriter1.WriteLine("{0}", (object)this.Gump_WriteResizePic(bIsRevision, ((BaseElement)backgroundElement).X, ((BaseElement)backgroundElement).Y, ((ResizeableElement)backgroundElement).Width, ((ResizeableElement)backgroundElement).Height, backgroundElement.GumpID));
                                            }
                                            else
                                            {
                                                ButtonElement buttonElement = baseElement as ButtonElement;
                                                if (buttonElement != null)
                                                {
                                                    arrayList1.Add((object)new SphereExporter.SphereElement("// " + ((BaseElement)buttonElement).Name + "\n// " + buttonElement.Code, buttonElement.ButtonType == ButtonTypeEnum.Reply ? buttonElement.Param : id2));
                                                    stringWriter1.WriteLine("{0}", (object)this.Gump_WriteButton(bIsRevision, ((BaseElement)buttonElement).X, ((BaseElement)buttonElement).Y, buttonElement.NormalID, buttonElement.PressedID, buttonElement.ButtonType == ButtonTypeEnum.Page, buttonElement.Param, ref id2));
                                                }
                                                else
                                                {
                                                    ImageElement imageElement = baseElement as ImageElement;
                                                    if (imageElement != null)
                                                    {
                                                        stringWriter1.WriteLine("{0}", (object)this.Gump_WriteGumpPic(bIsRevision, ((BaseElement)imageElement).X, ((BaseElement)imageElement).Y, imageElement.GumpID, imageElement.Hue.ToString()));
                                                    }
                                                    else
                                                    {
                                                        ItemElement itemElement = baseElement as ItemElement;
                                                        if (itemElement != null)
                                                        {
                                                            stringWriter1.WriteLine("{0}", (object)this.Gump_WriteTilePic(bIsRevision, ((BaseElement)itemElement).X, ((BaseElement)itemElement).Y, itemElement.ItemID, itemElement.Hue.ToString()));
                                                        }
                                                        else
                                                        {
                                                            LabelElement labelElement = baseElement as LabelElement;
                                                            if (labelElement != null)
                                                            {
                                                                if (bIsRevision)
                                                                {
                                                                    string text = "Text id." + id1.ToString();
                                                                    if (labelElement.Text != null)
                                                                    {
                                                                        arrayList2.Add((object)new SphereExporter.SphereElement(labelElement.Text.Length == 0 ? text : labelElement.Text, id1));
                                                                    }
                                                                    else
                                                                    {
                                                                        arrayList2.Add((object)new SphereExporter.SphereElement(text, id1));
                                                                    }
                                                                }
                                                                stringWriter1.WriteLine("{0}", (object)this.Gump_WriteText(bIsRevision, ((BaseElement)labelElement).X, ((BaseElement)labelElement).Y, labelElement.Hue.ToString(), labelElement.Text, ref id1));
                                                            }
                                                            else
                                                            {
                                                                RadioElement radioElement = baseElement as RadioElement;
                                                                if (radioElement != null)
                                                                {
                                                                    if (radioElement.Group != num2)
                                                                    {
                                                                        stringWriter1.WriteLine("Group{0}", bIsRevision ? (object)(" " + radioElement.Group.ToString()) : (object)("(" + radioElement.Group.ToString() + ")"));
                                                                        num2 = radioElement.Group;
                                                                    }
                                                                    stringWriter1.WriteLine("{0}", (object)this.Gump_WriteRadioBox(bIsRevision, ((BaseElement)radioElement).X, ((BaseElement)radioElement).Y, ((CheckboxElement)radioElement).UnCheckedID, ((CheckboxElement)radioElement).CheckedID, radioElement.Checked, radioElement.Value));
                                                                }
                                                                else
                                                                {
                                                                    CheckboxElement checkboxElement = baseElement as CheckboxElement;
                                                                    if (checkboxElement != null)
                                                                    {
                                                                        stringWriter1.WriteLine("{0}", (object)this.Gump_WriteCheckBox(bIsRevision, ((BaseElement)checkboxElement).X, ((BaseElement)checkboxElement).Y, checkboxElement.UnCheckedID, checkboxElement.CheckedID, checkboxElement.Checked, ref id3));
                                                                    }
                                                                    else
                                                                    {
                                                                        TextEntryElement textEntryElement = baseElement as TextEntryElement;
                                                                        if (textEntryElement != null)
                                                                        {
                                                                            if (bIsRevision)
                                                                            {
                                                                                string text = "Textentry id." + textEntryElement.ID.ToString();
                                                                                if (textEntryElement.InitialText != null)
                                                                                {
                                                                                    arrayList2.Add((object)new SphereExporter.SphereElement(textEntryElement.InitialText.Length == 0 ? text : textEntryElement.InitialText, id1));
                                                                                }
                                                                                else
                                                                                {
                                                                                    arrayList2.Add((object)new SphereExporter.SphereElement(text, id1));
                                                                                }
                                                                            }
                                                                            stringWriter1.WriteLine("{0}", (object)this.Gump_WriteTextEntry(bIsRevision, ((BaseElement)textEntryElement).X, ((BaseElement)textEntryElement).Y, ((ResizeableElement)textEntryElement).Width, ((ResizeableElement)textEntryElement).Height, textEntryElement.Hue.ToString(), textEntryElement.InitialText, textEntryElement.ID, ref id1));
                                                                        }
                                                                        else
                                                                        {
                                                                            TiledElement tiledElement = baseElement as TiledElement;
                                                                            if (tiledElement != null)
                                                                            {
                                                                                stringWriter1.WriteLine("{0}", (object)this.Gump_WriteGumpPicTiled(bIsRevision, ((BaseElement)tiledElement).X, ((BaseElement)tiledElement).Y, ((ResizeableElement)tiledElement).Width, ((ResizeableElement)tiledElement).Height, tiledElement.GumpID));
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            stringWriter1.WriteLine("");
            if (bIsRevision)
            {
                stringWriter1.WriteLine("[DIALOG {0} text]", (object)this.frm_SphereExportForm.GumpName);
                foreach (SphereExporter.SphereElement sphereElement in arrayList2)
                {
                    stringWriter1.WriteLine("{0}", (object)sphereElement.sText);
                }
                stringWriter1.WriteLine("");
            }
            stringWriter1.WriteLine("[DIALOG {0} button]", (object)this.frm_SphereExportForm.GumpName);
            foreach (SphereExporter.SphereElement sphereElement in arrayList1)
            {
                stringWriter1.WriteLine("ON={0}", (object)sphereElement.iId.ToString());
                stringWriter1.WriteLine("{0}", (object)sphereElement.sText);
                stringWriter1.WriteLine("");
            }
            stringWriter1.WriteLine("{0}", (object)this.Gump_WriteEOF());
            return(stringWriter1);
        }
Ejemplo n.º 32
0
        private UIElement getUIElement(int i)
        {
            var env   = new EnvironmentExtender();
            var row   = new RowContainer();
            var group = new GroupContainer {
                DataContext = "{Tasks[" + i + "]}",
                CaptionHtml = "{Title}",
                Width       = "350px",
                Height      = "80px"
            };

            #region stackLeft

            var stackLeft = new StackContainer();
            var image     = new FieldElement {
                CaptionHtml = "",
                EditValue   = "{Zadanie.Przedstawiciel.DefaultImage}",
                Width       = "110px",
                Height      = "150px",
                Class       = new UIClass[] { UIClass.ImageEdit }
            };

            stackLeft.Elements.Add(image);
            row.Elements.Add(stackLeft);

            #endregion stackLeft

            #region stackRight

            var stackRight = new StackContainer {
                LabelWidth = "20"
            };

            var labelContact = new LabelElement {
                CaptionHtml = "{Zadanie.Przedstawiciel.Nazwa}",
                Class       = new UIClass[] { UIClass.BoldLabel, UIClass.GreenFont },
                Width       = "20"
            };

            var labelPhone = new LabelElement {
                CaptionHtml = "{Zadanie.Przedstawiciel.Kontakt.TelefonKomorkowy}",
                Class       = new UIClass[] { UIClass.BoldLabel, UIClass.GreenFont },
                Width       = "16"
            };

            var labelCompany = new LabelElement {
                CaptionHtml = "{Zadanie.Kontrahent.Kod}",
                Width       = "20"
            };

            var labelAddress1 = new LabelElement {
                CaptionHtml = "{Zadanie.Kontrahent.Adres.Linia1}",
                Width       = "30"
            };

            var labelAddress2 = new LabelElement {
                CaptionHtml = "{Zadanie.Kontrahent.Adres.Linia2}",
                Width       = "30"
            };

            var command = new CommandElement {
                MethodName  = "ShowLocalization",
                CaptionHtml = "Zobacz dojazd",
                Width       = "*"
            };

            stackRight.Elements.Add(labelContact);
            stackRight.Elements.Add(labelPhone);
            stackRight.Elements.Add(labelCompany);
            stackRight.Elements.Add(labelAddress1);
            stackRight.Elements.Add(labelAddress2);
            stackRight.Elements.Add(command);

            row.Elements.Add(stackRight);

            #endregion stackRight

            if (env.IsHtml)
            {
                stackLeft.Class  = new[] { UIClass.Tight };
                stackRight.Class = new[] { UIClass.Tight };
            }

            group.Elements.Add(row);
            group.Elements.Add(new GapElement {
                Height = "1",
                Width  = "0"
            });

            return(group);
        }
 public override void Click()
 {
     WaitForElementToBeUsable();
     LabelElement.Click();
 }
Ejemplo n.º 34
0
        private string DistroGump_GFTextLine(string gump_name, LabelElement elem)
        {
            string hue = (elem.Hue != null) ? elem.Hue.ToString() : "0";

            string text = (bGetDefaultText) ? "TextLine" : "";
            if (elem.Text != null)
                if (elem.Text != String.Empty)
                    text = elem.Text;

            return String.Format("GFTextLine({0}, {1}, {2}, {3}, \"{4}\");", gump_name, elem.X, elem.Y, hue, text);
        }