Esempio n. 1
0
        private void LoadContent_Ui(ContentManager Content)
        {
            augmentIcon = Content.Load <Texture2D>("PreparationTurn/StatAugmentIcon");

            moneyBox = new RectBox(graphicsDevice,
                                   characterDrawPos + new Vector2(uiScale * turnPlayer.CharacterSprite.Width / 2, winBarDimensions.Y + unitBarDimensions.Y),
                                   (int)moneyBoxDimensions.X, (int)moneyBoxDimensions.Y);

            emptyRect         = UiTools.GeneratePixelTexture(graphicsDevice);
            characterBoundary = Content.Load <Texture2D>("CharacterSelect/Buttons/ButtonBoundaryLR");
            vsAiIcon          = Content.Load <Texture2D>("PreparationTurn/vsPlayerIcon");
            vsPlayerIcon      = Content.Load <Texture2D>("PreparationTurn/vsPlayerIcon");
            moneyIcon         = Content.Load <Texture2D>("PreparationTurn/MoneyIcon");
            //information used by the stage box:
            stageInfo = new StageViewBox(graphicsDevice,
                                         currentStage,
                                         bebasSmall,
                                         stageNumber + 1,
                                         stageIndex + 1,
                                         WindowTools.PaddingToPixelCoordinate(0f, 0.25f, 10, 10)
                                         );

            //Buttons
            Texture2D buttonTexture = Content.Load <Texture2D>("PreparationTurn/EndTurnButton");
            Texture2D hoverTexture  = Content.Load <Texture2D>("PreparationTurn/EndTurnButtonHovered");

            bool[,] mask  = UiTools.CreateBoolMask(buttonTexture);
            endTurnButton = new SinglePressSpriteButton(WindowTools.PaddingToPixelCoordinate(0f, 0.17f, 10, 10),
                                                        buttonTexture,
                                                        hoverTexture,
                                                        mask, uiScale);

            //assign the end turn function to the button's event handler.
            endTurnButton.buttonPressed += HandleEndTurnButtonPress;

            levelUnitCapButton = new LevelUnitCapButton(graphicsDevice,
                                                        moneyBox.GetPos() + new Vector2(moneyBoxDimensions.X, 0f),
                                                        (int)WindowTools.GetUpscaledValue(225f), (int)moneyBoxDimensions.Y);

            //and so on with all used buttons
            levelUnitCapButton.buttonPressed += HandleLevelUpCapPress;

            useAbilityButton = new UseAbilityButton(graphicsDevice,
                                                    WindowTools.PaddingToPixelCoordinate(0.1f, 0.17f, 10, 10),
                                                    (int)WindowTools.GetUpscaledValue(225f),
                                                    (int)(buttonTexture.Height * uiScale)
                                                    );

            useAbilityButton.buttonPressed += HandleAbilityButtonPress;

            //divisor line to distinguish between money box/level up button.
            divisorLine = new Line(graphicsDevice, levelUnitCapButton.GetPos(), levelUnitCapButton.GetPos() + new Vector2(0, levelUnitCapButton.GetHeight()), 5, Color.White);


            //help button
            helpButton = new TutorialButton(graphicsDevice, this,
                                            WindowTools.PaddingToPixelCoordinate(0.90f, 0f, 0, 10),
                                            (int)(20 * uiScale),
                                            (int)(10 * uiScale));
        }
Esempio n. 2
0
        private void LoadContent_Ui(ContentManager Content)
        {
            //Load icons
            augmentIcon       = Content.Load <Texture2D>("PreparationTurn/StatAugmentIcon");
            characterBoundary = Content.Load <Texture2D>("CharacterSelect/Buttons/ButtonBoundaryLR");
            emptyRect         = UiTools.GeneratePixelTexture(graphicsDevice); //used to draw % bars
            moneyIcon         = Content.Load <Texture2D>("PreparationTurn/MoneyIcon");

            //load money ui if vs ai
            if (useAiOpponent)
            {
                moneyUiBox = new RectBox(graphicsDevice,
                                         characterPos[0] + new Vector2(uiScale * playerToCheckWinCondition.CharacterSprite.Width / 2, 0),
                                         (int)moneyBoxDimensions.X, (int)moneyBoxDimensions.Y
                                         );
            }

            actionLogTextures = new ActionLogBox.DrawParams(
                unitSprites,
                Content.Load <Texture2D>("BattleTurn/AttackIcon"),
                Content.Load <Texture2D>("BattleTurn/DefenseIcon"),
                Content.Load <Texture2D>("BattleTurn/NoMoveIcon"),
                Content.Load <Texture2D>("BattleTurn/Footprints"),
                Content.Load <Texture2D>("BattleTurn/SkullIcon"),
                Content.Load <Texture2D>("BattleTurn/TargetIcon")
                );

            logDisplay = new ActionLogBox(graphicsDevice, logCapacity, bebasSmall, WindowTools.PaddingToPixelCoordinate(1f, 0.5f, -10, 0));
            logDisplay.SetAnchorPoint(1f, 0.5f);

            helpButton = new TutorialButton(graphicsDevice, this,
                                            WindowTools.PaddingToPixelCoordinate(0.9f, 0f, 0, 10),
                                            (int)(20 * uiScale),
                                            (int)(10 * uiScale));
        }
