Beispiel #1
0
        public LoginView()
        {
            var usernameLine = new HorizontalLayout().AddTo(this);

            new LabelView("username:"******"").AddTo(usernameLine);

            var passwordLine = new HorizontalLayout().AddTo(this);

            new LabelView("password:"******"").PasswordMode().AddTo(passwordLine);

            var loginBtn    = new ButtonView("登录").AddTo(this);
            var registerBtn = new ButtonView("注册").AddTo(this);

            loginBtn.OnClick.AddListener(() =>
            {
                PackageKitLoginApp.Send(new LoginCommand(username.Content.Value, password.Content.Value));
            });

            registerBtn.OnClick.AddListener(() =>
            {
                PackageKitLoginApp.Send <OpenRegisterWebsiteCommand>();
            });
        }
Beispiel #2
0
        public DropdownList(string[] options, int selectedIndex, float width = 100) : base(width)
        {
            _options = options;

            var grid  = new HorizontalGrid();
            var left  = new HorizontalLayout();
            var right = new HorizontalLayout(true);

            _activeLabel = new Label(options[selectedIndex]);
            left.Attach(_activeLabel);
            float height = Utils.CalcSize("Adsd", Style).y;

            _triangle = new TriangleComponent(height, height, Col.white);
            right.Attach(_triangle);
            grid.Attach(left, right);
            AddChild(grid);

            _opened = new VerticalLayout(InnerWidth);
            foreach (var option in options)
            {
                _opened.Attach(new ClickableLable(option, x =>
                {
                    _activeLabel.Title = x;
                    Toggle();
                }));
            }
        }
        public ControlsPanel(Dictionary <string, Sprite> sprites)
        {
            SetAnchor(AnchorX.Right, AnchorY.Top);
            getStandardSprite = true;
            SetFixedWidth(200);
            SetLayoutSize(LayoutSize.FixedSize, LayoutSize.WrapContent);
            Padding = new Point(6, 6);
            Margin  = 6;
            string[] text   = { "explMouseLeft", "explMouseRight", "explMouseMiddle", "explWASD", "explTab", "explEnter" };
            string[] sprite = { "mouseLeft", "mouseRight", "mouseMiddle", "WASD", "tab", "enter" };

            for (int i = 0; i < text.Length; i++)
            {
                HorizontalLayout l = new HorizontalLayout();
                l.layoutFill = LayoutFill.StretchMargin;
                Image im = new Image(sprites[sprite[i]]);
                im.SetFixedSize(32, 32);

                Text te = new Text(text[i]);
                te.SetFontSize(FontSize.Small);

                l.AddChild(im);
                l.AddChild(te);

                AddChild(l);
            }
        }
Beispiel #4
0
        public override void OnLoading()
        {
            base.OnLoading();
            _topInfoComponent = new TopInfoComponent(this)
            {
                Header            = Translator.Translate("task"),
                LeftButtonControl = new Image {
                    Source = ResourceManager.GetImage("topheading_back")
                },
                ArrowVisible = false
            };

            _taskCommentTextView = (TextView)GetControl("TaskCommentTextView", true);
            _wrapUnwrapImage     = (Image)GetControl("WrapUnwrapImage", true);

            _taskFinishedButton         = (HorizontalLayout)GetControl("TaskFinishedButton", true);
            _taskRefuseButton           = (HorizontalLayout)GetControl("TaskRefuseButton", true);
            _taskFinishedButtonTextView = (TextView)GetControl("TaskFinishedButtonTextView", true);
            _taskRefuseButtonTextView   = (TextView)GetControl("TaskRefuseButtonTextView", true);
            _taskFinishedButtonImage    = (Image)GetControl("TaskFinishedButtonImage", true);
            _taskRefuseButtonImage      = (Image)GetControl("TaskRefuseButtonImage", true);

            _taskCommentEditText = (MemoEdit)GetControl("TaskCommentEditText", true);
            _rootLayout          = (DockLayout)GetControl(0);
            _topInfoComponent.ActivateBackButton();

            _isReadOnly   = (bool)Variables[Parameters.IdIsReadonly];
            _currentEvent = DBHelper.GetEventByID($"{Variables[Parameters.IdCurrentEventId]}");
            _userId       = (DbRef)DBHelper.GetUserInfoByUserName(Settings.User)["Id"];
        }
        private void ReBuildToDoItems()
        {
            verticalLayout.Clear();

            var data = ToDoDataManager.Data;

            foreach (var item in data.categoryList)
            {
                var layout = new HorizontalLayout("box").AddTo(verticalLayout);

                //new BoxView(item.name).BackgroundColor(item.color.ToColor()).AddTo(layout);

                new CategoryComponent(item).AddTo(layout);


                new FlexibleSpaceView().AddTo(layout);

                new ImageButtonView(ImageButtonIcon.editorIcon, () => OpenSubWindow(item))
                .Width(25).Height(25).BackgroundColor(Color.black).AddTo(layout);

                new ImageButtonView(ImageButtonIcon.deleteIcon, () =>
                {
                    ToDoDataManager.RemoveToDoCategory(item);
                    UpdateToDoItems();
                })
                .Width(25).Height(25).BackgroundColor(Color.red).AddTo(layout);
            }
        }
        internal void AddButton_OnPressUp(object sender, EventArgs eventArgs)
        {
            HorizontalLayout button = (HorizontalLayout)sender;

            button.CssClass = "AddButton";
            button.Refresh();
        }
