Ejemplo n.º 1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var status = new ButtonElement("Status", ViewModel.Status, UITableViewCellStyle.Value1);

            Root[0].Insert(1, UITableViewRowAnimation.None, status);

            OnActivation(d =>
            {
                this.WhenAnyValue(x => x.ViewModel.Status)
                .Subscribe(x => status.Value = x.Humanize(LetterCasing.Title))
                .AddTo(d);

                status.Clicked.Subscribe(_ =>
                {
                    var ctrl = new IssueAttributesViewController(
                        IssueAttributesViewController.Statuses, ViewModel.Status)
                    {
                        Title = "Status"
                    };
                    ctrl.SelectedObservable
                    .Do(x => ViewModel.Status = x)
                    .Subscribe(__ => NavigationController.PopToViewController(this, true));
                    NavigationController.PushViewController(ctrl, true);
                }).AddTo(d);
            });
        }
Ejemplo n.º 2
0
 // use for tests as well as locally
 public void ExtractElements(out ButtonElement displayOnlyButton, out CloseElement closeElement,
                             out EditDeleteCloseElement display, out InputElement input, out SelectElement select,
                             out SubmitAndCloseElement submit, out TextAreaElement textArea,
                             out TitleElement title, out BlockTimeElement start, out BlockTimeElement duration,
                             List <IFormElement> elements)
 {
     // N.B. Use name of elements rather than inputType, even if only one example of each
     displayOnlyButton = (ButtonElement)elements
                         .FirstOrDefault(fe => fe.Name == "DisplayOnlyButton");
     closeElement = (CloseElement)elements
                    .FirstOrDefault(fe => fe.Name == "Close");
     input = (InputElement)elements
             .FirstOrDefault(fe => fe.Name == "TextInput");
     select = (SelectElement)elements
              .FirstOrDefault(fe => fe.Name == "Select");
     display = (EditDeleteCloseElement)elements
               .FirstOrDefault(fe => fe.Name == "DisplayHeader");
     submit = (SubmitAndCloseElement)elements
              .FirstOrDefault(fe => fe.Name == "SubmitHeader");
     textArea = (TextAreaElement)elements
                .FirstOrDefault(fe => fe.Name == "TextArea");
     title = (TitleElement)elements
             .FirstOrDefault(fe => fe.Name == "Title");
     start = (BlockTimeElement)elements
             .FirstOrDefault(fe => fe.Name == "StartTime");
     duration = (BlockTimeElement)elements
                .FirstOrDefault(fe => fe.Name == "Duration");
 }
Ejemplo n.º 3
0
        private void CreateTable()
        {
            var application    = Mvx.Resolve <IApplicationService>();
            var vm             = (SettingsViewModel)ViewModel;
            var currentAccount = application.Account;

            var showOrganizationsInEvents = new BooleanElement("Show Teams under Events", currentAccount.ShowTeamEvents);

            showOrganizationsInEvents.Changed.Subscribe(e =>
            {
                currentAccount.ShowTeamEvents = e;
                application.Accounts.Update(currentAccount);
            });

            var showOrganizations = new BooleanElement("List Teams & Groups in Menu", currentAccount.ExpandTeamsAndGroups);

            showOrganizations.Changed.Subscribe(x =>
            {
                currentAccount.ExpandTeamsAndGroups = x;
                application.Accounts.Update(currentAccount);
            });

            var repoDescriptions = new BooleanElement("Show Repo Descriptions", currentAccount.RepositoryDescriptionInList);

            repoDescriptions.Changed.Subscribe(e =>
            {
                currentAccount.RepositoryDescriptionInList = e;
                application.Accounts.Update(currentAccount);
            });

            var startupView = new ButtonElement("Startup View", vm.DefaultStartupViewName);

            startupView.Clicked.BindCommand(vm.GoToDefaultStartupViewCommand);

            var sourceCommand = new ButtonElement("Source Code");

            sourceCommand.Clicked.Subscribe(_ => UIApplication.SharedApplication.OpenUrl(new NSUrl("https://github.com/thedillonb/CodeBucket")));

            var twitter = new StringElement("Follow On Twitter");

            twitter.Clicked.Subscribe(_ => UIApplication.SharedApplication.OpenUrl(new NSUrl("https://twitter.com/Codebucketapp")));

            var rate = new StringElement("Rate This App");

            rate.Clicked.Subscribe(_ => UIApplication.SharedApplication.OpenUrl(new NSUrl("https://itunes.apple.com/us/app/codebucket/id551531422?mt=8")));

            //Assign the root
            ICollection <Section> root = new LinkedList <Section>();

            root.Add(new Section());
            root.Add(new Section {
                showOrganizationsInEvents, showOrganizations, repoDescriptions, startupView
            });
            root.Add(new Section(String.Empty, "Thank you for downloading. Enjoy!")
            {
                sourceCommand, twitter, rate,
                new StringElement("App Version", NSBundle.MainBundle.InfoDictionary.ValueForKey(new NSString("CFBundleVersion")).ToString())
            });
            Root.Reset(root);
        }
