Example #1
0
    private TileButton TileCloseToPoint(Vector2 point)
    {
        var t = Camera.main.ScreenToWorldPoint(point);

        t.z = 0;

        var        minDistance = 0.5f;
        TileButton closestTile = null;

        foreach (var tile in tiles)
        {
            if (!tile.gameObject.activeSelf)
            {
                continue;
            }
            var distanceToTouch = Vector2.Distance(tile.transform.position, t);
            if (distanceToTouch < minDistance)
            {
                minDistance = distanceToTouch;
                closestTile = tile;
            }
        }

        return(closestTile);
    }
Example #2
0
    public void ShowWord(string word)
    {
        ClearPanel();

        var scrambledWord  = ScrambleDictionary.Instance.ScrambleWord(word);
        var scrambledTiles = new TileButton[word.Length];

        for (var i = 0; i < word.Length; i++)
        {
            scrambledTiles [i] = tiles [i];
            scrambledTiles [i].SetTileData(scrambledWord [i]);

            if (Random.Range(0, 10) > 5)
            {
                tiles [i].transform.Rotate(Vector3.forward * Random.Range(-45, 46));
            }
            else
            {
                tiles [i].transform.Rotate(Vector3.back * Random.Range(-45, 46));
            }
        }

        scrambledTiles = Utils.Scramble <TileButton> (scrambledTiles);


        Utils.StaggerAndCall <TileButton> (this, 0.06f, (TileButton go) => { go.gameObject.SetActive(true); }, new List <TileButton> (scrambledTiles));
    }
Example #3
0
    /* =================================================================================================
     * Function             :               changeTileType
     * Purpose              :               Set the selected tile
     * ===============================================================================================*/
    public void changeTileType(TileButton button)
    {
        //Set tile to selected button
        tileType = button.myTileType;

        if (tileType == TileType.ASTAR)
        {
            delay   = 0.0f;
            current = null;
            path    = null;
            AStarAlgorithm();
        }

        if (tileType == TileType.BFS)
        {
            delay = 0.0f;
            BFSearch(/*new Node(startPos), new Node(goalPos)*/);
        }

        if (tileType == TileType.BI)
        {
            delay = 0.0f;
            BiSearch(/*new Node(startPos), new Node(goalPos)*/);
        }

        if (tileType == TileType.RESET)
        {
            AStarDebugger.myInstance.clearBoard(openList, closedList, visited, path);
        }
    }
        /// <summary>Implementation of the abstract method SetUpGrid.</summary>
        protected override void SetUpGrid()
        {
            int    width      = this.tileset.SizeWidth();
            int    height     = this.tileset.SizeHeight();
            int    spriteSize = this.tileset.TileSize();
            ushort i          = 0;

            ClearGrid();

            // Verify all the options to see if throws any exception.
            try
            {
                for (int y = 0; y < height; y += spriteSize)
                {
                    for (int x = 0; x < width; x += spriteSize, i++)
                    {
                        TileButton btn = NewButton(null, spriteSize);
                        btn.Click += new EventHandler(ButtonClickEventHandler);
                        grid.Add(btn);
                        tiles.Add(null);
                        btn.Index = i;

                        if (parent != null)
                        {
                            parent.Controls.Add(btn);
                            btn.Location = new Point(x, y);
                        }
                    }
                }
            }
            catch (IndexOutOfRangeException) {
                throw new ConvertException(Vocab.GetText("sizeNotMatchErrorMsg"));
            }
        }
Example #5
0
        private void CreateWindow(TileCollection tiles)
        {
            Width  = tiles.Width;
            Height = tiles.Height;

            for (var i = 0; i < tiles.Columns; i++)
            {
                MainGrid.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(1, GridUnitType.Star)
                });
            }
            for (var i = 0; i < tiles.Rows; i++)
            {
                MainGrid.RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(1, GridUnitType.Star)
                });
            }

            for (var row = 0; row < tiles.Rows; row++)
            {
                for (var col = 0; col < tiles.Columns; col++)
                {
                    var tile = tiles.FirstOrDefault(t => t.Column == col && t.Row == row);
                    if (tile == null)
                    {
                        var id = tiles.Count > 0 ? tiles.Max(t => t.Id) + 1 : 0;
                        tile = new AppTile(id, col, row);
                        tiles.Add(tile);
                    }
                    var button = new TileButton(tile, this);
                    MainGrid.Children.Add(button);
                }
            }
        }