Beispiel #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MessageBox"/> class.
        /// </summary>
        /// <param name="parent">Parent control.</param>
        /// <param name="text">Message to display.</param>
        /// <param name="caption">Window caption.</param>
        /// <param name="buttons">Message box buttons.</param>
        public MessageBox(ControlBase parent, string text, string caption = "", MessageBoxButtons buttons = MessageBoxButtons.OK)
            : base(parent)
        {
            HorizontalAlignment = HorizontalAlignment.Left;
            VerticalAlignment   = VerticalAlignment.Top;

            Canvas canvas = GetCanvas();

            MaximumSize = new Size((int)(canvas.ActualWidth * 0.8f), canvas.ActualHeight);

            StartPosition = StartPosition.CenterParent;
            Title         = caption;
            DeleteOnClose = true;

            DockLayout layout = new Control.Layout.DockLayout(this);

            m_Text          = new RichLabel(layout);
            m_Text.Dock     = Dock.Fill;
            m_Text.Margin   = Margin.Ten;
            m_Text.Document = new Document(text);

            HorizontalLayout buttonsLayout = new HorizontalLayout(layout);

            buttonsLayout.Dock = Dock.Bottom;
            buttonsLayout.HorizontalAlignment = HorizontalAlignment.Center;

            switch (buttons)
            {
            case MessageBoxButtons.AbortRetryIgnore:
                CreateButton(buttonsLayout, "Abort", MessageBoxResult.Abort);
                CreateButton(buttonsLayout, "Retry", MessageBoxResult.Retry);
                CreateButton(buttonsLayout, "Ignore", MessageBoxResult.Ignore);
                break;

            case MessageBoxButtons.OK:
                CreateButton(buttonsLayout, "Ok", MessageBoxResult.Ok);
                break;

            case MessageBoxButtons.OKCancel:
                CreateButton(buttonsLayout, "Ok", MessageBoxResult.Ok);
                CreateButton(buttonsLayout, "Cancel", MessageBoxResult.Cancel);
                break;

            case MessageBoxButtons.RetryCancel:
                CreateButton(buttonsLayout, "Retry", MessageBoxResult.Retry);
                CreateButton(buttonsLayout, "Cancel", MessageBoxResult.Cancel);
                break;

            case MessageBoxButtons.YesNo:
                CreateButton(buttonsLayout, "Yes", MessageBoxResult.Yes);
                CreateButton(buttonsLayout, "No", MessageBoxResult.No);
                break;

            case MessageBoxButtons.YesNoCancel:
                CreateButton(buttonsLayout, "Yes", MessageBoxResult.Yes);
                CreateButton(buttonsLayout, "No", MessageBoxResult.No);
                CreateButton(buttonsLayout, "Cancel", MessageBoxResult.Cancel);
                break;
            }
        }
Beispiel #8
0
        private HorizontalLayout CreateGroundFloor(float width)
        {
            var doorStartWidth = width / 2 - 2;
            var numberOfThings = (int)(doorStartWidth / (GroundFloorThingWidth + 1.5));    //thing, .75+.75mes sides
            var separatorWidth = (doorStartWidth - numberOfThings * GroundFloorThingWidth) / (numberOfThings + 1);
            var horizontal     = new HorizontalLayout();

            if (width < 4f)
            {
                horizontal.Add(Construct(this.constructors[PanelType.Wall], width, floorHeight));
                return(horizontal);
            }

            horizontal.Add(Construct(this.constructors[PanelType.Wall], doorStartWidth, floorHeight));
            horizontal.Add(Construct(constructors[PanelType.Entrance], 4, floorHeight));    //Door - doorwidth = 2 -> 4 space with door separators
            horizontal.Add(Construct(this.constructors[PanelType.Wall], doorStartWidth, floorHeight));

            // for (int i = 0; i < numberOfThings; i++)    //Before door
            // {
            //     horizontal.Add(Construct(this.constructors[PanelType.Wall], separatorWidth + GroundFloorThingWidth, floorHeight));    //Separator
            // }
            // horizontal.Add(Construct(this.constructors[PanelType.Wall], separatorWidth, floorHeight));  //Last Separator
            //
            // horizontal.Add(Construct(constructors[PanelType.Entrance], 4, floorHeight));    //Door - doorwidth = 2 -> 4 space with door separators
            //
            // horizontal.Add(Construct(this.constructors[PanelType.Wall], (numberOfThings + 1) * separatorWidth, floorHeight));    //Separator
            // for (int i = 0; i < numberOfThings; i++)    //After door
            // {
            //
            // }
            // horizontal.Add(Construct(this.constructors[PanelType.Wall], separatorWidth, floorHeight));  //Last Separator
            return(horizontal);
        }