Ejemplo n.º 4
0
        public TestHeaderView()
        {
            InitializeComponent();

            _binder.Bind(x => x.Path).To(path);
            _binder.Bind(x => x.Status).To(status);
            _binder.Bind(x => x.AutoRun).To(autoRun);
            _binder.Bind(x => x.NumberOfRetries).To(numberOfRetries);
            _binder.Bind(x => x.Name).To(testName).OnChange(() =>
            {
                hideTestName();
            }).RebindOnChange();

            var element = new ButtonElement(lifecycle);
            element.OnClick(() => _model.ToggleLifecycle());
            _binder.AddElement(element);

            path.MouseDown += new System.Windows.Input.MouseButtonEventHandler(path_MouseDown);
            testName.LostFocus += (x, y) =>
            {
                hideTestName();
            };

            //testName.LostMouseCapture += (x, y) => hideTestName();
            testName.LostKeyboardFocus += (x, y) => hideTestName();
        }
Ejemplo n.º 5
0
        private void InitializeViewElements()
        {
            DialogManager  = new DialogManager("NUnit Project Editor");
            MessageDisplay = new MessageDisplay("NUnit Project Editor");

            BrowseProjectBaseCommand  = new ButtonElement(projectBaseBrowseButton);
            EditConfigsCommand        = new ButtonElement(editConfigsButton);
            BrowseConfigBaseCommand   = new ButtonElement(configBaseBrowseButton);
            AddAssemblyCommand        = new ButtonElement(addAssemblyButton);
            RemoveAssemblyCommand     = new ButtonElement(removeAssemblyButton);
            MoveUpAssemblyCommand     = new ButtonElement(upAssemblyButton);
            MoveDownAssemblyCommand   = new ButtonElement(downAssemblyButton);
            BrowseAssemblyPathCommand = new ButtonElement(assemblyPathBrowseButton);

            ProjectPath      = new TextElement(projectPathLabel);
            ProjectBase      = new TextElement(projectBaseTextBox);
            ProcessModel     = new ComboBoxElement(processModelComboBox);
            DomainUsage      = new ComboBoxElement(domainUsageComboBox);
            Runtime          = new ComboBoxElement(runtimeComboBox);
            RuntimeVersion   = new ComboBoxElement(runtimeVersionComboBox);
            ActiveConfigName = new TextElement(activeConfigLabel);

            ConfigList = new ComboBoxElement(configComboBox);

            ApplicationBase   = new TextElement(applicationBaseTextBox);
            ConfigurationFile = new TextElement(configFileTextBox);
            BinPathType       = new RadioButtonGroup("BinPathType", autoBinPathRadioButton, manualBinPathRadioButton, noBinPathRadioButton);
            PrivateBinPath    = new TextElement(privateBinPathTextBox);
            AssemblyPath      = new TextElement(assemblyPathTextBox);
            AssemblyList      = new ListBoxElement(assemblyListBox);
        }
Ejemplo n.º 6
0
        public TestHeaderView()
        {
            InitializeComponent();

            _binder.Bind(x => x.Path).To(path);
            _binder.Bind(x => x.Status).To(status);
            _binder.Bind(x => x.AutoRun).To(autoRun);
            _binder.Bind(x => x.NumberOfRetries).To(numberOfRetries);
            _binder.Bind(x => x.Name).To(testName).OnChange(() =>
            {
                hideTestName();
            }).RebindOnChange();

            var element = new ButtonElement(lifecycle);

            element.OnClick(() => _model.ToggleLifecycle());
            _binder.AddElement(element);

            path.MouseDown     += new System.Windows.Input.MouseButtonEventHandler(path_MouseDown);
            testName.LostFocus += (x, y) =>
            {
                hideTestName();
            };

            //testName.LostMouseCapture += (x, y) => hideTestName();
            testName.LostKeyboardFocus += (x, y) => hideTestName();
        }
Ejemplo n.º 7
0
 //true: btnManager save the activate state of the button
 //false: btnManager doesn't save the activate state of the button
 public void OnButtonClick(ButtonElement btn, bool saveState)
 {
     //if there are no current activated button -> activate the given button and save it
     if (currentBtn == null)
     {
         btn.Activate();
         if (saveState)
         {
             currentBtn = btn;
         }
     }
     //if the current activate btn is the same as the given one
     //-> deactivate it and remove the saved btn
     else if (currentBtn == btn)
     {
         currentBtn.Deactivate();
         currentBtn = null;
     }
     //if the current activate btn is not the same
     //-> deactivate the current, save the given and activate it
     else
     {
         currentBtn.Deactivate();
         btn.Activate();
         if (saveState)
         {
             currentBtn = btn;
         }
     }
 }