Esempio n. 3
0
        //// ============ Events handlers =============

        private void Pallet_Loaded(object sender, RoutedEventArgs e)
        {
            WindowTools.HideFromProgramSwitcher(this);
            Ep10Button.Click     += Ep10Button_Click;
            Ep13Button.Click     += Ep13Button_Click;
            ColorRed.Click       += ColorRed_Click;
            ColorBlue.Click      += ColorBlue_Click;
            ColorBlueHole.Click  += ColorBlueHole_Click;
            ColorPeach.Click     += ColorPeach_Click;
            ColorLightBlue.Click += ColorLightBlue_Click;
            ColorMaroon.Click    += ColorMaroon_Click;
            ColorGray.Click      += ColorGray_Click;
            ColorLightGray.Click += ColorLightGray_Click;
            ColorBlack.Click     += ColorBlack_Click;
            ColorGreen.Click     += ColorGreen_Click;
            Lay15Green.Click     += Lay15Green_Click;
            Lay16Green.Click     += Lay16Green_Click;
            Lay17Purple.Click    += Lay17Purple_Click;
            Lay18Purple.Click    += Lay18Purple_Click;
            Lay19Green.Click     += Lay19Green_Click;
            Lay20Green.Click     += Lay20Green_Click;
            Lay21Green.Click     += Lay21Green_Click;
            Lay22Tomato.Click    += Lay22Tomato_Click;
            PalletButton.Click   += PalletButton_Click;
            MouseDown            += OnMouseLeftButtonDown;
        }
Esempio n. 4
0
        public In_Desktop_Use_SchedulingAssisstant_Set_Provider(Application app, string candidateName)
        {
            application = app;
            windowTools = new WindowTools();
            String[] weekDays = new String[] { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };
            //String[] weekDays = new String[] { "Saturday" };
            Button dayToClick = null;

            foreach (string day in weekDays)
            {
                List <Window> windows = windowTools.GetWindows(application);
                window     = windowTools.GetWindow(windows, "HomeHealthDesktop");
                dayToClick = GetButton(window, day);

                if (dayToClick.IsOffScreen == false)
                {
                    dayToClick.DoubleClick();
                }
                else
                {
                    windowTools.MouseDoubleClickPoint(window, new Point(dayToClick.Location.X, dayToClick.Location.Y));
                }

                SetProviderToCalendar(candidateName);
            }

            CloseSchedulingAssistantTab();
        }
Esempio n. 5
0
        public SlammerUIHandler(ILog log,
                                WindowTools windowTools,
                                ProcessMem processMem,
                                IComponentContext container,
                                IKeyHandler keyHandler)
        {
            _log         = log;
            _windowTools = windowTools;
            _processMem  = processMem;
            _container   = container;
            _keyHandler  = keyHandler;

            try
            {
                _game = _container.Resolve <IGame>();
                _log.Info("Found plugin for " + _game.name);
            }
            catch
            {
                _log.Fatal("Error - no plugins for any games found");
                return;
            }
            _log.Warn("Initializing plugin, please load " + _game.name);
            try
            {
                _process     = _windowTools.GetProcess(_game.exe, new TimeSpan(0, 1, 0))[0];
                _ui.gameName = _game.name;
            }
            catch
            {
                _log.Fatal("Error - unable to load game");
                return;
            }
        }