Beispiel #9
0
        public LoginView()
        {
            AccountModel.Subject
            .StartWith(AccountModel.State)
            .Subscribe(state =>
            {
                this.Clear();

                var usernameLine = new HorizontalLayout().AddTo(this);
                new LabelView("username:"******"password:"******"").PasswordMode().AddTo(passwordLine)
                .Content.Bind(password => Password = password);

                new ButtonView("登录", () =>
                {
                    AccountModel.Effects.Login(Username, Password);
                }).AddTo(this);

                new ButtonView("注册", () =>
                {
                    Application.OpenURL("http://master.liangxiegame.com/user/register");
//                            AccountModel.Dispatch("setInLoginView", false);
                })
                .AddTo(this);
            });
        }
        private LayoutBase GetLayout(bool isVertical)
        {
            if (isVertical)
            {
                if (null == _vertCached) // create once
                {
                    _vertCached = new VerticalLayout
                    {
                        HorizontalAlign = HorizontalAlign.Center,
                        VerticalAlign   = VerticalAlign.Middle
                    };
                }
                _vertCached.Gap           = (int)GetStyle("gap"); /*Gap = (IconDisplay.Visible && null != LabelDisplay && !string.IsNullOrEmpty(LabelDisplay.Text)) ?  (int)GetStyle("gap") : 0*/
                _vertCached.PaddingLeft   = (int)GetStyle("paddingLeft");
                _vertCached.PaddingRight  = (int)GetStyle("paddingRight");
                _vertCached.PaddingTop    = (int)GetStyle("paddingTop");
                _vertCached.PaddingBottom = (int)GetStyle("paddingBottom");
                return(_vertCached);
            }

            if (null == _horizCached) // create once
            {
                _horizCached = new HorizontalLayout
                {
                    HorizontalAlign = HorizontalAlign.Center,
                    VerticalAlign   = VerticalAlign.Middle
                };
            }
            _horizCached.Gap           = (int)GetStyle("gap");
            _horizCached.PaddingLeft   = (int)GetStyle("paddingLeft");
            _horizCached.PaddingRight  = (int)GetStyle("paddingRight");
            _horizCached.PaddingTop    = (int)GetStyle("paddingTop");
            _horizCached.PaddingBottom = (int)GetStyle("paddingBottom");
            return(_horizCached);
        }
Beispiel #11
0
        public ToggleMatrix(string text, int x = 2, int y = 2)
        {
            var z = x;

            x          = y;
            y          = z;
            toggleGrid = new BoolInstance[y][];
            var index = 0;

            Toggles = new ToggleBase[x * y];
            for (int i = 0; i < y; i++)
            {
                toggleGrid[i] = new BoolInstance[x];
                var grid = new HorizontalLayout();
                for (int j = 0; j < x; j++)
                {
                    var instance = new BoolInstance();
                    toggleGrid[i][j] = instance;
                    var toggle = new Toggle("", () => instance.Value, a => instance.Value = a)
                                 .SetLabelHidden();
                    Toggles[index] = toggle;
                    if (index++ == 0)
                    {
                        _toggleStyle = toggle.Style;
                    }
                    toggle.SetStyle(_toggleStyle);
                    grid.Attach(toggle);
                }
                Attach(grid);
            }
        }
Beispiel #12
0
        public ManualControlsFrame(GUIHost host, SpoolerConnection spooler_connection, PopupMessageBox messagebox, SettingsManager settingsManager)
        {
            this.host = host;
            this.spooler_connection = spooler_connection;
            this.messagebox         = messagebox;
            var manualcontrolsframeTabbuttons = Resources.manualcontrolsframe_tabbuttons;

            Init(host, manualcontrolsframeTabbuttons, new ButtonCallback(tabsFrameButtonCallback));
            gCodeButton             = (ButtonWidget)FindChildElement(3);
            advancedHeatedBedButton = (ButtonWidget)FindChildElement(4);
            basicButton             = (ButtonWidget)FindChildElement(1);
            sdCardButton            = (ButtonWidget)FindChildElement(5);
            TabFrame           = (HorizontalLayout)FindChildElement(1004);
            Visible            = false;
            Enabled            = false;
            RelativeWidth      = 1f;
            RelativeHeight     = 1f;
            basicControlsFrame = new BasicControlsFrame(1001, host, messagebox, spooler_connection);
            AddChildElement(basicControlsFrame);
            basicControlsFrame.Refresh();
            diagnosticsFrame = new DiagnosticsFrame(1002, host, spooler_connection);
            AddChildElement(diagnosticsFrame);
            diagnosticsFrame.Refresh();
            advancedHeatedBedFrame = new AdvancedFrame(1004, host, messagebox, spooler_connection);
            AddChildElement(advancedHeatedBedFrame);
            advancedHeatedBedFrame.Refresh();
            sdCardFrame = new SDCardFrame(1004, host, messagebox, spooler_connection, settingsManager);
            AddChildElement(sdCardFrame);
            sdCardFrame.Refresh();
            gCodesFrame = new GCodeFrame(1003, host, messagebox, spooler_connection);
            AddChildElement(gCodesFrame);
            gCodesFrame.Refresh();
            active_frame = basicControlsFrame;
        }