Ejemplo n.º 8
0
        public EnumChoiceElement <T> CreateEnumElement <T>(string title, T value) where T : struct, IConvertible
        {
            var element = new EnumChoiceElement <T>(title, value);

            element.Clicked.Subscribe(_ =>
            {
                var ctrl   = new DialogViewController(UITableViewStyle.Grouped);
                ctrl.Title = title;

                var sec = new Section();
                foreach (var x in Enum.GetValues(typeof(T)).Cast <Enum>())
                {
                    var e = new ButtonElement(x.Humanize())
                    {
                        Accessory = object.Equals(x, element.Value) ?
                                    UITableViewCellAccessory.Checkmark : UITableViewCellAccessory.None
                    };
                    e.Clicked.Subscribe(__ =>
                    {
                        element.Value = (T)Enum.ToObject(typeof(T), x);
                        NavigationController.PopViewController(true);
                    });

                    sec.Add(e);
                }
                ctrl.Root.Reset(sec);
                NavigationController.PushViewController(ctrl, true);
            });

            return(element);
        }
Ejemplo n.º 9
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var split        = new SplitButtonElement();
            var contributors = split.AddButton("Contributors", "-");
            var lastCommit   = split.AddButton("Last Commit", "-");

            var addFeatureButton = new ButtonElement("Suggest a feature", () => ViewModel.GoToSuggestFeatureCommand.ExecuteIfCan(), Octicon.LightBulb.ToImage());
            var addBugButton     = new ButtonElement("Report a bug", () => ViewModel.GoToReportBugCommand.ExecuteIfCan(), Octicon.Bug.ToImage());
            var featuresButton   = new ButtonElement("Submitted Work Items", () => ViewModel.GoToFeedbackCommand.ExecuteIfCan(), Octicon.Clippy.ToImage());

            this.WhenAnyValue(x => x.ViewModel.Contributors).Where(x => x.HasValue).SubscribeSafe(x =>
                                                                                                  contributors.Text = (x.Value >= 100 ? "100+" : x.Value.ToString()));

            this.WhenAnyValue(x => x.ViewModel.LastCommit).Where(x => x.HasValue).SubscribeSafe(x =>
                                                                                                lastCommit.Text = x.Value.UtcDateTime.Humanize());

            this.WhenAnyValue(x => x.ViewModel).Subscribe(x =>
                                                          HeaderView.ImageButtonAction = x != null ? new Action(x.GoToRepositoryCommand.ExecuteIfCan) : null);

            HeaderView.SubText = "This app is the product of hard work and great suggestions! Thank you to all whom provide feedback!";
            HeaderView.Image   = UIImage.FromFile("*****@*****.**");

            Root.Reset(new Section {
                split
            }, new Section {
                addFeatureButton, addBugButton
            }, new Section {
                featuresButton
            });
        }
Ejemplo n.º 10
0
        public void AddLayer(int layer)
        {
            PlatformerEditor actualGame = (PlatformerEditor)UIManager.Game;

            if (actualGame.GetWorldLayer(layer) != null)
            {
                return;
            }
            GroupElement  group       = new GroupElement(UIManager, new Vector2(0, 0), new Vector2(128, 32), Layer + 0.01f, Name + "_" + layer.ToString());
            ButtonElement layerButton = new ButtonElement(UIManager, new Vector2(0, 0), new Vector2(96, 32), group.Layer + 0.01f, group.Name + "_button", "layer " + layer.ToString());

            layerButton.Click = () =>
            {
                WorldLayer worldLayer = actualGame.GetWorldLayer(layer);
                actualGame.CurrentWorldLayer = worldLayer;
            };
            CheckboxElement layerDisplayCheckbox = new CheckboxElement(UIManager, new Vector2(layerButton.Size.X, 0), new Vector2(32, 32), group.Layer + 0.01f, group.Name + "_checkbox", true);

            layerDisplayCheckbox.Tick = (ticked) =>
            {
                WorldLayer worldLayer = actualGame.GetWorldLayer(layer);
                if (worldLayer != null)
                {
                    worldLayer.IsVisible = ticked;
                }
            };
            group.Elements.Add(layerButton);
            group.Elements.Add(layerDisplayCheckbox);
            AddItem(group);
            layerButtonGroups.Add(group);
        }
Ejemplo n.º 11
0
        private void AddElements(List <ButtonElement> list, IEnumerable <ProcessListResponseItem> filtered)
        {
            var index = 0;

            foreach (var item in filtered.Where(d => d.ProcessName.Contains(_itemProcessName)).OrderBy(d => d.ProcessId))
            {
                var buttonElement = new ButtonElement();
                buttonElement.Clickable  = true;
                buttonElement.ButtonText = $"Kill {item.ProcessId}";
                var scopedIndex = index;
                buttonElement.ButtonAction = async() =>
                {
                    if (await this.GetAgent().DesktopClient.KillProcessByIdAsync(TimeSpan.FromSeconds(5), item.ProcessId))
                    {
                        this.DataSource.RemoveAt(scopedIndex);
                        ToastHelper.DisplaySuccess(true, ToastLength.Short);
                    }
                    else
                    {
                        ToastHelper.DisplaySuccess(false, ToastLength.Short);
                    }
                };

                list.Add(buttonElement);

                index++;
            }
        }
