Пример #1
0
        public override void InitElements()
        {
            _iconImage.KeepAspectRatio(true);
            _nameLabel.SetWidth(_nameLabel.GetTextWidth() + 20);

            AddItems(_layout, _notificationNumber);
            _layout.AddItems(_faceItem, _nameLabel);
            _faceItem.AddItem(_iconImage);
        }
Пример #2
0
        public override void InitElements()
        {
            base.InitElements();

            //window's attr
            Window.SetBackground(45, 45, 45);

            //title
            TitleBar title = new TitleBar("Adding a new member");

            title.SetFont(DefaultsService.GetDefaultFont(14));
            title.GetMinimizeButton().SetVisible(false);
            title.GetMaximizeButton().SetVisible(false);

            VerticalStack layout = new VerticalStack();

            layout.SetMargin(0, title.GetHeight(), 0, 0);
            layout.SetPadding(6, 15, 6, 6);
            layout.SetSpacing(vertical: 30);
            layout.SetBackground(255, 255, 255, 20);

            //message
            _input.EventKeyRelease += OnKeyRelease;

            //ok
            _add.SetBackground(255, 181, 111);
            _add.SetStyle(Styles.GetButtonStyle());
            _add.SetShadow(5, 0, 4, Color.FromArgb(150, 0, 0, 0));
            _add.EventMouseClick += (sender, args) =>
            {
                InputResult = _input.GetText();
                Close();
            };

            //adding items
            Window.AddItems(
                title,
                layout
                );
            layout.AddItems(
                _input,
                _add
                );

            title.GetCloseButton().EventMouseClick  = null;
            title.GetCloseButton().EventMouseClick += (sender, args) =>
            {
                Close();
            };
        }
Пример #3
0
        public override void InitWindow()
        {
            SetParameters(nameof(MainWindow), "EnigmaGame", 798, 640, false);
            SetAntiAliasingQuality(MSAA.MSAA8x);
            SetBackground(Common.Background);
            SetPadding(1, 1, 1, 1);
            SetMinSize(GetWidth(), GetHeight());

            //icons
            var big   = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream("EnigmaGame.icon.png"));
            var small = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream("EnigmaGame.icon.png"));

            SetIcon(big, small);

            TitleBar title = new TitleBar("EnigmaGame");

            title.SetIcon(small, 20, 20);
            title.SetShadow(5, 0, 2, Color.Black);

            VerticalStack layout = new VerticalStack();

            layout.SetBackground(GetBackground());
            layout.SetPadding(30, 30, 30, 30);
            layout.SetMargin(10, title.GetHeight() + 10, 10, 10);
            layout.SetSpacing(0, 10);
            layout.SetBorder(new Border(Common.Selected, new CornerRadius(10), 4));
            layout.SetShadow(10, 0, 0, Color.Black);


            //adding
            AddItems(
                layout,
                title,
                menu
                );

            layout.AddItems(
                header,
                time_limit,
                cards_board,
                hand
                );

            //events
            EventKeyPress += OnKeyPress;

            wrong = new SoundPlayer(Assembly.GetExecutingAssembly().GetManifestResourceStream("EnigmaGame.wrong.wav"));
            key   = new SoundPlayer(Assembly.GetExecutingAssembly().GetManifestResourceStream("EnigmaGame.switch.wav"));
            next  = new SoundPlayer(Assembly.GetExecutingAssembly().GetManifestResourceStream("EnigmaGame.next.wav"));
        }
Пример #4
0
        public override void InitWindow()
        {
            // Window's attr
            SetParameters(Controller.GetLanguage()["MainTitle"], Controller.GetLanguage()["MainTitle"], 300, 360, false);
            SetMinSize(300, 360);
            SetBackground(Palette.CommonDark);
            IsCentered = true;
            SetIcon(Resources.Icon, Resources.Icon);

            // Content
            Title = Items.GetTitleBar(Controller.GetLanguage()["MainTitle"]);

            VerticalStack layout = Items.GetLayout();

            layout.SetMargin(0, Title.GetHeight(), 0, 0);

            BtnStatus   = Items.GetButton(Controller.GetLanguage()["BatteryButton"]);
            BtnSettings = Items.GetButton(Controller.GetLanguage()["SettingsButton"]);
            BtnStart    = Items.GetButton(Controller.GetLanguage()["StartButton"]);

            ImgStatus = Items.GetBatteryItem();

            ProfileList = Items.GetProfileList();
            foreach (var profile in Controller.GetAllProfiles())
            {
                ProfileList.AddItem(Items.GetListItem(profile.Name));
            }

            // Adding content
            AddItems(Title, layout);
            layout.AddItems(
                ProfileList,
                ImgStatus,
                BtnStatus,
                BtnSettings,
                new Frame(),
                BtnStart
                );

            // Post settings
            ProfileList.SetCurrentIndex(
                Controller.GetAllProfiles().Select(p => p.Name).ToList().IndexOf(Controller.GetProfile().Name));

            ProfileList.SelectionChanged += () =>
            {
                Controller.InvokeEventProfileChanged(ProfileList.GetText());
            };
        }