Beispiel #13
0
        private void InitFields()
        {
            _choosedPaymentType = 0;

            _paymentTypeTextView    = (TextView)GetControl("7c46a01e25b34835b7ff98f6debfeac0", true);
            _rootDockLayout         = (DockLayout)GetControl("07ec0239c319491eb406a40e1183d9b5", true);
            _changeHorizontalLayout = (HorizontalLayout)GetControl("c129ed940d97427fa7cd303171370fde", true);
            _enteredSumEditText     = (EditText)GetControl("778f105408c745b48d4eab7bff782e72", true);
            _cashNotEnoughTextView  = (TextView)GetControl("fde6ae3fe5e946b88a13eb305372e38d", true);
            _punchButtonLayout      = (VerticalLayout)GetControl("2551f8ad1b2749d3847581fd124c841b", true);
            _printImage             = (Image)GetControl("ecd5c17d8f904d368bb5ef92bae35447", true);
            _changeTextView         = (TextView)GetControl("fa4aad30428344f7ac60ca62f721f67a", true);
            _paymentTypes           = new Dictionary <object, string>
            {
                { "0", Translator.Translate("cash") },
                { "1", Translator.Translate("cashless") },
                { "2", Translator.Translate("bonuses") },
                { "3", Translator.Translate("bottles") }
            };

            _fptr    = FptrInstance.Instance;
            _eventId = (string)Variables.GetValueOrDefault(Parameters.IdCurrentEventId, string.Empty);

            _readonly   = (bool)Variables.GetValueOrDefault(Parameters.IdIsReadonly, false);
            _wasStarted = (bool)Variables.GetValueOrDefault(Parameters.IdWasEventStarted, true);
            _enteredSumEditText.Mask     = @"^(\+|\-)?\d+([\.\,]\d{0,2})*$";
            _enteredSumEditText.Required = true;
        }
Beispiel #14
0
        public HeaderWidget(string title) : base(title)
        {
            var layout = new HorizontalGrid();
            var hL0    = new HorizontalLayout();

            hL0.Attach(new Label(title));
            layout.Attach(hL0);
            AddChild(layout);
        }
Beispiel #15
0
        public RadioToggle(string title, System.Func <bool> getValueCallback = null, System.Action <bool> setValueCallback = null)
        {
            var horizontal = new HorizontalLayout();

            _value  = new ValueComponent <bool>(getValueCallback, setValueCallback);
            _filled = new EmptySpace();
            _filled.Style.Set(Styles.Margin, Dim.right * 5);
            horizontal.Attach(_filled, new Label(title));
            AddChild(horizontal);
        }
Beispiel #16
0
 public QuestionView(string titleText, string contextText, Action onYes, Action onNo, Action nextAct = null) :
     this(nextAct)
 {
     SetTitle(titleText);
     SetContext(contextText);
     var horizontalLayout = new HorizontalLayout().AddTo(this);
     //0 yes  1 no
     btnViews.Add(new ButtonView("是", onYes, true).AddTo(horizontalLayout));
     btnViews.Add(new ButtonView("否", onNo, true).AddTo(horizontalLayout));
 }
Beispiel #17
0
        public override void Initialize()
        {
            base.Initialize();

            Layout = new HorizontalLayout
            {
                VerticalAlign = VerticalAlign.Middle,
                Gap           = 2
            };
        }
Beispiel #18
0
        internal void AddButton_OnPressUp(object sender, EventArgs e)
        {
            HorizontalLayout parentLayout = (HorizontalLayout)((VerticalLayout)sender).GetControl(0);
            Image            plusImage    = (Image)parentLayout.GetControl(0);

            parentLayout.CssClass = "AddButton";
            plusImage.Source      = GetResourceImage("cocscreen_plus");

            parentLayout.Refresh();
        }
        public override void OnLoading()
        {
            base.OnLoading();
            DConsole.WriteLine("OnLoading EventList");

            _tabBarComponent  = new TabBarComponent(this);
            _topInfoComponent = new TopInfoComponent(this)
            {
                LeftButtonControl = new Image {
                    Source = ResourceManager.GetImage("topheading_sync")
                },
                RightButtonControl = new Image {
                    Source = ResourceManager.GetImage("topheading_map")
                },
                Header = Translator.Translate("orders")
            };

            var statistic = DBHelper.GetEventsStatistic();

            var extraHorizontalLayout = new HorizontalLayout {
                CssClass = "ExtraHorizontalLayout"
            };
            var leftExtraLayout = new VerticalLayout {
                CssClass = "ExtraLeftLayoutCss"
            };
            var rightExtraLayout = new VerticalLayout {
                CssClass = "ExtraRightLayoutCss"
            };

            extraHorizontalLayout.AddChild(leftExtraLayout);
            extraHorizontalLayout.AddChild(rightExtraLayout);

            leftExtraLayout.AddChild(
                new TextView($"{statistic.DayCompleteAmout}/{statistic.DayTotalAmount}")
            {
                CssClass = "ExtraInfo"
            });
            leftExtraLayout.AddChild(new TextView(Translator.Translate("today"))
            {
                CssClass = "ButtonExtraInfo"
            });

            rightExtraLayout.AddChild(
                new TextView($"{statistic.MonthCompleteAmout}/{statistic.MonthTotalAmount}")
            {
                CssClass = "ExtraInfo"
            });
            rightExtraLayout.AddChild(new TextView(Translator.Translate("per_month"))
            {
                CssClass = "ButtonExtraInfo"
            });

            _topInfoComponent.ExtraLayout.AddChild(extraHorizontalLayout);
        }