Example #6
0
    public void HandleTouchMove(Vector2 touch)
    {
        if (selectedTile == null)
        {
            return;
        }


        var nextTile = TileCloseToPoint(touch);


        if (nextTile != null && nextTile != selectedTile && nextTile.touched)
        {
            selectedTile = nextTile;

            selectedTile.Select(true);

            if (!selectedTiles.Contains(selectedTile))
            {
                selectedTiles.Add(selectedTile);
            }

            SubmitTile();
        }
    }
Example #7
0
        private TileButton _tile_button;              // the button that need to be modified

        public Node(int x, int y, int z, TileButton tile_button_)
        {
            _tile_button  = tile_button_;
            is_fixed      = false;
            is_true       = false;
            is_propagated = false;
            time          = InvalidInt;
            coord         = new UTL.Coord3(x, y, z);
            neighbour_ids = new int[NumNeighbours];
            cluster_ids   = new int[4];
            int idx = 0;

            for (int xi = 0; xi < Length; ++xi)
            {
                if (xi == x)
                {
                    continue;
                }
                neighbour_ids[idx] = UTL.CoordToIdx(xi, y, z);
                ++idx;
            }
            for (int yi = 0; yi < Length; ++yi)
            {
                if (yi == y)
                {
                    continue;
                }
                neighbour_ids[idx] = UTL.CoordToIdx(x, yi, z);
                ++idx;
            }
            for (int zi = 0; zi < Length; ++zi)
            {
                if (zi == z)
                {
                    continue;
                }
                neighbour_ids[idx] = UTL.CoordToIdx(x, y, zi);
                ++idx;
            }
            for (int yi = (y / RootLength) * RootLength; yi < (y / RootLength + 1) * RootLength; ++yi)
            {
                if (yi == y)
                {
                    continue;
                }
                for (int xi = (x / RootLength) * RootLength; xi < (x / RootLength + 1) * RootLength; ++xi)
                {
                    if (xi == x)
                    {
                        continue;
                    }
                    neighbour_ids[idx] = UTL.CoordToIdx(xi, yi, z);
                    ++idx;
                }
            }
            cluster_ids[0] = UTL.CoordToIdx(y, z);
            cluster_ids[1] = UTL.CoordToIdx(x, z) + Area;
            cluster_ids[2] = UTL.CoordToIdx(x, y) + Area * 2;
            cluster_ids[3] = UTL.CoordToIdx((x / RootLength) + RootLength * (y / RootLength), z) + Area * 3;
        }
 private void ShowAllTiles()
 {
     foreach (var obj in CozyTiledFactory.GetTiles())
     {
         ContentControl control = null;
         if (obj.Value is CozyColorTile)
         {
             var ColorTile = obj.Value as CozyColorTile;
             var color     = ColorTile.ColorProperty;
             control = new SampleButton(0, 0)
             {
                 PreferredHeight = 32,
                 PreferredWidth  = 32,
                 Background      = new Starbound.UI.SBColor(color.R, color.G, color.B),
                 Foreground      = new Starbound.UI.SBColor(color.R, color.G, color.B),
             };
         }
         else if (obj.Value is CozySpriteTiled)
         {
             var SpriteTile = obj.Value as CozySpriteTiled;
             control = new TileButton(SpriteTile.Texture, SpriteTile.Rect);
         }
         if (control != null)
         {
             tilesPanel.AddChild(control, () => { CurrentTiledId = obj.Key; });
         }
     }
 }
Example #9
0
 public void HandleTouchUp(Vector2 touch)
 {
     if (selectedTile != null)
     {
         selectedTile.Select(false);
         SubmitTile();
     }
     selectedTile = null;
 }
Example #10
0
    public void HandleTouchDown(Vector2 touch)
    {
        selectedTile = TileCloseToPoint(touch);

        if (selectedTile != null)
        {
            selectedTile.Select(true);
            selectedTiles.Add(selectedTile);
            SubmitTile();
        }
    }
Example #11
0
    public void PrintButtons()
    {
        //buttonContainer.CleanUp();

        foreach (string k in currTileTypes.DbKeys())
        {
            // print the
            TileButton b = Instantiate <TileButton>(tileButton, buttonContainer.contentTransform);
            b.InitTileButton(k, this);
            buttonContainer.AddToList(b);
        }
    }