Ejemplo n.º 12
0
 /// <summary>
 /// Sets an element's color on all referenced buttons.
 /// </summary>
 /// <param name="color">The color to set the button element.</param>
 /// <param name="element">The element of the buttons to modify.</param>
 /// <param name="animate">Animate the transition? Always false if in edit mode.</param>
 public void SetButtonsGraphicColors(Color color, ButtonElement element, bool animate = true)
 {
     for (int i = 0; i < m_Buttons.Length; i++)
     {
         SetButtonGraphicColor(i, color, element, animate);
     }
 }
Ejemplo n.º 13
0
		protected override void OnInitElements () {
			
			Elements.Add ("logo", new ImageElement ("logo"));
			Elements.Add ("connection_failed", new TextElement (GetText ("connection_failed")) { Active = !Connected });

			submitButton = new ButtonElement (GetButton ("submit"), () => { 
				if (Game.Manager.Name != "" && Connected)
					GotoView ("hostjoin");
			}) {
				#if !SINGLE_SCREEN
				Interactable = false 
				#endif
			};

			Elements.Add ("submit", submitButton);

			Elements.Add ("input", new InputElement (Game.Manager.Name, "your name", (string name) => {
				#if !SINGLE_SCREEN
				submitButton.Interactable = name != "" && Connected;
				#endif
			}, (string name) => {
				Game.Manager.Name = name;

				// This allows the name to be submitted by pressing "done" on the ios/android keyboard
				if (name != "" && Connected)
					GotoView ("hostjoin");
			}));
		}
    public override void OnInspectorGUI()
    {
        //base.OnInspectorGUI();

        ButtonElement element = (ButtonElement)target;

        var prev  = element.buttonName;
        var prev2 = element.buttonColor;

        element.buttonName = EditorGUILayout.TextField("ButtonName", element.buttonName);

        element.buttonColor = EditorGUILayout.ColorField("Color", element.buttonColor);

        if (m_OnClick != null)
        {
            EditorGUILayout.PropertyField(m_OnClick);

            serializedObject.ApplyModifiedProperties();
        }

        if (prev != element.buttonName || prev2 != element.buttonColor)
        {
            EditorUtility.SetDirty(target);
        }
    }
Ejemplo n.º 15
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var root = _rootElement.Value;

            TableView.Source = new DialogTableViewSource(root);

            var sections = _files.GroupBy(x => x.Parent).Select(x =>
            {
                var elements = x.Select(y =>
                {
                    var element   = new ButtonElement(y.Name, y.Type.ToString(), UITableViewCellStyle.Subtitle);
                    element.Image = AtlassianIcon.PageDefault.ToImage();
                    element.Clicked.Subscribe(_ =>
                    {
                        var viewCtrl = new ChangesetDiffViewController(y.Username, y.Repository, y.Node, y.ChangesetFile);
                        NavigationController.PushViewController(viewCtrl, true);
                    });
                    return(element);
                });

                return(new Section(x.Key)
                {
                    elements
                });
            });

            root.Reset(sections);
        }
Ejemplo n.º 16
0
        public void RootTouchbarToXmlAsStringNotNull()
        {
            //Arrange
            var space   = new SpecialElement(SpecialElement.Space.Small);
            var segRoot = new SegmentedControl("4")
            {
                Seperated = true
            };
            var seg1 = new SegmentElement("seg1", "a,b,c", "Segment BT 1");

            segRoot.ChildElements.Add(seg1);

            var scroll = new ScrollViewControl("X");

            scroll.ChildElements.Add(new ButtonElement("s1", "1,2,3", "Scroll BT1", CustomIcons.GoToIcon));
            scroll.ChildElements.Add(new ButtonElement("s2", "ctrl+f", "Scroll BT2")
            {
                Width = 80, BackgroundColor = "ff0000"
            });
            scroll.ChildElements.Add(new ButtonElement("s3", "ctrl+f", "Scroll BT3")
            {
                Width = 120
            });
            scroll.ChildElements.Add(new ButtonElement("s4", "ctrl+f", "Scroll BT4")
            {
                Width = 80
            });

            var pop = new PopoverControl("Y", "Pop Items", CustomIcons.SurroundIcon);

            pop.ChildElements.Add(new ButtonElement("p2", "ctrl+f", "Pop BT1")
            {
                Width = 80
            });
            pop.PressAndHoldChildElements.Add(new ButtonElement("p1", "1,2,3", "PopHold BT1", CustomIcons.FormatDocIcon));
            var button3 = new ButtonElement("p3", "alt+f1", "PopHold BT2");

            pop.PressAndHoldChildElements.Add(button3);

            var root = new RootTouchbar();

            root.Elements.Add(new ButtonElement("r1", "1,2,3", "Button1", SystemStandardIcons.Play));
            root.Elements.Add(space);
            root.Elements.Add(new ButtonElement("r2", "ctrl+f", "Button2")
            {
                Width = 80
            });
            root.Elements.Add(segRoot);
            root.Elements.Add(scroll);
            root.Elements.Add(pop);

            //Act
            var doc = root.ToXmlAsString();

            //Assert
            Assert.IsNotNull(doc);

            Debug.Write(doc);
        }