Beispiel #20
0
 /// <summary>
 /// Overriding the MAIN RemoveEventListener method!
 /// </summary>
 /// <param name="eventType"></param>
 /// <param name="handler"></param>
 /// <param name="phases"></param>
 public override void RemoveEventListener(string eventType, EventHandler handler, EventPhase phases)
 {
     if (eventType == "propertyChange")
     {
         if (!HasEventListener(eventType))
         {
             HorizontalLayout.RemoveEventListener(eventType, RedispatchHandler);
         }
     }
     base.RemoveEventListener(eventType, handler, phases);
 }
Beispiel #21
0
 /// <summary>
 /// Overriding the MAIN AddEventListener method!
 /// </summary>
 /// <param name="eventType"></param>
 /// <param name="handler"></param>
 /// <param name="phases"></param>
 /// <param name="priority"></param>
 public override void AddEventListener(string eventType, EventHandler handler, EventPhase phases, int priority)
 {
     if (eventType == "propertyChange")
     {
         if (!HasEventListener(eventType))
         {
             HorizontalLayout.AddEventListener(eventType, RedispatchHandler, phases, priority);
         }
     }
     base.AddEventListener(eventType, handler, phases, priority);
 }
Beispiel #22
0
 private void UpdateButtonCSS(HorizontalLayout buttonLayout, VerticalLayout commentLayout, Image image,
                              string buttonCSS,
                              string commentCSS, string name)
 {
     buttonLayout.CssClass = buttonCSS;
     buttonLayout.Refresh();
     commentLayout.CssClass = commentCSS;
     commentLayout.Refresh();
     image.Source = ResourceManager.GetImage(name);
     image.Refresh();
 }
Beispiel #23
0
        public CenterPaneLayout(JPanel panel)
        {
            layout = new VerticalLayout(panel);

            // three main sections: top, middle, bottom
            Layout topSection = new HorizontalLayout(panel);

            topSection.setPreferredSize(100, 15);
            Layout middleSection = new HorizontalLayout(panel);

            middleSection.setPreferredSize(100, 70);

            Layout bottomSection = new HorizontalLayout(panel);

            bottomSection.setPreferredSize(100, 15);

            // three parts of the middle layout
            Layout middleLeft = new VerticalLayout(panel);

            middleLeft.setPreferredSize(15, 100);
            Layout middleMiddle = new HorizontalLayout(panel); // can be horizontal or vertical

            middleMiddle.setPreferredSize(70, 100);
            Layout middleRight = new VerticalLayout(panel);

            middleRight.setPreferredSize(15, 100);

            // set up the buttons/textview/sliders/etc for each layout
            topSection.addUIElement(new Button(34, 100));
            topSection.addUIElement(new TextEdit(33, 100));
            topSection.addUIElement(new Button(33, 100));

            middleLeft.addUIElement(new TextEdit(100, 25));
            middleLeft.addUIElement(new Slider(100, 25));
            middleLeft.addUIElement(new Button(100, 25));
            middleLeft.addUIElement(new Button(100, 25));

            middleMiddle.addUIElement(new Button(100, 100));

            middleRight.addUIElement(new TextEdit(100, 25));
            middleRight.addUIElement(new Slider(100, 25));
            middleRight.addUIElement(new Button(100, 25));
            middleRight.addUIElement(new Button(100, 25));

            middleSection.addUIElement(middleLeft);
            middleSection.addUIElement(middleMiddle);
            middleSection.addUIElement(middleRight);

            bottomSection.addUIElement(new Button(100, 100));

            layout.addUIElement(topSection);
            layout.addUIElement(middleSection);
            layout.addUIElement(bottomSection);
        }
