Beispiel #1
0
 private void BorderIconButton_Clicked(object obj)
 {
     this.DialogResult = true;
     this.Category     = new Pages.ViewRunsPage.Category()
     {
         Name     = this.NameTextBox.Text,
         Colour   = (this.ColourShower.Fill as SolidColorBrush).Color,
         RunNames = new string[0],
         Loaded   = new bool[0]
     };
     this.Close();
 }
Beispiel #2
0
        private void item_Click(object sender, RoutedEventArgs e)
        {
            int index = FindIndex(sender);

            if (index != -1)
            {
                if (index == this.MenuItems.Length - 2)
                {
                    var window = new NewCategoryWindow();
                    window.Owner        = App.Current.MainWindow;
                    window.ValidateName = new Func <string, string>(delegate(string name)
                    {
                        if (String.IsNullOrWhiteSpace(name))
                        {
                            return("Please pick a name");
                        }
                        if (this._Categoies == null)
                        {
                            return(null);
                        }
                        for (int i = 0; i < this._Categoies.Length; i++)
                        {
                            if (this._Categoies[i].Name == name)
                            {
                                return("The name \"" + name + "\" already exists!");
                            }
                        }
                        return(null);
                    });
                    if (window.ShowDialog() == true)
                    {
                        Pages.ViewRunsPage.Category newCat = window.Category;
                        // Create a new category here!
                        var cs = this.NewCategory;
                        if (cs != null)
                        {
                            cs(newCat);
                        }
                        cs = this.CategorySelected;
                        if (cs != null)
                        {
                            cs(newCat);
                        }
                    }
                }
                else if (index == this.MenuItems.Length - 1)
                {
                    var cs = this.CategorySelected;
                    if (cs != null)
                    {
                        cs(null);
                    }
                }
                else
                {
                    var cs = this.CategorySelected;
                    if (cs != null)
                    {
                        cs(this.Categoies[index]);
                    }
                }
            }
        }
Beispiel #3
0
 private void BorderIconButton_Clicked(object obj)
 {
     this.DialogResult = true;
     this.Category = new Pages.ViewRunsPage.Category()
     {
         Name = this.NameTextBox.Text,
         Colour = ( this.ColourShower.Fill as SolidColorBrush ).Color,
         RunNames = new string[0],
         Loaded = new bool[0]
     };
     this.Close();
 }