Example #1
0
        private void CommandBinding_NewFilterCondition(object sender, ExecutedRoutedEventArgs e)
        {
            try
            {
                object obj = e.Parameter;
                if (obj == null) return;

                GroupFilterVM gf = (GroupFilterVM)obj;
                GroupFilterConditionVM gfc = new GroupFilterConditionVM();

                GroupFilterConditionForm frm = new GroupFilterConditionForm();
                frm.Owner = this;
                frm.Init(gf, gfc);
                bool? result = frm.ShowDialog();
                if (result.HasValue && result.Value == true)
                {
                    gf.FilterConditions.Add(gfc);

                    groupFilterVM = gf;
                    MainListHelperVM.Instance.ViewGroupsForms.Filter = GroupFilter_GroupSearch;
                    MainListHelperVM.Instance.SetGroupFilterSortingOnForms(gf);
                }
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
        }
        void lbFilterConditions_Editing_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            GroupFilterVM gf = this.DataContext as GroupFilterVM;
            if (gf == null) return;

            GroupFilterConditionVM gfc = lbFilterConditions_Editing.SelectedItem as GroupFilterConditionVM;
            if (gfc == null) return;

            try
            {

                GroupFilterConditionForm frm = new GroupFilterConditionForm();
                frm.Owner = Window.GetWindow(this);
                frm.Init(gf, gfc);
                bool? result = frm.ShowDialog();
                if (result.HasValue && result.Value == true)
                {

                    Window win = Window.GetWindow(this);
                    MainWindow main = win as MainWindow;
                    //gf.FilterConditions.Add(gfc);

                    MainListHelperVM.Instance.ViewGroupsForms.Filter = main.GroupFilter_GroupSearch;
                    MainListHelperVM.Instance.SetGroupFilterSortingOnForms(gf);
                }
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
        }