Beispiel #24
0
        private HorizontalLayout CreateHorizontal(List <PanelSize> panelSizes, int from, int to, float height, List <Func <ILayoutElement> > constructors)
        {
            var horizontal = new HorizontalLayout();

            for (int i = from; i < to; i++)
            {
                float width = sizeValues[panelSizes[i]];
                horizontal.Add(Construct(constructors, width, height));
            }
            return(horizontal);
        }
        public override void OnLoading()
        {
            var hl = new HorizontalLayout();

            for (var i = 0; i < 4; i++)
            {
                hl.AddChild(new Button(string.Format("Btn  {0}  ", i), vl_OnClick));
            }
            AddChild(hl);
            hl.AddChild(new Button("Back", Back_OnClick));
        }
        private void Initialize()
        {
            var vl = new VerticalLayout();

            AddChild(vl);

            _swipeHorizontalLayout            = new SwipeHorizontalLayout();
            _swipeHorizontalLayout.Visible    = true;
            _swipeHorizontalLayout.CssClass   = "SwipeHorizontalLayout";
            _swipeHorizontalLayout.Scrollable = true;
            _swipeHorizontalLayout.OnSwipe   += SwipeIndex_OnSwipe;


            _horizontalLayout          = new HorizontalLayout();
            _horizontalLayout.CssClass = "HorizontalLayout";

            _image          = new Image();
            _image.Source   = "Image\\cats.jpg";
            _image.Visible  = true;
            _image.CssClass = "ImageForSwipeHorizontal";

            _image2          = new Image();
            _image2.Source   = "Image\\cat2.jpg";
            _image2.Visible  = true;
            _image2.CssClass = "ImageForSwipeHorizontal";

            _image3          = new Image();
            _image3.Source   = "Image\\cat3.jpg";
            _image3.Visible  = true;
            _image3.CssClass = "ImageForSwipeHorizontal";

            _image4          = new Image();
            _image4.Source   = "Image\\cat4.jpg";
            _image4.Visible  = true;
            _image4.CssClass = "ImageForSwipeHorizontal";


            _swipeHorizontalLayout.AddChild(_image);
            _swipeHorizontalLayout.AddChild(_image2);
            _swipeHorizontalLayout.AddChild(_image3);
            _swipeHorizontalLayout.AddChild(_image4);


            _horizontalLayout.AddChild(_swipeHorizontalLayout);


            vl.AddChild(new Button("Default alignment", AlignmentDefault_OnClick));
            vl.AddChild(new Button("Center alignment", AlignmentCenter_OnClick));
            vl.AddChild(new Button("Swipe To Third Image", SwipeToThird_OnClick));
            vl.AddChild(new Button("Back", Back_OnClick));

            vl.AddChild(_horizontalLayout);
        }
 public ToDoListItemView(ToDoData _item, Action <ToDoListItemView> _changeProperty, bool _showTime = false,
                         Action <ToDoData> _deleteAct = null)
     : base()
 {
     this.data           = _item;
     this.changeProperty = _changeProperty;
     this.showTime       = _showTime;
     this.deleteAct      = _deleteAct;
     container           = new HorizontalLayout("box");
     Add(container);
     Add(new SpaceView(4));
     BuildItem();
 }
        private void Awake()
        {
            todoVersion = new ToDoVersion(0, 0, 0);

            var verticalLayout = new VerticalLayout("box").AddTo(this);

            var addHor = new HorizontalLayout().AddTo(verticalLayout);

            new SpaceView(98).AddTo(addHor);
            new ButtonView("+", () => UpdateMajor(true)).Height(20).Width(20).FontSize(10).AddTo(addHor);
            new SpaceView(15).AddTo(addHor);
            new ButtonView("+", () => UpdateMiddle(true)).Height(20).Width(20).FontSize(10).AddTo(addHor);
            new SpaceView(15).AddTo(addHor);
            new ButtonView("+", () => UpdateSmall(true)).Height(20).Width(20).FontSize(10).AddTo(addHor);

            var versionHor = new HorizontalLayout().AddTo(verticalLayout);

            new LabelView("版本号:").Width(80).FontBold().FontSize(20).AddTo(versionHor);
            new LabelView("V").FontSize(10).Height(20).Width(11).FontBold().AddTo(versionHor);
            majorView = new LabelView("0").FontSize(20).Height(20).Width(20).FontBold()
                        .AddTo(versionHor);
            new LabelView(".").FontSize(20).Height(20).Width(11).FontBold().AddTo(versionHor);
            middleView = new LabelView("0").FontSize(20).Height(20).Width(20).FontBold()
                         .AddTo(versionHor);
            new LabelView(".").FontSize(20).Height(20).Width(11).FontBold().AddTo(versionHor);
            smallView = new LabelView("0").FontSize(20).Height(20).Width(20).FontBold()
                        .AddTo(versionHor);

            var reduceHor = new HorizontalLayout().AddTo(verticalLayout);

            new SpaceView(98).AddTo(reduceHor);
            new ButtonView("-", () => UpdateMajor(false)).TextMiddleCenter().Height(20).Width(20).FontSize(10)
            .AddTo(reduceHor);
            new SpaceView(15).AddTo(reduceHor);
            new ButtonView("-", () => UpdateMiddle(false)).TextMiddleCenter().Height(20).Width(20).FontSize(10)
            .AddTo(reduceHor);
            new SpaceView(15).AddTo(reduceHor);
            new ButtonView("-", () => UpdateSmall(false)).TextMiddleCenter().Height(20).Width(20).FontSize(10)
            .AddTo(reduceHor);

            new SpaceView().AddTo(verticalLayout);

            var nameHor = new HorizontalLayout().AddTo(verticalLayout);

            new LabelView("版本名:").FontBold().Width(80).FontSize(20).AddTo(nameHor);
            versionNameView = new TextFieldView(productName, str => productName = str).FontSize(20).AddTo(nameHor);

            new SpaceView().AddTo(verticalLayout);

            new ButtonView("保存", SaveProduct, true).AddTo(verticalLayout);
        }
        public StoreScreen(Action <Store> HireAgentFunction, Action <Store> FireAgentFunction) : base()
        {
            Layout.PushLayout("storeScreen");
            this.HireAgentFunction = HireAgentFunction;
            this.FireAgentFunction = FireAgentFunction;

            Padding = new Point(10, 10);
            Margin  = 10;
            SetFixedSize(700, 500);

            VerticalLayout leftSide = new VerticalLayout();

            leftSide.SetFixedWidth(300);

            deliveredPizzas        = new KeyValueText("deliveredPizzas", "0");
            outStandingOrders      = new KeyValueText("outstandingOrders", "0");
            avgDeliveryTime        = new KeyValueText("avgDeliveryTime", "5");
            deliveryEmployeesCount = new KeyValueText("deliveryEmployees", "3");

            HorizontalLayout buttonsHor = new HorizontalLayout();
            Button           hireButton = new Button("hireEmployee");
            Button           fireButton = new Button("fireEmployee");

            hireButton.OnMouseClick = () => { HireAgentFunction(store); UpdateTexts(); };
            fireButton.OnMouseClick = () => { FireAgentFunction(store); UpdateTexts(); };
            buttonsHor.AddChild(hireButton, fireButton);

            lastWeeksIncome = new KeyValueText("lastWeekIncome", "0");

            costs              = new Text("costs");
            weeklyRent         = new KeyValueText("rent", "0");
            weeklyEmployeeWage = new KeyValueText("employees", "0");
            weeklyTotalCost    = new KeyValueText("total", "0");


            leftSide.AddChild(deliveryEmployeesCount);
            leftSide.AddChild(deliveredPizzas);
            leftSide.AddChild(outStandingOrders);
            leftSide.AddChild(avgDeliveryTime);
            leftSide.AddChild(buttonsHor);
            leftSide.AddChild(lastWeeksIncome);
            leftSide.AddChild(costs);
            leftSide.AddChild(weeklyRent);
            leftSide.AddChild(weeklyEmployeeWage);
            leftSide.AddChild(weeklyTotalCost);


            AddChild(leftSide);
            Layout.PopLayout("storeScreen");
        }