Example #12
0
        /// <summary>
        /// Selects a tile
        /// </summary>
        /// <param name="sender">Tile button</param>
        /// <param name="e">event</param>
        private void TileSelection(object sender, EventArgs e)
        {
            TileButton button = (TileButton)sender;

            if (button.TileId >= buttons.Count)
            {
                return;
            }
            selectedImage  = level.Maps[button.MapId].SliceTileMap()[button.TileId];
            selectedTileID = button.TileId;
            selectedMapID  = button.MapId;
        }
Example #13
0
    public void HandleTouchDown(Vector2 touch)
    {
        if (selectedTile != null)
        {
            selectedTile.Select(false);
        }

        selectedTile = TileCloseToPoint(touch);

        if (selectedTile != null)
        {
            selectedTile.Select(true);
        }
    }
        /// <summary>Implementation of the abstract method SetUpGrid.</summary>
        protected override void SetUpGrid()
        {
            int width      = tileset.SizeWidth();
            int height     = tileset.SizeHeight();
            int spriteSize = tileset.TileSize();

            if (width == -1)
            {
                width = tilesetImage.Width;                // custom
            }
            if (height == -1)
            {
                height = tilesetImage.Height;               // XP and custom
            }
            if (spriteSize <= 0)
            {
                throw new ConvertException(Vocab.GetText("sizeIsZeroErrorMsg"));
            }

            Bitmap[] tiles = SplitImageInSprites(tilesetImage, tileset.TileSize());

            ClearGrid();
            ushort i = 0;

            // Verify all the options to see if throws any exception.
            try
            {
                for (int y = 0; y < height; y += spriteSize)
                {
                    for (int x = 0; x < width; i++, x += spriteSize)
                    {
                        TileButton btn = NewButton(tiles[i], spriteSize);
                        btn.Click += new EventHandler(ButtonClickEventHandler);
                        grid.Add(btn);
                        this.tiles.Add(tiles[i]);
                        btn.Index = i;

                        if (parent != null)
                        {
                            parent.Controls.Add(btn);
                            btn.Location = new Point(x, y);
                        }
                    }
                }
            }
            catch (IndexOutOfRangeException)
            {
                throw new ConvertException(Vocab.GetText("sizeNotMatchErrorMsg"));
            }
        }
Example #15
0
    public void HandleTouchUp(Vector2 touch)
    {
        if (selectedTile == null)
        {
            return;
        }

        if (selectedTiles.Count > 2)
        {
            SubmitWord();
        }
        ClearSelection();

        selectedTile = null;
    }
Example #16
0
    //Select tile type to change tile to.
    public void ChangeTileType(TileButton button)
    {
        Color buttonColor = button.GetComponent <Image>().color;

        if (buttonColor == Color.white)
        {
            button.GetComponent <Image>().color = Color.red;
            tileType     = button.myTileType;
            currTileType = (int)tileType;
            if (prevButton != null)
            {
                prevButton.GetComponent <Image>().color = Color.white;
            }
            prevButton = button;
        }
    }
Example #17
0
        /// <summary>
        /// Add a new tilemap
        /// </summary>
        /// <param name="path">Path to the tilemap</param>
        /// <param name="size">Size of the tiles</param>
        public void AddTileMap(string path, int size)
        {
            TileMap map = new TileMap(path, size);

            List <Image> images = map.SliceTileMap();

            for (int j = 0; j < images.Count; j++)
            {
                TileButton tileButton = new TileButton(j, level.Maps.Count, images[j])
                {
                    Width  = tileButtonSize,
                    Height = tileButtonSize
                };
                tileButton.Click += TileSelection;
                buttons.Add(tileButton);
            }
            level.AddAMap(map);
            SetTileButtons();
        }
