Ejemplo n.º 1
0
        public TabButtonControl()
        {
            InitializeComponent();
            GetTextControl      = new TextControl();
            GetSplitTextControl = new SplitTextControl();

            //{ "Python", "Python files (*.py)|*.py|Text files (*.txt)|*.txt|All files (*.*)|*.*"},
            //languageFilter
            using (var _context = new FileContext())
            {
                foreach (var item in _context.Folders)
                {
                    if (item.Name != "Base")
                    {
                        bool count = false;
                        try
                        {
                            foreach (var item1 in _context.OpenFilePaths.Where(o => o.FolderId == item.FolderID).ToList())
                            {
                                count = true;
                                languageFilter.Add(item.Name, item1.Path);
                            }
                        }
                        catch { }
                        if (!count)
                        {
                            languageFilter.Add(item.Name, "Text files (*.txt)|*.txt|All files (*.*)|*.*");
                        }
                    }
                }
            }
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            bool             next = false;
            TabButtonControl past = new TabButtonControl();

            foreach (var item in TopPanel.Children.OfType <TabButtonControl>())
            {
                if (item.Open)
                {
                    foreach (var item2 in TopPanel.Children.OfType <TabButtonControl>())
                    {
                        if (item2.Open)
                        {
                            item2.GetTextControl      = GroopGrid.Children.OfType <TextControl>().FirstOrDefault();
                            item2.GetSplitTextControl = GroopGrid.Children.OfType <SplitTextControl>().FirstOrDefault();
                        }
                        item2.Open = false;
                    }
                    past.Open = true;
                    try { GroopGrid.Children.Remove(GroopGrid.Children.OfType <TextControl>().FirstOrDefault()); } catch { }
                    try { GroopGrid.Children.Remove(GroopGrid.Children.OfType <SplitTextControl>().FirstOrDefault()); } catch { }
                    TextControl textControl = past.GetTextControl;
                    textControl.SetValue(Grid.RowProperty, 0);
                    textControl.Margin = new Thickness(0, 1, 0, 0);
                    textControl.SetValue(Panel.ZIndexProperty, 0);
                    GroopGrid.Children.Add(past.GetTextControl);
                    SplitTextControl splitTextControl = past.GetSplitTextControl;
                    splitTextControl.SetValue(Grid.RowProperty, 1);
                    splitTextControl.Margin = new Thickness(0, 1, 0, 0);
                    splitTextControl.SetValue(Panel.ZIndexProperty, 0);
                    GroopGrid.Children.Add(past.GetSplitTextControl);
                    switch (past.IsSplit)
                    {
                    case true:
                        GroopGrid.Children[0].Visibility = Visibility.Collapsed;
                        GroopGrid.Children[1].Visibility = Visibility.Visible;
                        break;

                    case false:
                    default:
                        GroopGrid.Children[0].Visibility = Visibility.Visible;
                        GroopGrid.Children[1].Visibility = Visibility.Collapsed;
                        break;
                    }
                    break;
                }
                next      = item.Open;
                item.Open = false;
                past      = item;
            }
        }
        private void TabButtonControl_ControlClicked(object sender, EventArgs e)
        {
            #region Try 1
            TabButtonControl tab = (TabButtonControl)sender;
            foreach (var item in TopPanel.Children.OfType <TabButtonControl>())
            {
                if (item.Open)
                {
                    item.GetTextControl      = GroopGrid.Children.OfType <TextControl>().FirstOrDefault();
                    item.GetSplitTextControl = GroopGrid.Children.OfType <SplitTextControl>().FirstOrDefault();
                }
                item.Open = false;
            }
            tab = (TabButtonControl)sender;
            try { GroopGrid.Children.Remove(GroopGrid.Children.OfType <TextControl>().FirstOrDefault()); } catch { }
            try { GroopGrid.Children.Remove(GroopGrid.Children.OfType <SplitTextControl>().FirstOrDefault()); } catch { }
            TextControl textControl = tab.GetTextControl;
            textControl.SetValue(Grid.RowProperty, 0);
            textControl.Margin = new Thickness(0, 1, 0, 0);
            textControl.SetValue(Panel.ZIndexProperty, 0);
            GroopGrid.Children.Add(tab.GetTextControl);
            SplitTextControl splitTextControl = tab.GetSplitTextControl;
            splitTextControl.SetValue(Grid.RowProperty, 1);
            splitTextControl.Margin = new Thickness(0, 1, 0, 0);
            splitTextControl.SetValue(Panel.ZIndexProperty, 0);
            GroopGrid.Children.Add(tab.GetSplitTextControl);
            switch (tab.IsSplit)
            {
            case true:
                GroopGrid.Children[0].Visibility = Visibility.Collapsed;
                GroopGrid.Children[1].Visibility = Visibility.Visible;
                break;

            case false:
            default:
                GroopGrid.Children[0].Visibility = Visibility.Visible;
                GroopGrid.Children[1].Visibility = Visibility.Collapsed;
                break;
            }
            #endregion
        }
Ejemplo n.º 4
0
 public void Set(ref SplitTextControl mainSplitTextControl)
 {
     mainSplitTextControl = GetSplitTextControl;
 }