Esempio n. 6
0
        public override void LoadContent()
        {
            font = contentManager.Load <SpriteFont>("Fonts/BebasNeue_Small");

            //calculate drawing metrics one time only.
            //calculate the size of each line (x,y)
            Vector2[] lineSizes = lines.Select(line => font.MeasureString(line)).ToArray();
            //get their heights.
            float[] lineHeights = lineSizes.Select(size => size.Y).ToArray();
            //calculate a height offset - offset so that the strings are drawn centred about the midpoint of the screen
            // in the y axis.
            float   heightOffset   = ((lines.Length - 1) * lineSpacing + lineHeights.Sum(x => x / 2)) / 2;
            Vector2 screenMidPoint = WindowTools.WindowDimensions / 2;
            var     pos            = new List <Vector2>();

            for (int i = 0; i < lines.Length; i++)
            {
                //calculate the draw position using the midpoint, height offset and line spacings.
                pos.Add(screenMidPoint - new Vector2(lineSizes[i].X / 2, heightOffset - i * (lineSpacing - 1)));
            }
            drawPositions = pos.ToArray();

            continueText = $"Press {Keybinds.GetKey(Keybinds.Actions.Continue)} to continue...";
            continuePos  = WindowTools.PaddingToPixelCoordinate(0.5f, 0.95f, 0, 0) - font.MeasureString(continueText) / 2;
        }
Esempio n. 7
0
        public Load_ClientCaseSearch(Application application)
        {
            WindowTools windowTools  = new WindowTools();
            Window      window       = windowTools.GetWindow(application, SearchCriteria.ByAutomationId("HomeHealthDesktop"));
            Button      clientButton = windowTools.GetButton(window, SearchCriteria.ByText("Clients"));

            windowTools.DoubleClickIUItem(clientButton);
        }
Esempio n. 8
0
 public HotKeyHandler(ILog log
                      , WindowTools windowTools
                      , IGame game)
 {
     _game        = game;
     _log         = log;
     _windowTools = windowTools;
 }
Esempio n. 9
0
        private void Draw_TopLeftUI(SpriteBatch spriteBatch)
        {
            //Draw the win progress bar
            Vector2 barPos = characterDrawPos + new Vector2(uiScale * turnPlayer.CharacterSprite.Width / 2, 0f);

            PercentageBar.Draw(spriteBatch, emptyRect, barPos, winBarDimensions, turnPlayer.Colour, Color.Gray, turnPlayer.WinThreshold, turnPlayer.WinProgress);
            string text = $"{turnPlayer.WinProgress}/{turnPlayer.WinThreshold} Wins";

            spriteBatch.DrawString(bebasSmall, text, barPos + (winBarDimensions - 0.6f * bebasSmall.MeasureString(text)) / 2, Color.White, 0f, Vector2.Zero, 0.6f, SpriteEffects.None, 0f);

            //Draw the unit cap bar.
            Vector2 unitBarPos = barPos + new Vector2(0, winBarDimensions.Y);
            int     unitCount  = grid.CountPlayerUnitsOnGrid(turnPlayer.Id);

            PercentageBar.Draw(spriteBatch, emptyRect, unitBarPos, unitBarDimensions, Color.DarkRed, Color.YellowGreen, turnPlayer.UnitCap, unitCount);
            text = $"{unitCount}/{turnPlayer.UnitCap} Units";
            spriteBatch.DrawString(bebasSmall, text, unitBarPos + (unitBarDimensions - 0.5f * bebasSmall.MeasureString(text)) / 2, Color.White, 0f, Vector2.Zero, 0.5f, SpriteEffects.None, 0f);

            //Draw the players money amount.
            moneyBox.Draw(spriteBatch);
            string  moneyText = $"{turnPlayer.Money}";
            Vector2 textSize  = bebasSmall.MeasureString(moneyText);
            Vector2 basePos   = moneyBox.GetPos() + moneyBoxDimensions / 2;

            spriteBatch.DrawString(bebasSmall, moneyText, basePos - new Vector2(0, textSize.Y / 2), Color.White);
            spriteBatch.Draw(moneyIcon,
                             position: basePos + new Vector2(textSize.X + moneyBoxDimensions.X / 35, 0) - uiScale / 2 * new Vector2(0, moneyIcon.Height),
                             scale: uiScaleVector
                             );

            //Draw the player's character.
            spriteBatch.Draw(texture: characterBoundary, position: characterDrawPos - new Vector2(3 * uiScale, 0), scale: uiScaleVector, color: turnPlayer.Colour);
            spriteBatch.Draw(texture: turnPlayer.CharacterSprite, position: characterDrawPos, scale: uiScaleVector);

            //draw end turn button
            if (endTurnButton.IsHovered)
            {
                spriteBatch.Draw(texture: endTurnButton.HoverTexture, position: endTurnButton.Position, scale: uiScaleVector);
            }
            else
            {
                spriteBatch.Draw(texture: endTurnButton.ButtonTexture, position: endTurnButton.Position, scale: uiScaleVector);
            }
            spriteBatch.DrawString(bebasSmall, "End Turn", endTurnButton.MidPoint - 0.6f * bebasSmall.MeasureString("End Turn") / 2 + new Vector2(0, 1), Color.White, 0f, Vector2.Zero, 0.6f, SpriteEffects.None, 0);

            //draw the level up unit cap button.
            levelUnitCapButton.Draw(spriteBatch, turnPlayer, moneyIcon, WindowTools.GetUpscaledValue(2f), bebasSmall, 0.6f);

            //and the ability button
            useAbilityButton.Draw(spriteBatch, turnPlayer, bebasSmall, 0.6f);

            divisorLine.Draw(spriteBatch);

            stageInfo.Draw(spriteBatch, vsAiIcon, vsPlayerIcon);

            //help button
            helpButton.Draw(spriteBatch, bebasSmall, 1f);
        }
