Exemplo n.º 1
0
 /// <summary>
 /// Called when the standard-button is pressed.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="gameTimeEventArgs">The <see cref="GameTimeEventArgs"/> instance containing the event data.</param>
 private void OnButtonPress(object sender, GameTimeEventArgs gameTimeEventArgs)
 {
     if (this.InfoLabel != null)
     {
         this.InfoLabel.ConfigText = "Click:" + GetTime();
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Called when a menu button was clicked to open a menu.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="GameTimeEventArgs"/> instance containing the event data.</param>
        /// <exception cref="System.InvalidOperationException">Button tag was null</exception>
        private void OnButtonClicked(object sender, GameTimeEventArgs e)
        {
            // get the button that started this event
            var button = sender as Button;
            if (button == null)
            {
                return;
            }

            // get the tag out of the button , cause it contains the type of window that i want to show
            var typeName = button.Tag as string;

            if (string.IsNullOrEmpty(typeName))
            {
                throw new InvalidOperationException("Button tag was null");
            }

            var windowType = Type.GetType(typeName);

            // validate that we really have the type of window
            if (windowType == null)
            {
                Debug.WriteLine("Could not extract the type of window i should open.");
                return;
            }

            // create the window , by using the given type
            var shortName = windowType.Name;
            object[] par = { shortName };
            var obj = Activator.CreateInstance(windowType, par);

            // validate that we really have the window
            var window = obj as Window;
            if (window == null)
            {
                Debug.WriteLine("Could not create the given type of window");
                return;
            }

            // show the window
            this.parent.AddControl(window);
            window.Config.PositionX = 100;
            window.Config.PositionY = 100;
            window.CentreToParent();
        }
Exemplo n.º 3
0
 /// <summary>
 /// Called when we clicked the close button.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="GameTimeEventArgs"/> instance containing the event data.</param>
 private void OnCloseClicked(object sender, GameTimeEventArgs e)
 {
     this.Parent.DestroyMe(this);
 }
Exemplo n.º 4
0
        /// <summary>
        /// When the check event is been toggled
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="gameTimeEventArgs">The <see cref="GameTimeEventArgs"/> instance containing the event data.</param>
        private void HandleToggle(object sender, GameTimeEventArgs gameTimeEventArgs)
        {
            if (this.isChecked)
            {
                this.isChecked = false;
                this.TickBox.ConfigText = string.Empty;
            }
            else
            {
                this.isChecked = true;
                this.TickBox.ConfigText = "X";
            }

            Debug.WriteLine(this.Name + " checked = " + this.isChecked);
        }
Exemplo n.º 5
0
        /// <summary>
        /// React on when the mouse is down above the min button.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="gameTimeEventArgs">The <see cref="GameTimeEventArgs"/> instance containing the event data.</param>
        private void MinButtonLeftMousePressed(object sender, GameTimeEventArgs gameTimeEventArgs)
        {
            this.rapidScrollDelay = true;

            this.Scroll(-this.ConfigStep);
        }
Exemplo n.º 6
0
 /// <summary>
 /// React on when the mouse is up above the min button.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="gameTimeEventArgs">The <see cref="GameTimeEventArgs"/> instance containing the event data.</param>
 private void MinButtonLeftMouseReleased(object sender, GameTimeEventArgs gameTimeEventArgs)
 {
     this.rapidScrollDelay = true;
 }
Exemplo n.º 7
0
 /// <summary>
 /// Called when the remove-button is pressed.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="gameTimeEventArgs">The <see cref="GameTimeEventArgs"/> instance containing the event data.</param>
 private void RemoveClicked(object sender, GameTimeEventArgs gameTimeEventArgs)
 {
     if (this.ListBox.ListBoxItems.Count > 0)
     {
         this.ListBox.RemoveListItem(this.ListBox.ListBoxItems[this.ListBox.ListBoxItems.Count - 1]);
     }
 }
Exemplo n.º 8
0
 /// <summary>
 /// Called when the add-button is pressed.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="gameTimeEventArgs">The <see cref="GameTimeEventArgs"/> instance containing the event data.</param>
 private void AddClicked(object sender, GameTimeEventArgs gameTimeEventArgs)
 {
     this.ListBox.AddListItem(new ListBoxItem("Test 2", "MyListItem6"));
 }