Пример #5
0
        public override void InitWindow()
        {
            // Window's attr
            SetParameters(Controller.GetLanguage()["SetsTitle"], Controller.GetLanguage()["SetsTitle"], 900, 600, false);
            SetMinSize(900, 600);
            SetBackground(Factory.Palette.CommonDark);
            IsCentered = true;
            SetIcon(Factory.Resources.Icon, Factory.Resources.Icon);

            // Content
            _titleBar = Factory.Items.GetTitleBar(Controller.GetLanguage()["SetsTitle"]);
            CloseBtn  = _titleBar.GetCloseButton();

            VerticalStack layout = Factory.Items.GetLayout();

            layout.SetMargin(0, _titleBar.GetHeight(), 0, 0);
            layout.SetPadding(0, 0, 0, 15);

            _tabArea = new TabView();
            _tabArea.SetTabPolicy(SizePolicy.Expand);

            _common        = new SettingsTab(Controller.GetLanguage()["SetsTabCommon"]);
            _commonContent = new CommonSettingsContainer();

            _binds        = new SettingsTab(Controller.GetLanguage()["SetsTabBinds"]);
            _bindsContent = new BindsSettingsContainer();

            _sticks        = new SettingsTab(Controller.GetLanguage()["SetsTabSticks"]);
            _sticksContent = new SticksSettingsContainer();

            SaveBtn = Items.GetControlButton(Controller.GetLanguage()["SaveButton"]);

            // Adding content
            AddItems(_titleBar, layout);
            layout.AddItems(
                _tabArea,
                SaveBtn
                );

            _tabArea.AddTab(_common);
            _tabArea.AddTab(_sticks);
            _tabArea.AddTab(_binds);

            _tabArea.AddItemToTab(_common, _commonContent as IBaseItem);
            _tabArea.AddItemToTab(_sticks, _sticksContent as IBaseItem);
            _tabArea.AddItemToTab(_binds, _bindsContent as IBaseItem);
        }
Пример #6
0
 public override void InitElements()
 {
     _cards.SetBorderFill(Common.Neitral);
     _cards.SetBorderThickness(2);
     _cards.SetPadding(3, 3, 3, 3);
     _cards.SetSpacing(0, -5);
     Top.SetBorderThickness(0);
     Bottom.SetBorderThickness(0);
     AddItems(
         _cards,
         _number
         );
     _cards.AddItems(
         Top,
         Bottom
         );
 }
Пример #7
0
        public override void InitWindow()
        {
            // apply new style for ToolTipItem
            InitToolTipStyle();
            // window attr
            SetParameters("MainWindow", "ToolTipExample", 800, 450);
            IsCentered = true;

            // create toolbars
            HorizontalStack toolBar = ItemsFactory.GetToolBarLayout();
            VerticalStack   sideBar = ItemsFactory.GetSideBarLayout();

            // add items to window
            AddItems(
                toolBar,
                sideBar,
                ItemsFactory.GetAreaForPermanentToolTip()
                );

            // 1. add items with standard tooltip to ToolBar
            toolBar.AddItems(
                ItemsFactory.GetTool(DefaultsService.GetDefaultImage(EmbeddedImage.File, EmbeddedImageSize.Size32x32), "Create a new file"),
                ItemsFactory.GetTool(DefaultsService.GetDefaultImage(EmbeddedImage.Folder, EmbeddedImageSize.Size32x32), "Create a new folder"),
                ItemsFactory.GetTool(DefaultsService.GetDefaultImage(EmbeddedImage.RecycleBin, EmbeddedImageSize.Size32x32), "Delete"),
                ItemsFactory.GetTool(DefaultsService.GetDefaultImage(EmbeddedImage.Refresh, EmbeddedImageSize.Size32x32), "Refresh")
                );

            // 2. add items with MyToolTip to sideBar
            sideBar.AddItems(
                ItemsFactory.GetSideTool(DefaultsService.GetDefaultImage(EmbeddedImage.File, EmbeddedImageSize.Size32x32),
                                         new MyToolTip(this, "Create new file:\nCreates a new file in the root directory.")),
                ItemsFactory.GetHorizontalDivider(), // divider
                ItemsFactory.GetSideTool(DefaultsService.GetDefaultImage(EmbeddedImage.Folder, EmbeddedImageSize.Size32x32),
                                         new MyToolTip(this, "Create new folder:\nCreates a new folder in the root directory.")),
                ItemsFactory.GetHorizontalDivider(), // divider
                ItemsFactory.GetSideTool(DefaultsService.GetDefaultImage(EmbeddedImage.RecycleBin, EmbeddedImageSize.Size32x32),
                                         new MyToolTip(this, "Delete:\nDelete selected file entry in root directory.")),
                ItemsFactory.GetHorizontalDivider(), // divider
                ItemsFactory.GetSideTool(DefaultsService.GetDefaultImage(EmbeddedImage.Refresh, EmbeddedImageSize.Size32x32),
                                         new MyToolTip(this, "Refresh:\nUpdates the root directory."))
                );
        }
Пример #8
0
        public override void InitWindow()
        {
            SetParameters(nameof(CharacterEditor), nameof(CharacterEditor), 1000, 600, false);
            IsCentered = true;

            //title
            TitleBar title = new TitleBar(nameof(CharacterEditor));

            title.SetIcon(
                DefaultsService.GetDefaultImage(EmbeddedImage.User, EmbeddedImageSize.Size32x32), 20, 20);

            //layout
            VerticalStack layout = ItemFactory.GetStandardLayout(title.GetHeight());

            //////////////////////////////////////////////////////////////////////////////
            HorizontalStack   toolbar   = ItemFactory.GetToolbar();
            VerticalSplitArea splitArea = ItemFactory.GetSplitArea();

            BtnGenerate = ItemFactory.GetToolbarButton();
            BtnSave     = ItemFactory.GetToolbarButton();
            NumberCount = ItemFactory.GetSpinItem();
            ItemText.SetStyle(StyleFactory.GetTextAreaStyle());
            //////////////////////////////////////////////////////////////////////////////

            //adding
            AddItems(title, layout);
            layout.AddItems(toolbar, splitArea);
            splitArea.AssignLeftItem(ItemList);
            splitArea.AssignRightItem(ItemText);
            toolbar.AddItems(BtnGenerate, BtnSave, ItemFactory.GetVerticalDivider(), NumberCount);
            BtnGenerate.AddItem(ItemFactory.GetToolbarIcon(
                                    DefaultsService.GetDefaultImage(EmbeddedImage.Refresh, EmbeddedImageSize.Size32x32)
                                    ));
            BtnSave.AddItem(ItemFactory.GetToolbarIcon(
                                DefaultsService.GetDefaultImage(EmbeddedImage.Diskette, EmbeddedImageSize.Size32x32)
                                ));
        }