Esempio n. 10
0
 private void LoadContent_Boxes(ContentManager Content)
 {
     infoBoxes[0] = new SideDisplayBox(graphicsDevice, font, WindowTools.PaddingToPixelCoordinate(0f, 0.5f, 10, 0), WindowTools.WindowDimensions.X * 0.25f);
     infoBoxes[1] = new SideDisplayBox(graphicsDevice, font, WindowTools.PaddingToPixelCoordinate(1f, 0.5f, -10, 0), WindowTools.WindowDimensions.X * 0.25f);
     infoBoxes[0].SetAnchorPoint(0f, 0.5f);
     infoBoxes[1].SetAnchorPoint(1f, 0.5f);
     infoBoxes[0].SetPlayerName("Player 1");
     infoBoxes[1].SetPlayerName("Player 2");
 }
        public Preview()
        {
            InitializeComponent();
            var workArea = WindowTools.GetPrimaryScreen().WorkingArea;

            Left   = WindowTools.ConvertPixelsToDiPixels(workArea.Right) - Width;
            Top    = WindowTools.ConvertPixelsToDiPixels(workArea.Top);
            Height = WindowTools.ConvertPixelsToDiPixels(workArea.Height);
        }
Esempio n. 12
0
        private void LoadContent_Button(ContentManager Content)
        {
            //generate the pass turn button and assign a method to it.
            Texture2D passTurnButtonTexture = Content.Load <Texture2D>("PreparationTurn/EndTurnButton");
            Texture2D hoverTexture          = Content.Load <Texture2D>("PreparationTurn/EndTurnButtonHovered");

            passTurnButton = new SinglePressSpriteButton(WindowTools.PaddingToPixelCoordinate(0.5f, 0.6f, 0, 0) - (0.5f * uiScale * UiTools.BoundsToVector(passTurnButtonTexture.Bounds)), passTurnButtonTexture, hoverTexture, UiTools.CreateBoolMask(passTurnButtonTexture), uiScale);
            passTurnButton.buttonPressed += HandlePassTurnButtonPress;
        }
        void GridViewColumnHeaderClickedHandler(object sender, RoutedEventArgs e)
        {
            GridViewColumnHeader h = e.OriginalSource as GridViewColumnHeader;

            if ((h != null) && (h.Role != GridViewColumnHeaderRole.Padding))
            {
                WindowTools.SetSortColumn(lvTypes, (h.Column.DisplayMemberBinding as Binding).Path.Path);
            }
        }
Esempio n. 14
0
 private void LoadProcessedQueueItems(TimeSpan timeSpan)
 {
     lbLoading.Visibility = System.Windows.Visibility.Visible;
     WindowTools.Sleep(10);
     try {
         _sys.RetrieveProcessedQueueItems(timeSpan);
     } finally {
         lbLoading.Visibility = System.Windows.Visibility.Hidden;
     }
 }