Ejemplo n.º 17
0
        public ButtonElement BindButton([NotNull] Button button)
        {
            var element = new ButtonElement(button);

            AddElement(element);

            return(element);
        }
Ejemplo n.º 18
0
 public virtual void Set(ButtonElement element)
 {
     SetEnabled(true);
     Element   = element;
     text.text = Content;
     SetColor(element.Color);
     OnSet();
 }
Ejemplo n.º 19
0
        /// <summary>
        /// Adds new button element with custom color.
        /// </summary>
        /// <param name="text">The text.</param>
        /// <param name="color">The color.</param>
        /// <returns>The created element.</returns>
        public ButtonElement Button(string text, Color color)
        {
            ButtonElement element = new ButtonElement();

            element.Init(text, color);
            OnAddElement(element);
            return(element);
        }
Ejemplo n.º 20
0
                /// <inheritdoc />
                public override void Initialize(LayoutElementsContainer layout)
                {
                    base.Initialize(layout);

                    layout.Space(10);
                    _cookButton = layout.Button("Cook");
                    _cookButton.Button.Clicked += OnCookButtonClicked;
                }
Ejemplo n.º 21
0
        /// <summary>
        /// Adds new button element.
        /// </summary>
        /// <param name="text">The text.</param>
        /// <returns>The created element.</returns>
        public ButtonElement Button(string text)
        {
            var element = new ButtonElement();

            element.Init(text);
            OnAddElement(element);
            return(element);
        }
Ejemplo n.º 22
0
 /// <summary>
 /// Resizes the control.
 /// </summary>
 /// <param name="widthFactor">The relative growth of the width.</param>
 /// <param name="heightFactor">The relative growth of the height.</param>
 protected override void DoResize(double widthFactor, double heightFactor)
 {
     base.DoResize(widthFactor, heightFactor);
     if (this.buttonElement == null)
     {
         this.buttonElement.Dispose();
         this.buttonElement = null;
     }
 }
Ejemplo n.º 23
0
 public void Showon(string name)
 {
     if (!downfunction.returnactivebuton() || downfunction.CheckActiveButton(name))
     {
         this.Selected = !Selected;
         ButtonElement _but = this.GetComponent <ButtonElement>();
         downfunction.ChangeStatusButton(_but);
     }
 }
Ejemplo n.º 24
0
        /// <summary>
        /// Adds new button element.
        /// </summary>
        /// <param name="text">The text.</param>
        /// <param name="tooltip">The tooltip text.</param>
        /// <returns>The created element.</returns>
        public ButtonElement Button(string text, string tooltip = null)
        {
            var element = new ButtonElement();

            element.Button.Text        = text;
            element.Button.TooltipText = tooltip;
            OnAddElement(element);
            return(element);
        }
Ejemplo n.º 25
0
    public IEnumerator SpacesAndLayout3Relayout()
    {
        var box = BoxElement.GO(
            null,// bg画像
            () =>
        {
            Debug.Log("ルートがタップされた");
        },
            ButtonElement.GO(null, () => { }),
            TextElement.GO(
                "ここから         " + // 全角スペースが9文字あり、かなりのサイズになる。
                "・"
                )                 // 連続するスペースと文字、・の直前で改行が発生する。
            );

        // レイアウトに使うクラスを生成する
        var layouter = new BasicLayouter();

        // コンテンツのサイズをセットする
        var size = new Vector2(600, 100);

        // レイアウトを行う

        box = LayouTaro.Layout(
            canvas.transform,
            size,
            box,
            layouter
            );

        var rectTrans = box.gameObject.GetComponent <RectTransform>();

        rectTrans.anchoredPosition3D = Vector3.zero;
        rectTrans.localScale         = Vector3.one;

        box = LayouTaro.RelayoutWithUpdate(
            size,
            box,
            new Dictionary <LTElementType, object> {
            {
                LTElementType.Text, "ここから         " +   // 全角スペースが9文字あり、かなりのサイズになる。
                "・"
            }
        },
            layouter
            );

        yield return(null);

        while (false)
        {
            yield return(null);
        }

        ScreenCapture.CaptureScreenshot("./images/" + methodName);
        yield break;
    }
        public RenameConfigurationDialog()
        {
            InitializeComponent();

            ConfigurationName = new TextElement(configurationNameTextBox);
            OkButton          = new ButtonElement(okButton);

            MessageDisplay = new MessageDisplay("Rename Configuration");
        }