Example #18
0
    private void MakeButton(int x, string line)
    {
        string[] type = line.Split(',');

        if (type.Length != 4)
        {
            return;
        }

        string      asset = type[0];
        TileType    tp    = (TileType)Enum.Parse(typeof(TileType), type[1]);
        TextureType tt    = (TextureType)Enum.Parse(typeof(TextureType), type[2]);
        TileObject  to    = (TileObject)Enum.Parse(typeof(TileObject), type[3]);

        TileButton button = new TileButton(asset, tp, tt, to);

        button.Position = new Vector2(x, 10);
        Add(button);
    }
        public TileSelectionViewModel()
        {
            _model = Model.Model.Instance;

            TilePanel = new WrapPanel();
            DecorationPanel = new WrapPanel();

            LevelEditorDatabaseDataContext db = new LevelEditorDatabaseDataContext();
            IOrderedQueryable<ImagePath> imagePaths =
                (from a in db.ImagePaths orderby a.Id select a);
            db.Connection.Close();

            foreach (ImagePath ip in imagePaths)
            {
                if (ip.Path.Contains("/Terrain/"))
                {
                    if (ip.Description.Contains("Mid") || (ip.Description.Contains("Hill Left") &! ip.Description.Contains("Corner")))
                    {
                        TileButton tileButton = new TileButton((ushort) (ip.Id - 1), ip.Description)
                        {
                            Background = Brushes.Transparent,
                            BorderThickness = new Thickness(0)
                        };

                        tileButton.AddHandler(UIElement.MouseDownEvent, (RoutedEventHandler) SelectTile);
                        tileButton.Click += SelectTile;

                        TilePanel.Children.Add(tileButton);
                    }
                } else if (ip.Description.Contains("Object"))
                {
                    TileButton tileButton = new TileButton((ushort) (ip.Id - 1), ip.Description)
                    {
                        Background = Brushes.Transparent,
                        BorderThickness = new Thickness(0)
                    };

                    tileButton.AddHandler(UIElement.MouseDownEvent, (RoutedEventHandler)SelectTile);
                    tileButton.Click += SelectTile;
                    DecorationPanel.Children.Add(tileButton);
                }
            }
        }
Example #20
0
    public virtual void Initalize(GameObject button, PathNode node, Vector2Int gridPos)
    {
        if (!initialized)
        {
            gridButton = button.GetComponent <TileButton>();
            UpdateGridButtonPosition();
            gridButton.Deactivate();

            onEnter    = new TileEvent();
            onExit     = new TileEvent();
            onActivate = new TileEvent();

            neighbors    = new Dictionary <Direction, GridSpace>();
            pathNode     = node;
            gridPosition = gridPos;
            SetUpToolTips();

            initialized = true;
        }
    }
Example #21
0
        protected override void UpdateSelf()
        {
            Player plr = GameLoop.MyPlayer;

            EntityButton.UpdateText($"{plr.SelectedEntityType}");

            TileButton.UpdateText($"{(TileType)plr.SelectedTile}");

            rightTile.SetPosition(new Vector2(34 + TileButton.ScaledWidth, 60));

            rightEntity.SetPosition(new Vector2(34 + EntityButton.ScaledWidth, 10));

            if (!plr.HasActions)
            {
                actionText.SetText($"{plr.Findtile(InputManager.MouseScreenPosition).SubTiles[0, 0]}" +
                                   $"{plr.Findtile(InputManager.MouseScreenPosition).SubTiles[0, 1]}" +
                                   $"{plr.Findtile(InputManager.MouseScreenPosition).SubTiles[1, 0]}" +
                                   $"{plr.Findtile(InputManager.MouseScreenPosition).SubTiles[1, 1]}");
            }
        }
Example #22
0
    public void SelectTile(TileButton button)
    {
        //Cleanup prev obj
        if (cursorObj != null)
        {
            GameObject.Destroy(cursorObj);
        }
        if (currentButton != null)
        {
            currentButton.SetSelected(false);
        }

        //Set tile
        currentButton = button;
        currentTile   = currentButton != null?button.GetTile() : null;

        //Load new obj
        if (currentTile != null)
        {
            cursorObj = GameObject.Instantiate(currentTile.gameObject);
            mouseMode = MouseMode.PAINT;
        }
    }
Example #23
0
 //changes tiletype
 public void ChangeTileType(TileButton button) //changes the game tiletype to the button pressed
 {
     tiletype = button.MyTileType;             //changes the game tiletype to the button pressed
 }
