Beispiel #1
0
        private void saveView(object sender, RoutedEventArgs e) //save the view created by the user
        {
            Views.HandleViews b = new Views.HandleViews();
            //save existing view
            if (viewName.Text != string.Empty)
            {
                b.saveCustomView(CustomviewTree, viewName.Text, true);
                return;
            }

            if (CustomviewTree.Items.Count > 0)
            {
                Controls.InputDialog.inputMessage inputDialog = new Controls.InputDialog.inputMessage("Please enter view name", "");
                inputDialog.Title = "Save Custom View";
                if (viewName.Text != string.Empty)
                {
                    inputDialog.txtAnswer.Text = viewName.Text;
                }
                if (inputDialog.ShowDialog() == true && inputDialog.Answer != string.Empty)
                {
                    string msg = b.saveCustomView(CustomviewTree, inputDialog.Answer, false);
                    if (msg == "success")
                    {
                        MessageBox.Show("View saved");
                        viewName.Text = inputDialog.Answer;
                    }

                    else
                    {
                        MessageBox.Show("View wasn't saved as view name already exists"); return;
                    }
                }
            }
        }
Beispiel #2
0
        private void LoadView(object sender, RoutedEventArgs e) //populate treeview with view
        {
            Views.HandleViews b         = new Views.HandleViews();
            List <string>     NamesList = b.getCustomViewsList();

            Controls.List.ListMessage inputDialog = new Controls.List.ListMessage(NamesList);

            //b.LoadCustomView

            //string msg = b.LoadCustomView(CustomviewTree, inputDialog.Answer);
            if (inputDialog.ShowDialog() == true)
            {
                b.LoadCustomView(CustomviewTree, inputDialog.lblQuestion.SelectedItem.ToString());
                viewName.Text = inputDialog.lblQuestion.SelectedItem.ToString();
                //MessageBox.Show("To Tag View : Right Click View");
            }
        }
Beispiel #3
0
        private void removeNode(object sender, RoutedEventArgs e)  // remove selected folders/files  from view
        {
            try
            {
                TreeViewItem selected = (TreeViewItem)CustomviewTree.SelectedItem;

                if (viewName.Text != string.Empty && selected.Parent.GetType().Name == "TreeView")
                {
                    string           messageBoxText = "Are you sure you want to delete view " + viewName.Text + "?";
                    MessageBoxButton button         = MessageBoxButton.YesNo;
                    MessageBoxImage  icon           = MessageBoxImage.Warning;
                    if (MessageBox.Show(messageBoxText, null, button, icon) == MessageBoxResult.No)
                    {
                        return;
                    }
                    else
                    {
                        Views.HandleViews b = new Views.HandleViews();
                        b.deleteCustomView(viewName.Text);
                        MessageBox.Show("View deleted");
                        CustomviewTree.Items.Clear();
                        return;
                    }
                }

                if (selected.Parent != null && selected.Parent.GetType().Name != "TreeView")
                {
                    var par       = (TreeViewItem)selected.Parent;
                    var itemIndex = par.Items.IndexOf(selected);

                    par.Items.Remove(selected);
                }
                else
                {
                    CustomviewTree.Items.Remove(CustomviewTree.SelectedItem);
                }
                MessageBox.Show("press save control to keep changes");
            }
            catch (NullReferenceException ex)
            {
                Console.WriteLine(ex.InnerException);
                MessageBox.Show("Choose the item you want to remove");
            }
        }
Beispiel #4
0
        private void getView(object sender, RoutedEventArgs e) //populate treeview with view
        {
            Views.HandleViews b     = new Views.HandleViews();
            var selectedCategoryLB  = lb2.SelectedValue as Tags.tagsCategory;
            var selectedSubCategory = lb3.SelectedValue;

            if (selectedCategoryLB != null)
            {
                string             selectedCategory        = selectedCategoryLB.categoryName;
                string             selectedSubCategoryName = null;;
                List <RadioButton> radioButtons            = Radio.Children.OfType <RadioButton>().ToList();
                RadioButton        rbTarget = radioButtons
                                              .Where(r => r.GroupName == "tagsWay" && r.IsChecked == true)
                                              .Single();

                if (rbTarget.Content.ToString() == "Main Category")
                {
                    selectedSubCategoryName = "";
                }
                else
                {
                    if (selectedSubCategory != null)
                    {
                        selectedSubCategoryName = lb3.SelectedValue.ToString();
                    }
                    else
                    {
                        MessageBox.Show("sub category was not selected");
                        return;
                    }
                }



                b.createViewByTag(rbTarget.Content.ToString(), selectedCategory + "." + selectedSubCategory, viewTree);
            }
            else
            {
                MessageBox.Show("main category was not selected");
                return;
            }
        }
Beispiel #5
0
        // Display the list of tags i.e categories and subCategories before perfoming any change in those lists
        // and enables the user to tag view he has created
        private void TagView(object sender, RoutedEventArgs e)
        {
            Tags.tagsXMLfunc.init1();


            Views.HandleViews b   = new Views.HandleViews();
            MenuItem          mnu = sender as MenuItem;

            TreeViewItem selected = null;
            TreeView     parent   = null;

            if (mnu != null)
            {
                selected = ((ContextMenu)mnu.Parent).PlacementTarget as TreeViewItem;
                parent   = GetObjectParent(selected);
                selected = parent.SelectedItem as TreeViewItem;
            }
            Controls.TagControl.TagDialog inputDialog = new Controls.TagControl.TagDialog(Categories);


            if (inputDialog.ShowDialog() == true)
            {
                var           selectedCategoty    = inputDialog.lb.SelectedValue as Tags.tagsCategory;
                var           selectedSubCategory = inputDialog.lb1.SelectedValue;
                List <string> fileslist           = b.getTaggedPaths(selected);
                if (fileslist == null)
                {
                    return;
                }
                if (selectedSubCategory != null)
                {
                    saveTags(fileslist, selectedCategoty.categoryName + "." + selectedSubCategory);
                }
                else
                {
                    saveTags(fileslist, selectedCategoty.categoryName + ".");
                }
                MessageBox.Show("Tags added successfuly");
            }
            e.Handled = true;
        }
Beispiel #6
0
        private void open(object sender, RoutedEventArgs e)   // handles with the creating of filtered view
        {
            Controls.TagControl.andOrSelection inputDialog = new Controls.TagControl.andOrSelection(Categories);
            inputDialog.Title = "Set Custom View filters";
            Tags.tagsXMLfunc.init1();
            if (inputDialog.ShowDialog() == true)
            {
                Views.HandleViews b = new Views.HandleViews();
                viewTree.Items.Clear();
                List <string> filterParams = inputDialog.paramLV.Items.Cast <string>()
                                             .Select(x => x.ToString()).ToList();
                if (filterParams.Count == 0)
                {
                    return;
                }
                b.getComplexTags(viewTree, filterParams);
                if (viewTree.Items.Count == 0)
                {
                    MessageBox.Show("No results were found for your selection");
                }
                else
                {
                    MessageBox.Show("To clear the view ,press the 'Create Filter View' button  and than  press ok");

                    string filters = "";
                    foreach (string param in filterParams)
                    {
                        filters = filters + " ( " + param + " )   ";
                    }

                    MessageBox.Show("View filter is:  " + filters);
                    b.saveCustomView(viewTree, "view" + filters, true);
                    MessageBox.Show("view" + filters + "created");
                }
                return;
            }
        }