Ejemplo n.º 27
0
        protected override void onLoad()
        {
            var newBtn = Document.GetElementById <ButtonElement>("newBtn");

            newBtn.OnClick = (ev) =>
            {
                Navigation <New> .Go();
            };

            var dynamodb = new DynamoDB();

            var param = new ScanParams
            {
                TableName            = "stock",
                ProjectionExpression = "product, quantity"
            };

            dynamodb.scan(param, (err, data) =>
            {
                if (err != null)
                {
                    Toast.Error(err.stack.ToString()); // an error occurred
                }
                else
                {
                    foreach (var item in data.Items)
                    {
                        var row = new TableRowElement();

                        var productTD       = new TableDataCellElement();
                        productTD.InnerHTML = item.produto.S;

                        row.AppendChild(productTD);

                        var quantityTD       = new TableDataCellElement();
                        quantityTD.InnerHTML = item.quantidade.N;
                        row.AppendChild(quantityTD);

                        var editBtn       = new ButtonElement();
                        editBtn.ClassName = "btn btn-default";
                        editBtn.InnerHTML = "Edit";

                        var editTD = new TableDataCellElement();
                        editTD.AppendChild(editBtn);
                        editBtn.OnClick = (ev) =>
                        {
                            Navigation <Edit> .Go(item.produto.S, int.Parse(item.quantidade.N));
                        };

                        row.AppendChild(editTD);

                        var tbody = Document.GetElementById <TableSectionElement>("table-body");
                        tbody.AppendChild(row);
                    }
                }
            });
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Adds new button element with custom color.
        /// </summary>
        /// <param name="text">The text.</param>
        /// <param name="color">The color.</param>
        /// <param name="tooltip">The tooltip text.</param>
        /// <returns>The created element.</returns>
        public ButtonElement Button(string text, Color color, string tooltip = null)
        {
            ButtonElement element = new ButtonElement();

            element.Button.Text        = text;
            element.Button.TooltipText = tooltip;
            element.Button.SetColors(color);
            OnAddElement(element);
            return(element);
        }
Ejemplo n.º 29
0
 public EnterNameScreen(GameState state, string name = "Enter Name") : base(state, name)
 {
     enterButton = CreateButton("Enter", 2);
     ScreenElements.AddEnabled("background", new BackgroundElement("logo", Color.black));
     ScreenElements.AddEnabled("copy", new LabelElement(Copy.EnterName, 0));
     ScreenElements.AddEnabled("textfield", new TextFieldElement(1));
     ScreenElements.AddEnabled("enter", enterButton);
     ScreenElements.AddEnabled("back", CreateBottomButton("Back"));
     textField = ScreenElements.Get <TextFieldElement> ("textfield");
     textField.onUpdateContent += OnUpdateContent;
 }
        /// <summary>
        /// Configures the appearance of a <see cref="ButtonElement"/> button.
        /// </summary>
        /// <param name="button">The button to style.</param>
        /// <param name="style">The styles to apply.</param>
        protected virtual void ApplyButtonStyle(ButtonElement button, SpatialButtonFacade.ButtonStyle style)
        {
            if (!style.IsApplied)
            {
                return;
            }

            ApplyMeshStyle(button.ButtonMeshFilter, style);
            ApplyTextStyle(button.Text, style);
            RescaleButton(button.TextRect);
        }
Ejemplo n.º 31
0
    public void Activate()
    {
        int           x       = charMatrixPositionX;
        int           z       = charMatrixPositionZ;
        ButtonElement sbutton = objectMap[z, x].GetComponent <ButtonElement>();

        if (sbutton != null)
        {
            sbutton.ActivateButton();
        }
    }
Ejemplo n.º 32
0
    public IEnumerator WithEmojiComplex()
    {
        // 最後のgooooo..dが分離されて浮くように。
        var box = BoxElement.GO(
            null,// bg画像
            () =>
        {
            Debug.Log("ルートがタップされた");
        },
            TextElement.GO("hannidjkfajfaoooood"),                                                         // テキスト
            ImageElement.GO(null),                                                                         // 画像
            ButtonElement.GO(null, () => { Debug.Log("ボタンがタップされた"); }),
            TextElement.GO("hannin is yasu!\U0001F60A\U0001F60B this is public problem! goooooooooooooad") // 59から絵文字を1文字削ると?2文字減る。文字数カウント的にはUTF8と同じ扱いなのか。うーん

            // 事前にサイズを取得、インデックスポイントを送り込んで、取り除いて、という形にするか。
            // どうすればできる?載せ替える四角を成立させればいいか。単純に文字列コンテンツを絵文字でぶった切るか!!これは手な気がする。
            // 他になんかないかな。いけるな、
            // 文字列を最初に渡すときに、N個の絵文字が出た場合、\Uで検索して文字を取り出す。そんで、その文字がどんな画像になるか、っていうのを別途やる。そんで、
            // それぞれの文字を出力して、サイズを割り出し、文字列を再構成する。
            // 再構成した上でレイアウトすればいい。で、それぞれのレイアウト終了時に絵文字の画像を割り当てるか。
            // この方法であれば、まあ、そもそも画像を割り当てるような置換ができれば優勝できるな。

            // 割り出し方に問題が出るかな、例があると嬉しいな。ない。今はない。
            );

        // レイアウトに使うクラスを生成する
        var layouter = new BasicLayouter();

        // コンテンツのサイズをセットする
        var size = new Vector2(600, 100);

        // レイアウトを行う

        box = LayouTaro.Layout(
            canvas.transform,
            size,
            box,
            layouter
            );

        var rectTrans = box.gameObject.GetComponent <RectTransform>();

        rectTrans.anchoredPosition3D = Vector3.zero;
        rectTrans.localScale         = Vector3.one;

        ScreenCapture.CaptureScreenshot("./images/" + methodName);

        while (false)
        {
            yield return(null);
        }

        yield break;
    }
Ejemplo n.º 33
0
        public TestHeaderView()
        {
            InitializeComponent();

            _binder.Bind(x => x.Name).To(name);
            _binder.Bind(x => x.Path).To(path);
            _binder.Bind(x => x.Status).To(status);

            var element = new ButtonElement(lifecycle);
            element.OnClick(() => _model.ToggleLifecycle());
            _binder.AddElement(element);
        }
Ejemplo n.º 34
0
 public ButtonCellView(ButtonElement element)
     : base(UITableViewCellStyle.Value1, skey)
 {
     parent = element;
     this.BackgroundColor = UIColor.Clear;
     btn = new UIGlassyButton(RectangleF.Empty);
     btn.Color = parent.Color;
     btn.TitleColor = parent.TitleColor;
     btn.Title = element.Caption;
     btn.TouchUpInside += delegate{
         if(parent.Tapped != null)
             parent.Tapped();
     };
     ContentView.Add (btn);
 }
 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.º 36
0
 public void UpdateFrom(ButtonElement element)
 {
     btn.Title = element.Caption;
     parent = element;
 }
Ejemplo n.º 37
0
        private string Gump_WriteButton(ButtonElement elem)
        {
            bool quit = true;
            string page_id = "0";
            string ret_value = elem.Param.ToString();

            if (elem.ButtonType == ButtonTypeEnum.Page)
            {
                quit = false;
                page_id = elem.Param.ToString();
                ret_value = "0";
            }
            
            return string.Format("button {0} {1} {2} {3} {4} {5} {6}", elem.X, elem.Y, elem.NormalID, elem.PressedID, BoolToString(quit), page_id, ret_value);
        }
 public ButtonElement Button()
 {
     return _button ?? (_button = new ButtonElement(_container));
 }
Ejemplo n.º 39
0
        private string DistroGump_GFAddButton(string gump_name, ButtonElement elem)
        {
            string btn_type = "";
            if (elem.ButtonType == ButtonTypeEnum.Page)
                btn_type = "GF_PAGE_BTN";
            else
                btn_type = "GF_CLOSE_BTN";

            return String.Format("GFAddButton({0}, {1}, {2}, {3}, {4}, {5}, {6});", gump_name, elem.X, elem.Y, elem.NormalID, elem.PressedID, btn_type, elem.Param);
        }
Ejemplo n.º 40
0
		private static Dictionary<string, Func<JsonObject, FormDialogViewController, JsonValue, Element>> CreateDefaultParsers()
		{
			var result = new Dictionary<string, Func<JsonObject, FormDialogViewController, JsonValue, Element>>();
			
			result.Add("StringElement", (json, dvc, data)=>{
					string v = "";
					if (data==null)
						v = json.asString(Constants.Value);
					else if (string.IsNullOrEmpty(json.asString(Constants.Bind)))
						v = "";
					else if (data.GetType()==typeof(JsonPrimitive))
						v = data.CleanString();
					else if (data.GetType()==typeof(JsonObject))
						v = ((JsonObject)data).asString(json.asString(Constants.Bind));
					
					return new StringElement(json.asString(Constants.Caption), v, json.asAction(dvc));
				}
			);
			
			result.Add("MultilineElement", (json, dvc, data)=>{
					string caption = "";
					if (data==null)
						caption = json.asString(Constants.Caption);
					else if (string.IsNullOrEmpty(json.asString(Constants.Bind)))
						caption = "";
					else if (data.GetType()==typeof(JsonPrimitive))
						caption = data.CleanString();
					else if (data.GetType()==typeof(JsonObject))
						caption = ((JsonObject)data).asString(json.asString(Constants.Bind));
					
					return new MultilineElement(caption, json.asString(Constants.Value), json.asAction(dvc));
				}
			);
			
			
			result.Add("MultilineEntryElement", (json, dvc, data)=>{
					return new MultilineEntryElement(json.asString("caption"), json.asString("placeholder"), 
				            data==null? json.asString(Constants.Value) : data.CleanString()){
							KeyboardType = (UIKeyboardType)Enum.Parse(typeof(UIKeyboardType), json.asString("keyboard") ?? "Default"),
						}; 
				}
			);
			
			result.Add("EntryElement", (json, dvc, data)=>{
					return new EntryElement(json.asString(Constants.Caption), json.asString("placeholder"), 
				            data==null? json.asString(Constants.Value) : data.CleanString(), json.asBoolean("ispassword")){
							KeyboardType = (UIKeyboardType)Enum.Parse(typeof(UIKeyboardType), json.asString("keyboard") ?? "Default"),
						}; 
				}
			);
			
			result.Add("ButtonElement", (json, dvc, data)=>{ 
					ButtonElement el = null;
					el = new ButtonElement(json.asString(Constants.Caption), new ControllerAction(json.asString(Constants.Action)));
					return el;
				}
			);
			
			
			result.Add("ActivityElement", (json, dvc, data)=>{ 
					return new ActivityElement(json.asString(Constants.Caption), json.asString(Constants.Activity), json.asString(Constants.Value));
				}
			);
			
			result.Add("BooleanElement", (json, dvc, data)=>{
					return new iPhoneBooleanElement(json.asString(Constants.Caption), 
				                          string.IsNullOrEmpty(data)? json.asBoolean(Constants.Value) : bool.Parse(data.CleanString())) ;
				}
			);
			
			result.Add("FloatElement", (json, dvc, data)=>{
					var minValue = json.asDouble("minvalue");
					var maxValue = json.asDouble("maxvalue");
					return new FloatElement(json.asString(Constants.Caption), (float)json.asDouble(Constants.Value)) 
						{ MinValue = minValue.HasValue? (float)minValue.Value : 0f, 
						  MaxValue = maxValue.HasValue? (float)maxValue.Value : 1f
					    };
				}
			);
				
			result.Add("CheckboxElement", (json, dvc, data)=>{
					return new CheckboxElement(json.asString(Constants.Caption), json.asBoolean(Constants.Value));
				}
			);
			
			result.Add("SimpleImageElement", (json, dvc, data)=>{
					return new SimpleImageElement(json.asUIImage("url"));
				}
			);
			
			result.Add("MapElement", (json, dvc, data)=>{
					JsonArray position = data==null? null : (JsonArray)data;
					double lat = position==null? json.asDouble("lat").Value : (double)position[0];
					double lng = position==null? json.asDouble("lng").Value : (double)position[1];
					string value = position==null? json.asString(Constants.Value) : position.Count > 2 ? (string)position[2] : "";
					return new MapElement(json.asString(Constants.Caption), value, 
				                      new CLLocationCoordinate2D(lat, lng));
				}
			);

			result.Add("RadioElement", (json, dvc, data)=>{
					var radios = new List<RadioElement>();
					var popAutomatically = json.asBoolean("pop");
					foreach (string item in json.asStringList("items")){
						radios.Add(new RadioElement(item, popAutomatically));
					}
					int selected = 0;
					if (json.ContainsKey("selected")) {
						selected = (int)json.asDouble("selected");
					} else if (!string.IsNullOrEmpty(data)) {
						selected = int.Parse(data);
					}
					return new RootElement(json.asString(Constants.Caption), new RadioGroup(null, selected)) {
						new Section(){
							radios.ToArray()		
						}
					};
				}
			);
			
			result.Add("ImagePickerElement", (json, dvc, data)=>{
				return new ImagePickerElement(null);
			});
			
			result.Add("DateElement", (json, dvc, data)=>{
				return new DateElement(json.asString(Constants.Caption), json.asDateTime(Constants.Value));
			});
			
			result.Add("TimeElement", (json, dvc, data)=>{
				return new TimeElement(json.asString(Constants.Caption), json.asDateTime(Constants.Value));
			});
			
			result.Add("DateTimeElement", (json, dvc, data)=>{
				return new DateTimeElement(json.asString(Constants.Caption), json.asDateTime(Constants.Value));
			});
				
			result.Add("ImageStringElement", (json, dvc, data)=>{
				return  new ImageStringElement(json.asString(Constants.Caption), json.asString(Constants.Value), 
				        json.asAction(dvc), json.asUIImage(Constants.Image), json.asString("imageurl"));
			});
			
			result.Add("WebElement", (json, dvc, data)=>{ 
					var url= data==null ? json.asString("url") : data.CleanString();
					if (string.IsNullOrEmpty(url) || (data!=null && data.GetType()!=typeof(JsonPrimitive)))
					    return null;
					return new WebElement(json.asString(Constants.Caption), url);
			});
			
			return result;
		}