Beispiel #30
0
        public HeaderWidget2(string title) : base(title)
        {
            var layout = new HorizontalGrid();
            var hL0    = new HorizontalLayout();
            var hL1    = new HorizontalLayout(true);

            hL0.Attach(new Label(title));
            _button = new ToggleButton(true);
            // add toggle button to hl1
            hL1.Attach(_button);

            layout.Attach(hL0, hL1);
            AddChild(layout);
        }
Beispiel #31
0
    void LuoElamaLaskuri()
    {
        HorizontalLayout asettelu = new HorizontalLayout();
        asettelu.Spacing = 10;

        Widget sydamet = new Widget(asettelu);
        sydamet.Color = Color.Transparent;
        sydamet.X = Screen.Center.X;
        sydamet.Y = Screen.Top - 30;
        Add(sydamet);

        for (int i = 0; i < 10; i++)
        {
            Widget sydan = new Widget(30, 30, Shape.Heart);
            sydan.Color = Color.Red;
            sydamet.Add(sydan);
        }
    }
Beispiel #32
0
    void luoesinevalikko()
    {
        selausnumero = 0;
        HorizontalLayout s = new HorizontalLayout();
        s.Spacing = 5;
        Widget v = new Widget(s);
        v.Color = Color.Cyan;
        v.X = Screen.Center.X;
        v.Y = Screen.Bottom + 60;
        Add(v);
        for (int i = 0; i < 9; i++)
        {
            Widget slot = new Widget(40, 40);
            slot.Color = Color.LightGray;
            slot.BorderColor = Color.Charcoal;
            v.Add(slot);
            if (selausnumero < esineet2.Count)
            {
                GameObject väliolio = esineet2[selausnumero];
                slot.Add(väliolio);
                esineslotit.Add(slot);
                väliolio.Color = Color.Blue;
                slot.Image = väliolio.Image;
                käsitaso.Add(slot);
                if (käsiselecteditem == selausnumero)
                {
                    valitseuusikäsiesine(selausnumero);

                }
                selausnumero = selausnumero + 1;
                Keyboard.Listen(Key.D1, ButtonState.Pressed, delegate { valitseuusikäsiesine(1); }, "");
                Keyboard.Listen(Key.D2, ButtonState.Pressed, delegate { valitseuusikäsiesine(2); }, "");
                Keyboard.Listen(Key.D3, ButtonState.Pressed, delegate { valitseuusikäsiesine(3); }, "");
                Keyboard.Listen(Key.D4, ButtonState.Pressed, delegate { valitseuusikäsiesine(4); }, "");
                Keyboard.Listen(Key.D5, ButtonState.Pressed, delegate { valitseuusikäsiesine(5); }, "");
                Keyboard.Listen(Key.D6, ButtonState.Pressed, delegate { valitseuusikäsiesine(6); }, "");
                Keyboard.Listen(Key.D7, ButtonState.Pressed, delegate { valitseuusikäsiesine(7); }, "");
                Keyboard.Listen(Key.D8, ButtonState.Pressed, delegate { valitseuusikäsiesine(8); }, "");
                Keyboard.Listen(Key.D9, ButtonState.Pressed, delegate { valitseuusikäsiesine(9); }, "");
            }
        }
        Keyboard.Listen(Key.E, ButtonState.Pressed,kysykokoesinevalikkoa, "");
    }