Esempio n. 15
0
        public override void LoadContent()
        {
            largeFont = contentManager.Load <SpriteFont>("Fonts/BebasNeue");
            font      = contentManager.Load <SpriteFont>("Fonts/BebasNeue_Small");

            boundary = contentManager.Load <Texture2D>("CharacterSelect/Buttons/ButtonBoundaryLR");


            newGameText = $"Press {Keybinds.GetKey(Keybinds.Actions.Continue)} to start a new game or {Keybinds.GetKey(Keybinds.Actions.Exit)} to quit";
            newGamePos  = WindowTools.PaddingToPixelCoordinate(0.5f, 0.95f, 0, 0) - font.MeasureString(newGameText) / 2;
        }
Esempio n. 16
0
        public In_ClientCaseSearch_SelectClient(Application application, string clientName)
        {
            WindowTools   windowTools = new WindowTools();
            List <Window> windows     = windowTools.GetWindows(application);

            Window      window   = windowTools.GetWindow(windows, "ClientCaseSearch");
            ListView    listView = windowTools.GetListView(window, SearchCriteria.ByAutomationId("listView"));
            ListViewRow result   = windowTools.SelectListViewRowName(listView, clientName);

            Assert.IsNotNull(result, "Client Name Not Found In ClientCaseSearch List View.");
            windowTools.DoubleClickIUItem(result);
        }
Esempio n. 17
0
        private void OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            _ondrag = true;
            base.OnMouseLeftButtonDown(e);
            this.DragMove();

            Rectangle r = WindowTools.GetWindowRect("DcP10");

            _posX   = (Left - r.Left) / (r.Width / _scale);
            _posY   = (Top - r.Top) / (r.Height / _scale);
            _ondrag = false;
        }
Esempio n. 18
0
        public UnitShop(GraphicsDevice graphicsDevice, Player owner)
        {
            this.owner = owner;

            //generate the ui elements.
            Vector2 pos = WindowTools.PaddingToPixelCoordinate(1f, 0.5f, -10, 0);

            display = new UnitShopBox(this, graphicsDevice, capacity, pos);
            //anchor to the middle right as displayed on the right hand side of the screen.
            display.SetAnchorPoint(1f, 0.5f);
            FillShop();
        }
Esempio n. 19
0
        public Complete_EditCarePlan(Application application)
        {
            WindowTools   windowTools  = new WindowTools();
            UtilityTools  utilityTools = new UtilityTools();
            List <Window> windows      = application.GetWindows();
            Window        window       = windowTools.GetWindow(windows, "HomeHealthDesktop");
            CheckBox      activeBox;

            string[] dayCheckBoxes = new string[] { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" };

            List <IUIItem> checkBoxes = windowTools.GetIUIItemList <CheckBox>(window);

            foreach (string day in dayCheckBoxes)
            {
                activeBox         = windowTools.GetCheckBox(checkBoxes, day);
                activeBox.Checked = true;
            }

            activeBox         = windowTools.GetCheckBox(checkBoxes, "Evening");
            activeBox.Checked = true;


            //TreeView isn't really a treeView object, it's a GDI control (for some reason, I dunno)
            List <IUIItem> tabs         = windowTools.GetIUIItemList <Tab>(window);
            Tab            treeTab      = (Tab)tabs.Where(x => x.Id == "treeTabControl").FirstOrDefault();
            TabPage        ActivityTree = windowTools.GetTabPage(treeTab, "Activity Tree");

            ActivityTree.Select();

            window.Keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.TAB);
            window.Keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.DOWN);
            window.Keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.UP);
            window.Keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.SPACE);
            window.Keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.DOWN);
            window.Keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.DOWN);
            window.Keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.DOWN);
            window.Keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.RIGHT);
            window.Keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.DOWN);
            window.Keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.SPACE);

            //ApplyButton cannot be found, (all right orientated buttons on toolStrip1 are not available) so click coordinate required
            Point ApplyButton = new Point(1544, 114);

            windowTools.MouseClickPoint(window, ApplyButton);

            //SaveButton cannot be found, (all right orientated buttons on toolStrip1 are not available) so click coordinate required
            Point SaveButton = new Point(1739, 114);

            windowTools.MouseClickPoint(window, SaveButton);

            windowTools.waitForLoadingWindowToClose(application, 1);
        }
        public In_Desktop_Use_ClientNoteBook_Load_EditCarePlan(Application application)
        {
            WindowTools    windowTools = new WindowTools();
            List <Window>  windows     = windowTools.GetWindows(application);
            Window         window      = windowTools.GetWindow(windows, "HomeHealthDesktop");
            List <IUIItem> tabs        = windowTools.GetIUIItemList <Tab>(window);
            Tab            tab         = (Tab)tabs[1]; //tabs have generic name tabControl, requires ordinal selection

            windowTools.GetAndSelectTabPage(tab, "Services / Care Plans");
            Button EditCarePlan = windowTools.GetButton(window, "Edit Care Plan");

            windowTools.DoubleClickIUItem(EditCarePlan);
        }