Пример #9
0
        private void FillBinds()
        {
            _leftBinds.AddItems(
                GetBindItem(GamePadButtonType.A),
                GetBindItem(GamePadButtonType.X),
                GetBindItem(GamePadButtonType.Y),
                GetBindItem(GamePadButtonType.B),
                GetBindItem(GamePadButtonType.Up),
                GetBindItem(GamePadButtonType.Down),
                GetBindItem(GamePadButtonType.Left),
                GetBindItem(GamePadButtonType.Right)
                );

            _rightBinds.AddItems(
                GetBindItem(GamePadButtonType.Start),
                GetBindItem(GamePadButtonType.Back),
                GetBindItem(GamePadButtonType.LB),
                GetBindItem(GamePadButtonType.RB),
                GetBindItem(GamePadButtonType.LT),
                GetBindItem(GamePadButtonType.RT),
                GetBindItem(GamePadButtonType.LS),
                GetBindItem(GamePadButtonType.RS)
                );
        }
Пример #10
0
        public override void InitWindow()
        {
            //window init
            SetParameters(nameof(MainWindow), nameof(MainWindow), 1300, 840, false);
            SetMinSize(500, 300);
            SetBackground(32, 34, 37);

            //title
            title = new TitleBar("Mimic");
            title.SetStyle(Styles.GetTitleBarStyle());

            HorizontalStack h_stack = new HorizontalStack();

            h_stack.SetMargin(0, 22, 0, 0);
            h_stack.SetSpacing(0, 0);

            //left block
            VerticalStack left = new VerticalStack();//70

            left.SetWidth(70);
            left.SetWidthPolicy(SizePolicy.Fixed);
            left.SetPadding(2, 0, 2, 2);
            left.SetSpacing(0, 10);

            SpaceVIL.Rectangle line = new SpaceVIL.Rectangle();
            line.SetBackground(32, 34, 37);
            line.SetSizePolicy(SizePolicy.Expand, SizePolicy.Fixed);
            line.SetHeight(1);
            line.SetShadow(2, 0, 2, Color.FromArgb(150, 0, 0, 0));
            line.SetMargin(8, 0, 8, 0);

            ButtonCore mimic_icon = new ButtonCore("M");

            mimic_icon.SetFont(new Font(DefaultsService.GetDefaultFont().FontFamily, 30, FontStyle.Bold));
            mimic_icon.SetSize(50, 50);
            mimic_icon.SetBackground(114, 137, 208);
            mimic_icon.SetAlignment(ItemAlignment.Top | ItemAlignment.HCenter);
            mimic_icon.SetBorderRadius(new CornerRadius(15));

            SpaceVIL.Rectangle divider = new SpaceVIL.Rectangle();
            divider.SetBackground(47, 49, 54);
            divider.SetSizePolicy(SizePolicy.Expand, SizePolicy.Fixed);
            divider.SetHeight(2);
            divider.SetMargin(15, 0, 15, 0);

            ButtonToggle notes_area_btn = new ButtonToggle("N");

            notes_area_btn.SetFont(new Font(DefaultsService.GetDefaultFont().FontFamily, 30, FontStyle.Bold));
            notes_area_btn.SetSize(50, 50);
            notes_area_btn.SetBackground(Color.Transparent);
            notes_area_btn.SetForeground(100, 101, 105);
            notes_area_btn.SetAlignment(ItemAlignment.Top | ItemAlignment.HCenter);
            notes_area_btn.SetBorderRadius(new CornerRadius(15));
            notes_area_btn.SetBorderFill(100, 101, 105);
            notes_area_btn.SetBorderThickness(1);
            notes_area_btn.EventMouseClick += (sender, args) =>
            {
                if (notes_area_btn.IsToggled())
                {
                    freeNotes.SetVisible(true);
                    conversation.SetVisible(false);
                    freeNotes.GetParent().Update(GeometryEventType.ResizeHeight);
                }
                else
                {
                    freeNotes.SetVisible(false);
                    conversation.SetVisible(true);
                    freeNotes.GetParent().Update(GeometryEventType.ResizeHeight);
                }
            };

            ButtonCore add_btn = new ButtonCore();

            add_btn.SetSize(50, 50);
            add_btn.SetBackground(Color.Transparent);
            add_btn.SetAlignment(ItemAlignment.Top | ItemAlignment.HCenter);
            add_btn.SetBorderRadius(new CornerRadius(25));
            add_btn.SetBorderFill(100, 101, 105);
            add_btn.SetBorderThickness(1);
            add_btn.SetToolTip("Add a new friend.");
            add_btn.EventMouseClick += (sender, args) =>
            {
                AddMenuDialog dialog = new AddMenuDialog();
                dialog.OnCloseDialog += () =>
                {
                    string result = dialog.InputResult;
                    if (!result.Equals(String.Empty))
                    {
                        contacts_bar.AddItem(InfinityItemsBox.GetVisualContact(result, input_message));
                    }
                };
                dialog.Show(this);
            };

            CustomShape plus = new CustomShape();

            plus.SetBackground(100, 101, 105);
            plus.SetSize(20, 20);
            plus.SetAlignment(ItemAlignment.VCenter | ItemAlignment.HCenter);
            plus.SetTriangles(GraphicsMathService.GetCross(20, 20, 2, 0));

            //middleblock
            VerticalStack middle = new VerticalStack();//240

            middle.SetStyle(Styles.GetCommonContainerStyle());
            middle.SetWidth(240);
            middle.SetWidthPolicy(SizePolicy.Fixed);
            middle.SetBackground(47, 49, 54);
            middle.SetBorderRadius(new CornerRadius(6, 0, 6, 0));

            Frame search_bar = new Frame();

            search_bar.SetBorderRadius(new CornerRadius(6, 0, 0, 0));
            search_bar.SetBackground(47, 49, 54);
            search_bar.SetHeight(48);
            search_bar.SetPadding(15, 0, 15, 0);
            search_bar.SetHeightPolicy(SizePolicy.Fixed);
            search_bar.SetShadow(2, 0, 2, Color.FromArgb(150, 0, 0, 0));

            contacts_bar = new ListBox();
            contacts_bar.SetPadding(8, 8, 8, 8);
            contacts_bar.SetBackground(Color.Transparent);
            contacts_bar.SetHScrollBarVisible(ScrollBarVisibility.Never);
            contacts_bar.SetVScrollBarVisible(ScrollBarVisibility.Never);
            contacts_bar.SetSelectionVisible(false);

            Frame user_bar = new Frame();

            user_bar.SetBorderRadius(new CornerRadius(0, 0, 6, 0));
            user_bar.SetBackground(42, 44, 49);
            user_bar.SetHeight(48);
            user_bar.SetPadding(15, 0, 15, 0);
            user_bar.SetHeightPolicy(SizePolicy.Fixed);
            user_bar.SetAlignment(ItemAlignment.Bottom);

            TextEdit search = new TextEdit();

            search.SetPadding(10, 0, 10, 0);
            search.SetFont(DefaultsService.GetDefaultFont(12));
            search.SetForeground(150, 150, 150);
            search.SetSubstrateText("Find or start conversation");
            search.SetSubstrateFontSize(12);
            search.SetSubstrateFontStyle(FontStyle.Regular);
            search.SetSubstrateForeground(100, 100, 100);
            search.SetHeight(32);
            search.SetBackground(37, 39, 43);
            search.SetAlignment(ItemAlignment.HCenter, ItemAlignment.VCenter);
            search.SetBorderRadius(4);
            search.SetBorderThickness(1);
            search.SetBorderFill(32, 34, 37);

            //right block
            VerticalStack right = new VerticalStack();//expand

            right.SetStyle(Styles.GetCommonContainerStyle());
            right.SetSpacing(0, 2);

            HorizontalStack conversation_bar = new HorizontalStack();

            conversation_bar.SetBackground(54, 57, 63);
            conversation_bar.SetHeight(48);
            conversation_bar.SetHeightPolicy(SizePolicy.Fixed);
            conversation_bar.SetPadding(10, 0, 0, 0);
            conversation_bar.SetSpacing(5, 0);
            conversation_bar.SetShadow(2, 0, 2, Color.FromArgb(150, 0, 0, 0));

            freeNotes = new FreeArea();
            freeNotes.SetVisible(false);
            freeNotes.SetBackground(Color.FromArgb(5, 255, 255, 255));

            conversation = new ListBox();
            conversation.SetPadding(4, 4, 4, 4);
            conversation.SetBackground(Color.Transparent);
            conversation.SetHScrollBarVisible(ScrollBarVisibility.Never);
            conversation.GetArea().SetPadding(16, 10, 2, 2);
            conversation.SetSelectionVisible(false);

            VerticalScrollBar vs = conversation.VScrollBar;

            vs.SetWidth(16);
            vs.SetBorderThickness(4);
            vs.SetBorderFill(54, 57, 63);
            vs.SetBorderRadius(new CornerRadius(9));
            vs.SetArrowsVisible(false);
            vs.SetBackground(47, 49, 54);
            vs.SetPadding(0, 0, 0, 0);
            vs.Slider.Track.SetBackground(Color.Transparent);
            vs.Slider.SetBorderThickness(4);
            vs.Slider.SetBorderFill(54, 57, 63);
            vs.Slider.SetBorderRadius(new CornerRadius(9));
            vs.Slider.SetBackground(32, 34, 37, 255);
            vs.Slider.SetMargin(new Indents(0, 0, 0, 0));
            vs.Slider.RemoveAllItemStates();

            HorizontalStack input_bar = new HorizontalStack();

            input_bar.SetHeight(44);
            input_bar.SetHeightPolicy(SizePolicy.Fixed);
            input_bar.SetMargin(20, 10, 20, 30);
            input_bar.SetPadding(15, 0, 8, 0);
            input_bar.SetSpacing(10, 0);
            input_bar.SetBackground(72, 75, 81);
            input_bar.SetBorderRadius(new CornerRadius(6, 6, 6, 6));

            ButtonCore emoji = new ButtonCore("+");

            emoji.SetSize(24, 24);
            emoji.SetBackground(126, 128, 132);
            emoji.SetAlignment(ItemAlignment.VCenter | ItemAlignment.Left);
            emoji.SetBorderRadius(new CornerRadius(12));

            SpaceVIL.Rectangle divider_v = new SpaceVIL.Rectangle();
            divider_v.SetBackground(126, 128, 132);
            divider_v.SetWidth(2);
            divider_v.SetSizePolicy(SizePolicy.Fixed, SizePolicy.Expand);
            divider_v.SetMargin(0, 10, 0, 10);

            input_message = new TextEdit();
            input_message.SetBackground(Color.Transparent);
            input_message.SetForeground(Color.White);
            input_message.SetAlignment(ItemAlignment.VCenter);
            input_message.SetBorderRadius(new CornerRadius(0, 3, 0, 3));
            input_message.SetSubstrateText("Message @Jackson");
            input_message.EventKeyPress += (sender, args) =>
            {
                if (args.Key == KeyCode.Enter)
                {
                    conversation.AddItem(InfinityItemsBox.GetMessage(input_message.GetText()));
                    input_message.Clear();
                }
            };

            ButtonCore add_note = InfinityItemsBox.GetOrdinaryButton();

            add_note.SetForeground(166, 167, 168);
            add_note.SetFont(new Font(DefaultsService.GetDefaultFont().FontFamily, 12, FontStyle.Bold));
            add_note.SetText("Add new note");
            add_note.SetWidth(100);
            add_note.SetShadow(4, 0, 2, Color.FromArgb(150, 0, 0, 0));
            add_note.EventMouseClick += (sender, args) =>
            {
                NoteBlock block = InfinityItemsBox.GetNoteBlock();
                block.SetPosition(100, 100);
                freeNotes.AddItem(block);
            };

            //adding items
            AddItems(
                title,
                h_stack
                );
            h_stack.AddItems(
                left,
                middle,
                right
                );
            left.AddItems(
                line,
                mimic_icon,
                divider,
                notes_area_btn,
                add_btn
                );
            add_btn.AddItem(
                plus
                );
            middle.AddItems(
                search_bar,
                contacts_bar,
                user_bar
                );
            search_bar.AddItems(
                search
                );
            user_bar.AddItems(
                new UserBar("Daniel")
                );
            right.AddItems(
                conversation_bar,
                conversation,
                freeNotes,
                input_bar
                );
            conversation_bar.AddItems(
                add_note,
                InfinityItemsBox.GetOrdinaryButton(),
                InfinityItemsBox.GetOrdinaryButton(),
                InfinityItemsBox.GetOrdinaryButton(),
                InfinityItemsBox.GetOrdinaryButton()
                );
            input_bar.AddItems(
                emoji,
                divider_v,
                input_message
                );
            contacts_bar.AddItems(
                InfinityItemsBox.GetVisualContact("Jackson", input_message),
                InfinityItemsBox.GetVisualContact("Evelyn", input_message),
                InfinityItemsBox.GetVisualContact("Alexander", input_message),
                InfinityItemsBox.GetVisualContact("Matthew", input_message)
                );
        }