Example #24
0
        /// <summary>
        /// New LeverEditor
        /// </summary>
        public LevelEditor()
        {
            //Initialization
            InitializeComponent();
            Bounds = Screen.AllScreens[0].Bounds;
            AdjustSize();
            DoubleBuffered = true;
            SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            panel1.Paint += Panel1_Paint;
            SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer, true);
            cam = new Camera(5, 3, 14, 10)
            {
                FovX = (panel1.Width - panel1.Width / 20) / 75,
                FovY = (panel1.Height - panel1.Height / 20) / 75
            };
            level = new Level();

            //set scrollbar sizes
            hScrollBar1.Maximum = gridW + 5;
            hScrollBar1.Minimum = 5;
            vScrollBar1.Maximum = gridH + 5;
            vScrollBar1.Minimum = 3;

            //Button initialization
            newLevelButton  = InitializeButton(panel2, 1, "New Level", -65);
            saveLevelButton = InitializeButton(panel2, 2, "Save Level", -70);
            loadLevelButton = InitializeButton(panel2, 3, "Load Level", -75);

            //Buttons added to the panel
            panel2.Controls.Add(newLevelButton);
            panel2.Controls.Add(saveLevelButton);
            panel2.Controls.Add(loadLevelButton);


            //Create tile buttons
            buttons = new List <TileButton>();

            for (int i = 0; i < level.Maps.Count; i++)
            {
                List <Image> images = level.Maps[i].SliceTileMap();
                for (int j = 0; j < images.Count; j++)
                {
                    TileButton tileButton = new TileButton(j, i, images[j])
                    {
                        Width  = tileButtonSize,
                        Height = tileButtonSize
                    };
                    tileButton.Click += TileSelection;
                    buttons.Add(tileButton);
                }
            }
            SetTileButtons();

            //Add eraseselection
            eraseSelection = new CheckBox()
            {
                Text     = "Erase",
                Location = new Point(10, panel3.Location.Y - 25)
            };
            panel2.Controls.Add(eraseSelection);

            //Add layer controls
            layerSelection = new NumericUpDown()
            {
                Location = new Point(25, newLevelButton.Height * 2),
                Width    = 50,
                Value    = 0,
                Minimum  = 0,
                Maximum  = level.Layers.Count
            };
            newLayerButton = new Button()
            {
                Location = new Point(100, newLevelButton.Height * 2),
                Text     = "Add a layer",
                Width    = 100
            };
            deleteLayerButton = new Button()
            {
                Location = new Point(200, newLevelButton.Height * 2),
                Text     = "Remove a layer",
                Width    = 100
            };

            newLayerButton.Click    += LayerButtonClick;
            deleteLayerButton.Click += LayerButtonClick;
            panel2.Controls.Add(layerSelection);
            panel2.Controls.Add(newLayerButton);
            panel2.Controls.Add(deleteLayerButton);

            //Add tileMap controls
            addMapButton = new Button()
            {
                Width  = 100,
                Height = 25,
                Text   = "Add new TileMap",
            };
            addMapButton.Location = new Point(eraseSelection.Location.X + eraseSelection.Width, panel3.Location.Y - 30);
            addMapButton.Click   += AddTileMapButtonClick;
            panel2.Controls.Add(addMapButton);

            //Add default objects
            AddNewLayer();
            DrawMiniMap();

            panel1.Invalidate();
        }
Example #25
0
        /// <summary>
        /// Handles the button presses
        /// </summary>
        /// <param name="sender">Button, which was pressed</param>
        /// <param name="e">event</param>
        private void HandleButtonClick(object sender, EventArgs e)
        {
            if (sender == newLevelButton)
            {
                level = new Level();
                AddNewLayer();
                DrawMiniMap();
                buttons.Clear();
                layerSelection.Value = 0;
                panel1.Invalidate();
                SetTileButtons();
            }

            else if (sender == loadLevelButton)
            {
                OpenFileDialog openFile = new OpenFileDialog();
                Dictionary <int, List <Image> > maps = new Dictionary <int, List <Image> >();

                if (openFile.ShowDialog() == DialogResult.OK)
                {
                    Level newLevel = FileHandler.LoadLevel(openFile.FileName);
                    level = newLevel;

                    for (int i = 0; i < level.Maps.Count; i++)
                    {
                        TileMap      map    = level.Maps[i];
                        List <Image> images = map.SliceTileMap();

                        maps.Add(i, images);

                        for (int j = 0; j < images.Count; j++)
                        {
                            TileButton tileButton = new TileButton(j, i, images[j])
                            {
                                Width  = tileButtonSize,
                                Height = tileButtonSize
                            };
                            tileButton.Click += TileSelection;
                            buttons.Add(tileButton);
                        }
                    }

                    SetTileButtons();

                    foreach (Layer layer in level.Layers)
                    {
                        foreach (Tile tile in layer.Tiles)
                        {
                            tile.LoadImage(maps);
                        }
                    }

                    for (int i = 0; i < gridW; i++)
                    {
                        for (int j = 0; j < gridH; j++)
                        {
                            foreach (Layer layer in level.Layers)
                            {
                                Tile newTile = null;
                                foreach (Tile tile in layer.Tiles)
                                {
                                    if (tile.X == i && tile.Y == j)
                                    {
                                        newTile = tile;
                                    }
                                }
                                if (newTile != null)
                                {
                                    continue;
                                }

                                newTile = new Tile(i, j);
                                layer.AddTile(newTile);
                            }
                        }
                    }

                    layerSelection.Maximum = level.Layers.Count - 1;
                    layerSelection.Value   = 0;
                    DrawMiniMap();

                    panel1.Invalidate();
                }
            }

            else if (sender == saveLevelButton)
            {
                SaveFileDialog saveFile = new SaveFileDialog();
                if (saveFile.ShowDialog() == DialogResult.OK)
                {
                    FileHandler.SaveLevel(level, saveFile.FileName);
                }
            }
        }