Esempio n. 21
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            base.Draw(spriteBatch);
            spriteBatch.Begin();
            spriteBatch.Draw(subScreens[currentScreen], position: Vector2.Zero);

            string  navigateText = $"(Right Click) <-- {currentScreen+1}/{subScreens.Length} --> (Left  Click)";
            Vector2 size         = font.MeasureString(navigateText);
            Vector2 pos          = WindowTools.PaddingToPixelCoordinate(0.5f, 0.95f, 0, 0) - size / 2;

            spriteBatch.DrawString(font, navigateText, pos, Color.White);
            spriteBatch.End();
        }
Esempio n. 22
0
        public void WaitForSteamPrompt()
        {
            Thread.Sleep(500);
            var promptWindow = GetSteamPromptWindow();

            WindowTools.FocusWindow(promptWindow);

            while (promptWindow != IntPtr.Zero)
            {
                Thread.Sleep(10);
                promptWindow = GetSteamPromptWindow();
            }
        }
Esempio n. 23
0
        private void frmViewSubscriptions_SourceInitialized(object sender, EventArgs e)
        {
            SbmqSystem.UIState.RestoreWindowState(this);
            SbmqSystem.UIState.RestoreControlState(cbServer, _sys.Config.CurrentServer.ConnectionSettings);

            //LoadSubscriptionTypes();

            BindServers();

            lvTypes.ItemsSource = _items;

            tbFilter.Focus();
            WindowTools.SetSortColumn(lvTypes, "Name");
        }
Esempio n. 24
0
        public In_Desktop_Use_ClientNoteBook_Load_CalendarService(Application application)
        {
            WindowTools    windowTools = new WindowTools();
            List <Window>  windows     = windowTools.GetWindows(application);
            Window         window      = windowTools.GetWindow(windows, "HomeHealthDesktop");
            List <IUIItem> tabs        = windowTools.GetIUIItemList <Tab>(window);
            UtilityTools   ut          = new UtilityTools();

            tabs = windowTools.GetIUIItemList <Tab>(window);
            Tab tab = (Tab)tabs[1]; //tabs have generic name tabControl, requires ordinal selection

            windowTools.GetAndSelectTabPage(tab, "Calendar of Service");
            windowTools.waitForLoadingWindowToClose(application, 1);
        }
        public ViewSubscriptionsWindow(SbmqSystem system)
        {
            InitializeComponent();

            _sys = system;

            Topmost = SbmqSystem.UIState.AlwaysOnTop;

            BindServers();

            lvTypes.ItemsSource = _items;

            WindowTools.SetSortColumn(lvTypes, "Name");
        }
Esempio n. 26
0
        public object CreateObject()
        {
            if (IsValid)
            {
                int panelCount = _panels.Count;

                while (_panels.Count > 1) // Save all sub objects
                {
                    var       p        = _panels.Pop() as StackPanel;
                    PanelInfo pi       = p.Tag as PanelInfo;
                    object    instance = null;

                    try {
                        instance = CreateTypeInstance(p);
                    } catch (FailedDeserializingCommandException ex) {
                        if (!ShowDiscardCommandChangesDialog(ex))
                        {
                            _panels.Push(p);
                            return(null);
                        }
                        else
                        {
                            instance = pi.InitialObject;
                        }
                    }

                    var currPanel = _panels.Peek() as StackPanel;

                    SetAttributeValue(currPanel, pi.AttributeName, instance);
                }

                if (panelCount > 1) // Scroll back to Main Panel
                {
                    var scrollTime = panelCount * 120;
                    ScrollToMainPanel(() => {
                        theStack.Children.OfType <StackPanel>().
                        Where(s => s.Tag != _mainPanel.Tag).
                        ForEach(s => s.Visibility = Visibility.Hidden);
                    }, scrollTime);
                    WindowTools.Sleep(scrollTime);
                }


                return(CreateTypeInstance(_mainPanel));
            }
            else
            {
                return(null);
            }
        }
        public Login(Application application)
        {
            WindowTools    windowTools     = new WindowTools();
            Window         window          = windowTools.GetWindow(application, "Login");
            WinFormTextBox usernameTextBox = windowTools.GetIUIItem <WinFormTextBox>(window, SearchCriteria.ByAutomationId("username"));
            WinFormTextBox passwordTextBox = windowTools.GetIUIItem <WinFormTextBox>(window, SearchCriteria.ByAutomationId("password"));
            Button         okButton        = windowTools.GetButton(window, SearchCriteria.ByAutomationId("okButton"));


            windowTools.ClickIUIItem(usernameTextBox);
            windowTools.PostText(usernameTextBox, username);
            windowTools.ClickIUIItem(passwordTextBox);
            windowTools.PostText(passwordTextBox, password);
            windowTools.DoubleClickIUItem(okButton);
        }