Пример #11
0
        public override void InitWindow()
        {
            SetParameters(nameof(MainWindow), nameof(MainWindow), 1240, 750, false);
            IsCentered = true;

            var icon = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream("SimpleImageViewer.Resources.icon.png"));

            TitleBar title = new TitleBar("Simple Image Viewer - C#");

            title.SetIcon(icon, 24, 24);
            title.SetPadding(4, 0, 5, 0);

            Frame layout = new Frame();

            layout.SetMargin(0, title.GetHeight(), 0, 0);
            layout.SetPadding(0, 0, 0, 0);
            layout.SetSpacing(6);
            layout.SetBackground(60, 60, 60);

            VerticalStack vToolbar = new VerticalStack();

            vToolbar.SetWidthPolicy(SizePolicy.Fixed);
            vToolbar.SetWidth(30);
            vToolbar.SetBackground(32, 32, 32);
            vToolbar.SetPadding(0, 30, 0, 0);

            HorizontalSplitArea splitArea = new HorizontalSplitArea();

            splitArea.SetMargin(vToolbar.GetWidth(), 0, 0, 0);
            splitArea.SetSplitThickness(5);

            imageArea = new WrapGrid(160, 120, Orientation.Horizontal);
            imageArea.SetBackground(Color.Transparent);
            imageArea.SetPadding(15, 6, 6, 6);
            imageArea.GetArea().SetSpacing(6, 6);
            imageArea.VScrollBar.SetStyle(Style.GetSimpleVerticalScrollBarStyle());
            imageArea.SetStretch(true);

            previewArea = new PreviewArea(imageArea);

            side = new AlbumSideList(this, Side.Left, imageArea, previewArea);
            side.SetAreaSize(400);
            Album defaultAlbum = new Album("MyPictures", Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + Path.DirectorySeparatorChar + "Pictures");

            defaultAlbum.OnDoubleClick += (sender) =>
            {
                side.Hide();
                Model.FillImageArea(this, imageArea, previewArea, (sender as Album).GetPath());
            };
            side.AddAlbum(defaultAlbum);

            ButtonCore btnSideAreaShow = new ButtonCore();

            btnSideAreaShow.SetStyle(CustomStyles.GetButtonStyle());

            ButtonCore btnOpenFolder = new ButtonCore();

            btnOpenFolder.SetStyle(CustomStyles.GetButtonStyle());

            ButtonCore btnAddAlbum = new ButtonCore();

            btnAddAlbum.SetStyle(CustomStyles.GetButtonStyle());

            //adding
            AddItems(
                title,
                layout
                );
            layout.AddItems(
                vToolbar,
                splitArea
                );

            splitArea.AssignTopItem(previewArea);
            splitArea.AssignBottomItem(imageArea);
            splitArea.SetSplitPosition(300);

            vToolbar.AddItems(
                btnSideAreaShow,
                btnOpenFolder,
                btnAddAlbum
                );

            btnSideAreaShow.AddItem(new ImageItem(DefaultsService.GetDefaultImage(EmbeddedImage.Lines, EmbeddedImageSize.Size32x32), false));
            btnOpenFolder.AddItem(new ImageItem(DefaultsService.GetDefaultImage(EmbeddedImage.Folder, EmbeddedImageSize.Size32x32), false));
            btnAddAlbum.AddItem(new ImageItem(DefaultsService.GetDefaultImage(EmbeddedImage.Import, EmbeddedImageSize.Size32x32), false));

            //events
            EventDrop += (sender, args) =>
            {
                if (side.IsHide)
                {
                    if (File.GetAttributes(args.Paths[0]).HasFlag(FileAttributes.Directory))
                    {
                        Model.FillImageArea(this, imageArea, previewArea, args.Paths[0]);
                    }
                }
                else
                {
                    foreach (String path in args.Paths)
                    {
                        if (File.GetAttributes(path).HasFlag(FileAttributes.Directory))
                        {
                            Album album = new Album(new DirectoryInfo(path).Name, path);
                            side.AddAlbum(album);
                            album.OnDoubleClick += (s) =>
                            {
                                side.Hide();
                                Model.FillImageArea(this, imageArea, previewArea, (s as Album).GetPath());
                            };
                        }
                    }
                }
            };

            btnSideAreaShow.EventMouseClick += (sender, args) =>
            {
                side.Show();
            };

            btnOpenFolder.EventMouseClick += (sender, args) =>
            {
                OpenEntryDialog browse = new OpenEntryDialog("Open Folder:", FileSystemEntryType.Directory, OpenDialogType.Open);
                browse.OnCloseDialog += () =>
                {
                    Model.FillImageArea(this, imageArea, previewArea, browse.GetResult());
                };
                browse.Show(this);
            };

            imageArea.EventScrollUp += (sender, args) =>
            {
                if (args.Mods.HasFlag(KeyMods.Control))
                {
                    int w = imageArea.GetCellWidth() + 8;
                    int h = imageArea.GetCellHeight() + 6;
                    if (w > 400)
                    {
                        return;
                    }
                    imageArea.SetCellSize(w, h);
                }
            };
            imageArea.EventScrollDown += (sender, args) =>
            {
                if (args.Mods.HasFlag(KeyMods.Control))
                {
                    int w = imageArea.GetCellWidth() - 8;
                    int h = imageArea.GetCellHeight() - 6;
                    if (w < 160)
                    {
                        return;
                    }
                    imageArea.SetCellSize(w, h);
                }
            };

            btnAddAlbum.EventMouseClick += (sender, args) =>
            {
                OpenEntryDialog browse = new OpenEntryDialog("Open Folder:", FileSystemEntryType.Directory, OpenDialogType.Open);
                browse.OnCloseDialog += () =>
                {
                    if (browse.GetResult() == null || browse.GetResult() == String.Empty)
                    {
                        return;
                    }

                    Album album = new Album(new DirectoryInfo(browse.GetResult()).Name, browse.GetResult());
                    side.AddAlbum(album);
                    album.OnDoubleClick += (s) =>
                    {
                        side.Hide();
                        Model.FillImageArea(this, imageArea, previewArea, (s as Album).GetPath());
                    };
                };
                browse.Show(this);
            };

            EventOnStart += () =>
            {
                Model.FillImageArea(this, imageArea, previewArea,
                                    Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + Path.DirectorySeparatorChar + "Pictures");
            }
        }