Beispiel #33
0
    void luojano()
    {
        HorizontalLayout asettelu = new HorizontalLayout();
        asettelu.Spacing = 10;

        Widget vedet = new Widget(asettelu);
        vedet.Color = Color.Transparent;
        vedet.X = Screen.Center.X;
        vedet.Y = Screen.Bottom + 120;
        Add(vedet);

        for (int i = 0; i < 10; i++)
        {
            Widget vesi = new Widget(30, 30, Shape.Circle);
            vesi.Color = Color.Red;
            vedet.Add(vesi);
            janokulu.Add(vesi);
            vesi.Image = janokuplakuva;
        }

        janot = new IntMeter(10,0,10);
        janot.LowerLimit += janooo;
        Timer janostin = new Timer();
        janostin.Interval = 39.0;
        janostin.Timeout += miinusjano;
        janostin.Start();
    }
Beispiel #34
0
    void LuoUusiMaailma(InputWindow ikkuna)
    {
        kentanNimi = ikkuna.InputBox.Text;
        Vedikartta = new List<PhysicsObject>();
        Gravity = new Vector(0, -900);
        LataaKentta(new ColorTileMap( generate(200, 60,kentanNimi) ) );
        LisaaNappaimet();
        Inventory inventory = new Inventory();
        Add(inventory);
        yu = new HorizontalLayout();
        yu.Spacing = 5;
        qq = new VerticalLayout();
        foreach (PhysicsObject esine in esineet())
        {
            inventory.AddItem(esine, kivihakku);
            inventory.SelectItem(esine);
        }
        inventory.Y = Screen.Top - 20;

        int luku = RandomGen.NextInt(1, 200);
        luopuu(luku);
        //luopuu(new Vector kentanPiste = Level.GetRandomPosition());

        Camera.Zoom(1.5);
        //Camera.ZoomToLevel();
        Camera.Follow(pelaaja1);

        luojano();
        esineet2 = new List<GameObject>();
        esineslotit = new List<Widget>();
        käsiselecteditem = 1;
        GameObject banaanit = new GameObject(35, 35);
        banaanit.Image = banaanikuva;
        esineet2.Add(banaanit);
        GameObject puuhakku = new GameObject(35, 35);
        puuhakku.Image = kivihakku;
        esineet2.Add(puuhakku);
        käsitaso = new List<Widget>();
        luoesinevalikko();
    }
Beispiel #35
0
    void pelaa(int num3)
    {
        LoadGame(kaamos[num3]);
        ColorTileMap maailma1ilmentymä = new ColorTileMap(maailma1);
        LataaKentta(maailma1ilmentymä);
        //Vedikartta = new List<PhysicsObject>();
        Gravity = new Vector(0, -900);
        //LataaKentta(new ColorTileMap(generate(200, 60, kentanNimi)));
        LisaaNappaimet();
        //Inventory inventory = new Inventory();
        //Add(inventory);
        yu = new HorizontalLayout();
        yu.Spacing = 5;
        qq = new VerticalLayout();
        //foreach (PhysicsObject esine in esineet())
        //{
        //    inventory.AddItem(esine, kivihakku);
        //    inventory.SelectItem(esine);
        //}
        //inventory.Y = Screen.Top - 20;

        int luku = RandomGen.NextInt(1, 200);
        luopuu(luku);
        ////luopuu(new Vector kentanPiste = Level.GetRandomPosition());

        Camera.Zoom(1.5);
        ////Camera.ZoomToLevel();
        Camera.Follow(pelaaja1);

        luojano();
        esineet2 = new List<GameObject>();
        esineslotit = new List<Widget>();
        käsiselecteditem = 1;
        GameObject banaanit = new GameObject(35, 35);
        banaanit.Image = banaanikuva;
        esineet2.Add(banaanit);
        GameObject puuhakku = new GameObject(35, 35);
        puuhakku.Image = kivihakku;
        esineet2.Add(puuhakku);
        käsitaso = new List<Widget>();
        luoesinevalikko();
    }