Example #26
0
 public void ChangeTileType(TileButton button)
 {
     tileType = button.MyTileType;
 }
Example #27
0
        public Main()
        {
            InitializeComponent();
            this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;

            System.Drawing.Icon windowIcon;
            Stream iconStream = Application.GetResourceStream(new Uri("pack://application:,,,/PuckControl;component/Assets/pcIcon.ico")).Stream;

            windowIcon = new System.Drawing.Icon(iconStream);

            _sparkle = new Sparkle("http://www.headsup.technology/download/betaupdates", windowIcon);
            _sparkle.StartLoop(true);

            _engine      = new GameEngine();
            _debugWindow = new DebugWindow(_engine);
            _debugWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
            _newUserWindow = new NewUser();
            _newUserWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
            _gameWindow       = new Game(_engine);
            _highScoresWindow = new HighScores(_engine);
            _highScoresWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
            _settingsWindow = new Settings(_engine, _engine.SettingsRepository);
            _settingsWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;

            this.Closing += MainWindow_Closing;

            _games = FindGames();

            foreach (IGame gameType in _games)
            {
                IGame game = (IGame)Activator.CreateInstance(gameType.GetType());

                if (String.IsNullOrWhiteSpace(game.Name))
                {
                    continue;
                }

                TileButton tileButton = new TileButton();
                tileButton.BackgroundBrush = new SolidColorBrush(game.TileColor);
                tileButton.ButtonLabel     = game.Name;
                tileButton.DataContext     = tileButton;

                tileButton.Click += (s, e) =>
                {
                    _engine.LoadGame(gameType);
                    _gameWindow.Visibility = System.Windows.Visibility.Visible;
                    _gameWindow.Owner      = this;
                    this.Visibility        = System.Windows.Visibility.Hidden;
                    _engine.StartGame();
                };

                GameList.Children.Add(tileButton);
            }

            _engine.GameOver += _engine_GameOver;
            _engine.Users.CollectionChanged += (s, e) => { PopulateUserSelectionList(); };

            try
            {
                _engine.Init();
            }
            catch (NotSupportedException ex)
            {
                System.Windows.MessageBox.Show(ex.Message, "An error occured", MessageBoxButton.OK);
            }

            this.KeyDown         += MainWindow_KeyDown;
            this.ContentRendered += (s, e) =>
            {
                _newUserWindow.Owner = this;
                if (_engine.Users.Count() == 0)
                {
                    ShowNewUserDialog();
                }
                else
                {
                    PopulateUserSelectionList();
                }
            };

            this.Activated += Main_Activated;
        }
 public SetSelectedTileAction(TileButton button)
 {
     this.button = button;
 }
Example #29
0
 public static void StartNew(TileButton sender, Point pos)
 {
     _sender            = sender;
     _mouseDownPosition = pos;
 }