Пример #12
0
        public override void InitElements()
        {
            Grid left_arrows = new Grid(2, 1);

            left_arrows.SetWidth(20);
            left_arrows.SetWidthPolicy(SizePolicy.Fixed);
            Grid right_arrows = new Grid(2, 1);

            right_arrows.SetStyle(left_arrows.GetCoreStyle());

            //board
            VerticalStack board = new VerticalStack();

            board.SetMargin(5, 0, 5, 0);
            board.SetSpacing(0, 0);

            top_grid.SetBorder(new Border(Common.Significant, new CornerRadius(10, 10, 0, 0), 1));
            top_grid.SetPadding(5, 1, 1, 0);

            //numbers
            bottom_grid.SetBorder(new Border(Common.Significant, new CornerRadius(0, 0, 10, 10), 1));
            bottom_grid.SetPadding(5, 0, 1, 1);

            //adding
            AddItems(
                left_arrows,
                board,
                right_arrows
                );

            left_arrows.AddItems(
                Common.GetArrow(135),
                Common.GetArrow(135)
                );

            right_arrows.AddItems(
                Common.GetArrow(-45),
                Common.GetArrow(-45)
                );

            board.AddItems(
                top_grid,
                bottom_grid
                );

            for (int i = 0; i < 9; i++)
            {
                Card top_card = new Card();
                top_grid.AddItem(top_card);

                Card bottom_card = new Card();
                bottom_grid.AddItem(bottom_card);

                top_list.Add(top_card);
                bottom_list.Add(bottom_card);

                if (i == 0 || i == 8)
                {
                    top_card.SetBorderFill(Color.Transparent);
                    bottom_card.SetBorderFill(Color.Transparent);
                }
            }
            InitHand();
        }
