Пример #1
0
        public AddDialog(Entrance entrance, bool isExpert)
        {
            InitializeComponent();
            this.Title = "Editing";
            _entrance  = entrance;
            isEditing  = true;
            if ((_isExpert = isExpert))
            {
                dateP.Visibility   = System.Windows.Visibility.Visible;
                dateP.SelectedDate = entrance.EntranceDateTime;
            }
            foreach (var i in Settings.Instance.Entrances)
            {
                if (i.Equip != null)
                {
                    if (!equip.Items.Contains(i.Equip.Name))
                    {
                        equip.Items.Add(i.Equip.Name);
                    }
                    if (!prop.Items.Contains(i.Equip.Client))
                    {
                        prop.Items.Add(i.Equip.Client);
                    }
                }
            }

            this.equip.SelectedItem = entrance.Equip.Name;
            this.prop.SelectedItem  = entrance.Equip.Client;
            this.prob.Text          = entrance.Equip.Problem;
        }
Пример #2
0
        private bool UserFilter(object item)
        {
            if (String.IsNullOrEmpty(filter.Text))
            {
                return(true);
            }

            Entrance iShell = (Entrance)item;

            return(iShell.Equip.Name.IndexOf(filter.Text, StringComparison.OrdinalIgnoreCase) >= 0);
        }
Пример #3
0
 void MainWindow_Loaded(object sender, RoutedEventArgs e)
 {
     Settings.Instance.Initalise("settings.xml");
     Entrance[] entrances = new Entrance[Settings.Instance.Entrances.Count];
     Settings.Instance.Entrances.CopyTo(entrances, 0);
     iEntrance = new List <Entrance>();
     iEntrance.AddRange(entrances);
     viewItems.SetItems(iEntrance);
     //list.ItemsSource = Settings.Instance.Entrances;
     CollectionViewSource.GetDefaultView(list.ItemsSource).Filter = UserFilter;
     GridViewColumnHeader_Click(sortByEntranceDateTime, e);
     gview.Columns.CollectionChanged += Columns_CollectionChanged;
     //ColumnsUpdate();
 }
Пример #4
0
        private void MenuItem_Checked(object sender, RoutedEventArgs e)
        {
            MenuItem mi       = (MenuItem)sender;
            string   property = ((ContextMenu)mi.Parent).Tag.ToString();

            bool isChecked = false;

            CollectionViewSource.GetDefaultView(list.ItemsSource).Filter = (item) => {
                Entrance iEntrance = (Entrance)item;
                string   text      = "";
                switch (property)
                {
                case "Equip.Name":
                    text = iEntrance.Equip.Name;
                    break;

                case "Equip.Client":
                    text = iEntrance.Equip.Client;
                    break;
                }
                string tag = mi.Tag.ToString();
                bool   bd  = false;
                foreach (MenuItem i in ((ContextMenu)mi.Parent).Items)
                {
                    if (i.IsChecked)
                    {
                        isChecked = true;
                        string itag = i.Tag.ToString();
                        if (text[0] >= itag[0] && text[0] <= itag[1])
                        {
                            bd = true;
                            break;
                        }
                    }
                }
                return(bd);
            };

            if (!isChecked)
            {
                CollectionViewSource.GetDefaultView(list.ItemsSource).Filter = UserFilter;
            }
            CollectionViewSource.GetDefaultView(list.ItemsSource).Refresh();
        }
Пример #5
0
 public SolutionDialog(Entrance entrance, bool isExpert)
 {
     InitializeComponent();
     if ((_isExpert = isExpert))
     {
         dateP.Visibility = System.Windows.Visibility.Visible;
         if (entrance.Equip.Solution != null)
         {
             dateP.SelectedDate = entrance.Equip.Solution.SolutionDateTime;
         }
         else
         {
             dateP.SelectedDate = DateTime.Now;
         }
     }
     this.Entrance = entrance;
     if (entrance.Equip.Solution != null)
     {
         isReady   = true;
         cost.Text = entrance.Equip.Solution.Cost.ToString();
         solu.Text = entrance.Equip.Solution.Description;
     }
 }