Esempio n. 28
0
        private void LoadContent_Buttons(ContentManager Content)
        {
            //generating button for each available character.
            Vector2 prevDrawCoordinate = buttonGridOrigin;
            Vector2 translation;

            for (int i = 0; i < uiButtons.Length; i++)
            {
                //get the directory of respective button textures for characters from the ID;
                Type   characterReference = CharacterLinker.GetCharacterReference(i);
                string directory          = (string)characterReference.GetField("SpriteReference").GetRawConstantValue();
                //load the button texture(s)
                Texture2D tex     = Content.Load <Texture2D>(directory);
                Texture2D outline = Content.Load <Texture2D>("CharacterSelect/Buttons/Outline");

                //create mask
                bool[,] mask = UiTools.CreateBoolMask(tex);
                //generate draw position
                if ((i & 1) == 1)   //if odd number
                {
                    translation = buttonTesselateVector;
                }
                else
                {
                    translation = new Vector2(buttonTesselateVector.X, -buttonTesselateVector.Y);
                }
                //instantiate button
                uiButtons[i] = new CharSelectButton(i, prevDrawCoordinate + (buttonScale * translation), tex, outline, mask, buttonScale);
                //update the draw coordinate for tesselation.
                prevDrawCoordinate = prevDrawCoordinate + (buttonScale * translation);

                //attach event handler to button
                uiButtons[i].buttonPressed += HandleButtonPress;
            }

            //generate help button
            helpButton = new TutorialButton(graphicsDevice, this,
                                            WindowTools.PaddingToPixelCoordinate(0, 0, 10, 10),
                                            (int)(20 * buttonScale),
                                            (int)(10 * buttonScale));

            //generating confirm button
            Texture2D confirmButtonTexture = Content.Load <Texture2D>("PreparationTurn/EndTurnButton");
            Texture2D confirmButtonOutline = Content.Load <Texture2D>("PreparationTurn/EndTurnButtonHovered");

            confirmButton = new CharSelectConfirmButton(WindowTools.PaddingToPixelCoordinate(0.45f, 0.6f, 0, 0) - buttonScale / 2 * new Vector2(confirmButtonTexture.Width, 0), confirmButtonTexture, confirmButtonOutline, UiTools.CreateBoolMask(confirmButtonTexture), buttonScale * 2);
            confirmButton.buttonPressed += HandleButtonPress;
        }
        public SelectFacility(Application application, string facilityName)
        {
            WindowTools windowTools = new WindowTools();

            Window      window = windowTools.GetWindow(application, "Select Facility");
            RadioButton facilityRadioButton = windowTools.GetRadioButton(window, SearchCriteria.ByAutomationId("facilityRadioButton"));

            windowTools.ClickIUIItem(facilityRadioButton);
            ListBox facilityFilter = windowTools.GetListBox(window, SearchCriteria.ByAutomationId("ListBox"));

            windowTools.SelectListBoxItem(facilityFilter, "Any");
            ListView    facilityList = windowTools.GetListView(window, SearchCriteria.ByAutomationId("listView"));
            ListViewRow row          = windowTools.SelectListViewRowName(facilityList, facilityName);

            windowTools.DoubleClickIUItem(row);
        }
Esempio n. 30
0
        public SelectDataTypeDialog(SbmqSystem system, string[] asmPaths)
        {
            InitializeComponent();

            _asmPaths = asmPaths;

            Topmost = SbmqSystem.UIState.AlwaysOnTop;

            LoadTypes();

            lvTypes.ItemsSource = _types;

            WindowTools.SetSortColumn(lvTypes, "Name", ListSortDirection.Ascending);

            tbFilter.Focus();
        }