Пример #13
0
        public override void InitElements()
        {
            _leftStickLayout.SetSpacing(0, 10);
            _rightStickLayout.SetSpacing(0, 10);

            _lStickAssignment.SetPadding(0, 0, 40, 0);
            _rStickAssignment.SetPadding(0, 0, 40, 0);

            AddItems(
                _leftStickLayout,
                _rightStickLayout
                );

            _leftStickLayout.AddItems(
                _lLabel,
                _lDynamicSensitivity,
                _lSpeedSlider,
                _lStickAssignment
                );

            _rightStickLayout.AddItems(
                _rLabel,
                _rDynamicSensitivity,
                _rSpeedSlider,
                _rStickAssignment
                );

            _lStickAssignment.AddItems(
                _lMouseMove,
                _lArrows
                );

            _rStickAssignment.AddItems(
                _rMouseMove,
                _rArrows
                );

            ApplyProfile(Controller.GetProfile());

            _lSpeedSlider.EventValueChanged += () =>
            {
                Controller.GetProfile().LeftThumbStickSpeed = (uint)_lSpeedSlider.GetSpeed();
            };
            _rSpeedSlider.EventValueChanged += () =>
            {
                Controller.GetProfile().RightThumbStickSpeed = (uint)_rSpeedSlider.GetSpeed();
            };

            _lStickAssignment.SelectionChanged += () =>
            {
                Controller.GetProfile().LeftStickAction = (StickActionType)_lStickAssignment.GetCurrentIndex();
            };
            _rStickAssignment.SelectionChanged += () =>
            {
                Controller.GetProfile().RightStickAction = (StickActionType)_rStickAssignment.GetCurrentIndex();
            };

            _lDynamicSensitivity.EventToggle += (value) =>
            {
                Controller.GetProfile().LeftThumbStickAcceleration = value;
            };
            _rDynamicSensitivity.EventToggle += (value) =>
            {
                Controller.GetProfile().RightThumbStickAcceleration = value;
            };
        }