Example #30
0
 public static void ResetAll()
 {
     ResetPosition();
     _sender = null;
 }
        private void CreateTiles()
        {
            this.DeviceTileControl.TileButtons.Clear();
            if (ObjectHolder.CurrentUser == null)
            {
                return;
            }
            TileButton expr_1D = new TileButton();

            expr_1D.Tag     = "ios";
            expr_1D.Content = CyberGhost.Translations.Home.HeadlineManageDevicesIos;
            expr_1D.set_TileDescription(CyberGhost.Translations.Home.ContentManageDevicesIos);
            expr_1D.set_TileImageSource(this._iosLogoUri);
            expr_1D.set_TileBaseColor((Color)base.FindResource("DeviceTileBackgroundColor"));
            expr_1D.set_TileGradientColor((Color)base.FindResource("DeviceTileBackgroundGradient"));
            expr_1D.set_ImageStyle(base.FindResource("DeviceTileImage") as Style);
            TileButton tileButton = expr_1D;

            tileButton.Click += new RoutedEventHandler(this.OsTile_Click);
            this.DeviceTileControl.TileButtons.Add(tileButton);
            TileButton expr_B5 = new TileButton();

            expr_B5.Tag     = "macos";
            expr_B5.Content = CyberGhost.Translations.Home.HeadlineManageDeviceMacOs;
            expr_B5.set_TileDescription(CyberGhost.Translations.Home.ContentManageDeviceMacOs);
            expr_B5.set_TileImageSource(this._macosLogoUri);
            expr_B5.set_TileBaseColor((Color)base.FindResource("DeviceTileBackgroundColor"));
            expr_B5.set_TileGradientColor((Color)base.FindResource("DeviceTileBackgroundGradient"));
            expr_B5.set_ImageStyle(base.FindResource("DeviceTileImage") as Style);
            TileButton tileButton2 = expr_B5;

            tileButton2.Click += new RoutedEventHandler(this.OsTile_Click);
            this.DeviceTileControl.TileButtons.Add(tileButton2);
            TileButton expr_14D = new TileButton();

            expr_14D.Tag     = "windows";
            expr_14D.Content = CyberGhost.Translations.Home.HeadlineManageDeviceWin;
            expr_14D.set_TileDescription(CyberGhost.Translations.Home.ContentManageDeviceWin);
            expr_14D.set_TileImageSource(this._windowsLogoUri);
            expr_14D.set_TileBaseColor((Color)base.FindResource("DeviceTileBackgroundColor"));
            expr_14D.set_TileGradientColor((Color)base.FindResource("DeviceTileBackgroundGradient"));
            expr_14D.set_ImageStyle(base.FindResource("DeviceTileImage") as Style);
            TileButton tileButton3 = expr_14D;

            tileButton3.Click += new RoutedEventHandler(this.OsTile_Click);
            this.DeviceTileControl.TileButtons.Add(tileButton3);
            TileButton expr_1E5 = new TileButton();

            expr_1E5.Tag     = "android";
            expr_1E5.Content = CyberGhost.Translations.Home.HeadlineManageDeviceAndroid;
            expr_1E5.set_TileDescription(CyberGhost.Translations.Home.ContentManageDeviceAndroid);
            expr_1E5.set_TileImageSource(this._androidLogoUri);
            expr_1E5.set_TileBaseColor((Color)base.FindResource("DeviceTileBackgroundColor"));
            expr_1E5.set_TileGradientColor((Color)base.FindResource("DeviceTileBackgroundGradient"));
            expr_1E5.set_ImageStyle(base.FindResource("DeviceTileImage") as Style);
            TileButton tileButton4 = expr_1E5;

            tileButton4.Click += new RoutedEventHandler(this.OsTile_Click);
            this.DeviceTileControl.TileButtons.Add(tileButton4);
            TileButton expr_27D = new TileButton();

            expr_27D.Tag     = "custom";
            expr_27D.Content = CyberGhost.Translations.Home.HeadlineManageDeviceLinux;
            expr_27D.set_TileDescription(CyberGhost.Translations.Home.ContentManageDeviceLinux);
            expr_27D.set_TileImageSource(this._otherLogoUri);
            expr_27D.set_TileBaseColor((Color)base.FindResource("DeviceTileBackgroundColor"));
            expr_27D.set_TileGradientColor((Color)base.FindResource("DeviceTileBackgroundGradient"));
            expr_27D.set_ImageStyle(base.FindResource("DeviceTileImage") as Style);
            TileButton tileButton5 = expr_27D;

            tileButton5.Click += new RoutedEventHandler(this.OsTile_Click);
            this.DeviceTileControl.TileButtons.Add(tileButton5);
        }