Пример #14
0
        public override void InitElements()
        {
            //important!
            base.InitElements();

            //window init
            Window.SetMinSize(330, 150);
            Window.SetBackground(47, 49, 54);
            Window.SetPadding(0, 0, 0, 0);

            //title
            TitleBar title = new TitleBar("Adding a new friend");

            title.SetStyle(Styles.GetTitleBarStyle());
            title.GetMaximizeButton().SetVisible(false);
            title.GetMinimizeButton().SetVisible(false);

            VerticalStack layout = new VerticalStack();

            layout.SetAlignment(ItemAlignment.Top | ItemAlignment.HCenter);
            layout.SetMargin(0, 22, 0, 0);
            layout.SetPadding(6, 15, 6, 6);
            layout.SetSpacing(vertical: 30);
            layout.SetBackground(255, 255, 255, 20);

            //new friend's name
            input.SetBorderRadius(4);
            input.EventKeyRelease += OnKeyRelease;

            //add button
            add = InfinityItemsBox.GetOrdinaryButton();
            add.SetSize(150, 30);
            add.SetBackground(67, 181, 129);
            add.SetForeground(Color.White);
            add.SetText("Add");
            add.SetAlignment(ItemAlignment.HCenter | ItemAlignment.Bottom);
            add.SetPadding(0, 2, 0, 0);
            add.SetShadow(4, 0, 2, Color.FromArgb(150, 0, 0, 0));

            //adding items
            Window.AddItems(
                title,
                layout
                );
            layout.AddItems(
                input,
                add
                );

            add.EventMouseClick += (sender, args) =>
            {
                InputResult = input.GetText();
                Close();
            };

            title.GetCloseButton().EventMouseClick  = null;
            title.GetCloseButton().EventMouseClick += (sender, args) =>
            {
                Close();
            };
            //focus on textedit
            input.SetFocus();
        }
Пример #15
0
        public override void InitWindow()
        {
            //Window attr
            SetParameters(nameof(MainWindow), nameof(CustomChance), 360, 500, false);
            SetMinSize(350, 500);
            SetBackground(45, 45, 45);
            EventKeyRelease += (sender, args) => OnKeyRelease(sender, args);
            EventClose       = () =>
            {
                CommonLogic.GetInstance().TrySerialize();
                Close();
            };

            //icons
            var big   = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream("CustomChance.icon_big.png"));
            var small = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream("CustomChance.icon_small.png"));

            SetIcon(big, small);

            //title
            TitleBar title = new TitleBar("Custom Chance");

            title.SetIcon(small, 16, 16);
            title.SetFont(DefaultsService.GetDefaultFont(14));
            title.GetMaximizeButton().SetVisible(false);

            //layout
            VerticalStack layout = new VerticalStack();

            layout.SetMargin(0, title.GetHeight(), 0, 0);
            layout.SetPadding(3, 3, 3, 3);
            layout.SetSpacing(vertical: 5);
            layout.SetBackground(255, 255, 255, 20);

            //listBox
            _listBox = new ListBox();
            _listBox.SetBackground(52, 52, 52);
            _listBox.SetHScrollBarPolicy(VisibilityPolicy.Never);
            _listBox.SetVScrollBarPolicy(VisibilityPolicy.Never);
            _listBox.SetSelectionVisible(false);

            //AddButton
            AddButton = new ButtonStand("Add a Member!");
            AddButton.SetStyle(Styles.GetButtonStyle());
            AddButton.SetMargin(0, 5, 0, 5);
            AddButton.SetShadow(5, 0, 4, Color.FromArgb(150, 0, 0, 0));
            AddButton.EventMouseClick += (sender, args) =>
            {
                InputDialog dialog = new InputDialog();

                dialog.OnCloseDialog += () =>
                {
                    String result = dialog.InputResult;
                    //add member
                    if (CommonLogic.GetInstance().AddMember(CommonLogic.GetInstance().Storage.Members, result))
                    {
                        //add member to ui
                        MemberItem member = new MemberItem();
                        member.MemberName.SetText(result);
                        member.Index = CommonLogic.GetInstance().Storage.Members.Count - 1;
                        _listBox.AddItem(member);
                    }
                };
                dialog.Show(this);
            };

            //StartButton
            StartButton = new ButtonStand("Make a Chance!");
            StartButton.SetStyle(Styles.GetButtonStyle());
            StartButton.SetMargin(0, 5, 0, 5);
            StartButton.SetShadow(5, 0, 4, Color.FromArgb(150, 0, 0, 0));
            StartButton.EventMouseClick += (sender, args) =>
            {
                if (CommonLogic.GetInstance().Storage.Members == null || CommonLogic.GetInstance().Storage.Members.Count == 0)
                {
                    return;
                }
                CommonLogic.GetInstance().StartRandom(CommonLogic.GetInstance().Storage.Members);
                UpdateUI();
            };

            //adding
            AddItems(
                title,
                layout
                );
            layout.AddItems(
                AddButton,
                _listBox,
                StartButton
                );

            //load save file
            if (CommonLogic.GetInstance().Storage.Members.Count > 0)
            {
                RestoreItems();
            }
        }
Пример #16
0
        private void PopulateButtonsList()
        {
            var generateButton = UiElements.GetButton("Generate Graph");

            generateButton.EventMouseClick += (sender, args) =>
            {
                var dialog = new GenerateGraphDialog(_presenter.MaxVertices);
                dialog.GotCorrectInput += OnGotGraphGenerationInput;
                dialog.Show(this);
            };

            var shimbelButton = UiElements.GetButton("Shimbel's Algorithm");

            shimbelButton.EventMouseClick += (sender, args) =>
            {
                if (_presenter.IsGraphGenerated())
                {
                    var dialog = new ShimbelDialog(_presenter.Vertices);
                    dialog.GotCorrectShimbel += OnGotShimbelInput;
                    dialog.Show(this);
                }
                else
                {
                    ShowPopUp("Generate graph first");
                }
            };

            var checkReachButton = UiElements.GetButton("Check Path Existence");

            checkReachButton.EventMouseClick += (sender, args) =>
            {
                if (_presenter.IsGraphGenerated())
                {
                    var dialog = new CheckPathExistenceDialog(_presenter.Vertices);
                    dialog.GotCorrectCheckPath += OnGotCheckPathInput;
                    dialog.Show(this);
                }
                else
                {
                    ShowPopUp("Generate graph first");
                }
            };

            var shortestPathButton = UiElements.GetButton("Find Shortest Path");

            shortestPathButton.EventMouseClick += (sender, args) =>
            {
                if (_presenter.IsGraphGenerated())
                {
                    var dialog = new ShortestPathDialog(_presenter.Vertices);
                    dialog.GotCorrectFindPath += OnGotFindPathInput;
                    dialog.Show(this);
                }
                else
                {
                    ShowPopUp("Generate graph first");
                }
            };

            var spanningTreesButton = UiElements.GetButton("Find Spanning Trees");

            spanningTreesButton.EventMouseClick += (sender, args) =>
            {
                if (_presenter.IsGraphGenerated())
                {
                    var dialog = new MinimumSpanningTreeDialog();
                    dialog.GotPrimRequest    += OnGotPrimRequest;
                    dialog.GotKruskalRequest += OnGotKruskalRequest;
                    dialog.GotTotalRequest   += OnGotTotalRequest;
                    dialog.Show(this);
                }
                else
                {
                    ShowPopUp("Generate graph first");
                }
            };

            var getPruferCode = UiElements.GetButton("Get Prufer Code for SST");

            getPruferCode.EventMouseClick += (sender, args) =>
            {
                if (_presenter.IsGraphGenerated())
                {
                    if (_presenter.IsSstGenerated())
                    {
                        ShowPopUp(_presenter.OnGetPruferCall());
                    }
                    else
                    {
                        ShowPopUp("Generate SST first");
                    }
                }
                else
                {
                    ShowPopUp("Generate graph first");
                }
            };

            var setPruferCode = UiElements.GetButton("Graph from Prufer Code");

            setPruferCode.EventMouseClick += (sender, args) =>
            {
                var dialog = new PruferCodeDialog();
                dialog.GotCorrectPruferInput += OnGotPruferInput;
                dialog.Show(this);
            };

            var generateFlowNetwork = UiElements.GetButton("Flow network from this");

            generateFlowNetwork.EventMouseClick += (sender, args) =>
            {
                if (_presenter.IsGraphGenerated())
                {
                    //_presenter.SaveGraph();
                    _presenter.OnCreateFlowNetworkCall();
                }
                else
                {
                    ShowPopUp("Generate graph first");
                }
            };

            var findMaxFlow = UiElements.GetButton("Find max flow");

            findMaxFlow.EventMouseClick += (sender, args) =>
            {
                if (_presenter.IsGraphGenerated())
                {
                    if (_presenter.IsFlowNetworkGenerated())
                    {
                        ShowPopUp("Max Flow: " + _presenter.OnMaxFlowCall().ToString());
                    }
                    else
                    {
                        ShowPopUp("Modify graph into flow network");
                    }
                }
                else
                {
                    ShowPopUp("Generate graph first");
                }
            };

            var findMinCostFlow = UiElements.GetButton("Find min cost flow");

            findMinCostFlow.EventMouseClick += (sender, args) =>
            {
                if (_presenter.IsGraphGenerated())
                {
                    if (_presenter.IsFlowNetworkGenerated())
                    {
                        ShowPopUp("Min Cost (2 * Max Flow / 3): " +
                                  _presenter.OnMinCostFlowCall().ToString());
                    }
                    else
                    {
                        ShowPopUp("Modify graph into flow network");
                    }
                }
                else
                {
                    ShowPopUp("Generate graph first");
                }
            };

            var makeEulerian = UiElements.GetButton("Make Eulerian");

            makeEulerian.EventMouseClick += (sender, args) =>
            {
                if (_presenter.IsGraphGenerated())
                {
                    if (!_presenter.WasModified())
                    {
                        _presenter.OnMakeEulerianCall();
                    }
                    else
                    {
                        ShowPopUp("Reset modified graph");
                    }
                }
                else
                {
                    ShowPopUp("Generate graph first");
                }
            };

            var makeHamiltonian = UiElements.GetButton("Make Hamiltonian");

            makeHamiltonian.EventMouseClick += (sender, args) =>
            {
                if (_presenter.IsGraphGenerated())
                {
                    if (!_presenter.WasModified())
                    {
                        _presenter.OnMakeHamiltonianCall();
                    }
                    else
                    {
                        ShowPopUp("Reset modified graph");
                    }
                }
                else
                {
                    ShowPopUp("Generate graph first");
                }
            };

            var findEulerianCycle = UiElements.GetButton("Find Eulerian Cycle");

            findEulerianCycle.EventMouseClick += (sender, args) =>
            {
                if (_presenter.IsGraphGenerated())
                {
                    if (_presenter.WasModified())
                    {
                        if (_presenter.IsEulerian() || _presenter.Vertices == 2)
                        {
                            _presenter.OnFindEulerianCycleCall();
                        }
                        else
                        {
                            ShowPopUp("Graph is not eulerian");
                        }
                    }
                    else
                    {
                        ShowPopUp("Create eulerian graph first");
                    }
                }
                else
                {
                    ShowPopUp("Generate graph first");
                }
            };

            var findHamiltonianCycle = UiElements.GetButton("Find Hamiltonian Cycle");

            findHamiltonianCycle.EventMouseClick += (sender, args) =>
            {
                if (_presenter.IsGraphGenerated())
                {
                    if (_presenter.WasModified())
                    {
                        if (_presenter.IsHamiltonian())
                        {
                            if (_presenter.Vertices <= 8)
                            {
                                _presenter.OnFindHamiltonianCycleCall();
                            }
                            else
                            {
                                ShowPopUp("There should be <= 7 vertices");
                            }
                        }
                        else
                        {
                            ShowPopUp("Graph is not hamiltonian");
                        }
                    }
                    else
                    {
                        ShowPopUp("Create hamiltonian graph first");
                    }
                }
                else
                {
                    ShowPopUp("Generate graph first");
                }
            };

            _buttonsList.AddItems(
                generateButton,
                shimbelButton,
                checkReachButton,
                shortestPathButton,
                spanningTreesButton,
                getPruferCode,
                setPruferCode,
                generateFlowNetwork,
                findMaxFlow,
                findMinCostFlow,
                makeEulerian,
                makeHamiltonian,
                findEulerianCycle,
                findHamiltonianCycle);
        }