private void DisplayBook()
 {
     App.Register <Book>(this, AppMessages.MSG_DISPLAY_BOOK, book =>
     {
         if (book != null)
         {
             AddTabBook(book, false);
             var tab = new TabItem()
             {
                 Header  = book.Title,
                 Content = new BookDetailView(book, false)
             };
             tabControl.Items.Add(tab);
             Dispatcher.InvokeAsync(() => tab.Focus());
             CloseAnglet(tab);
         }
     });
 }
示例#2
0
        private TabItem CreateNewTabInternal(String header)
        {
            Tree treeView = new Tree();

            treeView.SelectedItemChanged += OnTreeViewSelectedItemChanged;

            TabItem tabItem = new TabItem {
                Header = header
            };

            tabItem.Content = treeView;

            ContextMenu   contextMenu   = new ContextMenu();
            FilterCommand filterCommand = new FilterCommand(this, treeView);

            contextMenu.Items.Add(new MenuItem {
                Header = "Filter", Command = filterCommand
            });

            if (_tabControl.Items.Count > 0)
            {
                CloseTabCommand closeTabCommand = new CloseTabCommand(_tabControl, tabItem);

                contextMenu.Items.Add(new MenuItem {
                    Header = "Close", Command = closeTabCommand
                });

                tabItem.MouseDown += (s, e) =>
                {
                    if (e.ChangedButton == MouseButton.Middle && e.ButtonState == MouseButtonState.Pressed)
                    {
                        closeTabCommand.Execute(null);
                    }
                };
            }

            tabItem.ContextMenu = contextMenu;

            _tabControl.Items.Add(tabItem);
            _tabControl.SelectedItem = tabItem;
            tabItem.Focus();

            return(tabItem);
        }
        /// <summary>
        /// Add tab item to the tab
        /// </summary>
        /// <param name="mdiChild">This is the user control</param>
        private void AddTab(ITabbedMDI mdiChild)
        {
            //Check if the user control is already opened
            if (_mdiChildren.ContainsKey(mdiChild.UniqueTabName))
            {
                //user control is already opened in tab.
                //So set focus to the tab item where the control hosted
                foreach (object item in tcMdi.Items)
                {
                    TabItem ti = (TabItem)item;
                    if (ti.Name == mdiChild.UniqueTabName)
                    {
                        ti.Focus();
                        break;
                    }
                }
            }
            else
            {
                //the control is not open in the tab item
                tcMdi.Visibility = Visibility.Visible;
                tcMdi.Width      = this.ActualWidth;
                tcMdi.Height     = this.ActualHeight;

                ((ITabbedMDI)mdiChild).CloseInitiated += new delClosed(CloseTab);

                //create a new tab item
                TabItem ti = new TabItem();
                //set the tab item's name to mdi child's unique name
                ti.Name = ((ITabbedMDI)mdiChild).UniqueTabName;
                //set the tab item's title to mdi child's title
                ti.Header = ((ITabbedMDI)mdiChild).Title;
                //set the content property of the tab item to mdi child
                ti.Content = mdiChild;
                ti.HorizontalContentAlignment = HorizontalAlignment.Stretch;
                ti.VerticalContentAlignment   = VerticalAlignment.Top;
                //add the tab item to tab control
                tcMdi.Items.Add(ti);
                //set this tab as selected
                tcMdi.SelectedItem = ti;
                //add the mdi child's unique name in the open children's name list
                _mdiChildren.Add(((ITabbedMDI)mdiChild).UniqueTabName, ((ITabbedMDI)mdiChild).Title);
            }
        }
示例#4
0
        bool checkSetting(bool result, TextBox textBox, string message, TabItem tab = null)
        {
            if (!result)
            {
                MessageBox.Show(message, resources["Connect"] as string, MessageBoxButton.OK, MessageBoxImage.Warning);
                if (tab != null)
                {
                    tab.Focus();
                }
                new Action(() => {
                    Dispatcher.BeginInvoke(new Action(() => {
                        textBox.SelectAll();
                        textBox.Focus();
                    }));
                }).BeginInvoke(null, null);
            }

            return(result);
        }
示例#5
0
        private void DisplayMessage(string message)
        {
            var tab = new TabItem
            {
                Header  = "Messages",
                Content = new TextBox
                {
                    Text          = message,
                    Foreground    = Themes.SqlResult.Message.Foreground,
                    Background    = Themes.SqlResult.Message.Background,
                    IsReadOnly    = true,
                    TextWrapping  = TextWrapping.Wrap,
                    AcceptsReturn = true
                }
            };

            TabControl.Items.Add(tab);
            tab.Focus();
        }
        private void NewBook()
        {
            App.Register(this, AppMessages.MSG_NEW_BOOK, () =>
            {
                var book = App.Model.Books.Create();
                App.Model.Books.Add(book);
                AddTabBook(book, true);
                //var book = App.Model.Books.Create();
                var tab = new TabItem()
                {
                    Header  = "<new book>",
                    Content = new BookDetailView(book, true)
                };
                tabControl.Items.Add(tab);
                Dispatcher.InvokeAsync(() => tab.Focus());

                CloseAnglet(tab);
            });
        }
示例#7
0
        private Course newTabForCourse(Course course, bool isNew)
        {
            var XCode = from m in App.Model.course

                        select m.Code;
            int newCode = 1;

            while (XCode.Contains(newCode))
            {
                newCode += 1;
            }
            if (isNew)
            {
                course.Code = newCode;
            }
            var tmpCourse = "Course ";

            var tab = new TabItem()
            {
                Header  = isNew ? tmpCourse + newCode : tmpCourse + course.Code,
                Content = new CourseDetailView(course, isNew)
            };

            tab.MouseDown += (o, e) =>
            {
                if (e.ChangedButton == MouseButton.Middle && e.ButtonState == MouseButtonState.Pressed)
                {
                    tabControl.Items.Remove(o);
                }
            };
            tab.KeyDown += (o, e) =>
            {
                if (e.Key == Key.W && Keyboard.IsKeyDown(Key.LeftCtrl))
                {
                    tabControl.Items.Remove(o);
                }
            };
            tabControl.Items.Add(tab);
            Dispatcher.InvokeAsync(() => tab.Focus());
            return(course);
        }
示例#8
0
        public void newBookMessage()
        {
            App.Register(this, AppMessages.NEW_BOOK, () =>
            {
                var book = App.Model.Books.Create();
                var tab  = new TabItem()
                {
                    Header  = "NEW BOOK  ",
                    Content = new NewBook(book, true)
                };
                tabControl.Items.Add(tab);
                Dispatcher.InvokeAsync(() => tab.Focus());
                closeAnglet(tab);
            });

            App.Register <Category>(this, AppMessages.DISPLAY_CATEGORY, category => {
                var tab = catTab;
                tab.Focus();
                App.NotifyColleagues(AppMessages.PRESELECTE_CAT, category);
            });
        }
示例#9
0
        private void TabOfMember(Member m, bool isNew)
        {
            foreach (TabItem t in tabControl.Items)
            {
                if (t.Header.ToString().Equals(m.Pseudo))
                {
                    Dispatcher.InvokeAsync(() => t.Focus());
                    return;
                }
            }
            var tab = new TabItem()
            {
                Header  = isNew ? "<new member>" : m.Pseudo,
                Content = new MemberDetailView(m)
            };

            tabControl.Items.Add(tab);
            CloseTab(tab);
            // exécute la méthode Focus() de l'onglet pour lui donner le focus (càd l'activer)
            Dispatcher.InvokeAsync(() => tab.Focus());
        }
示例#10
0
        private void CriarTab(string titulo, object conteudo)
        {
            var tabNovo = new TabItem
            {
                HeaderTemplate = (DataTemplate)this.Resources["itemTab"]
            };

            var cabecalho = new CabTabDado
            {
                Titulo     = titulo,
                TabItemObj = tabNovo
            };

            tabNovo.Header = cabecalho;

            tabNovo.Content = conteudo;

            tabControl.Items.Add(tabNovo);

            tabNovo.Focus();
        }
        /// <summary>
        /// Adds tab to the tab control
        /// </summary>
        /// <param name="chromiumWebBrowser">Web browser object ( USED FOR BINDING THE TITLE ONLY )</param>
        /// <param name="alternativeTitle">A title that will be desplayed before the browser's title finished loading</param>
        /// <param name="content">UI element to place inside the tab</param>
        public void AddTab(ChromiumWebBrowser chromiumWebBrowser, string alternativeTitle, UIElement content)
        {
            // Create a tab item and add it to the tab control;
            TabItem item = this.CreateTabItem(chromiumWebBrowser, alternativeTitle);

            item.Content = content;                         // Put the given content inside the tab item
            this.tabControl.Items.Add(item);                // Add the complete tab to the UI
            this.tabItems.Add(item);

            // Move the + button right
            this.addNewTabButton.Margin = this.AddNewTabMargin;

            EnsureFit();                                                       // Ensure fit when a new tab is added
            item.Loaded += (object sender, RoutedEventArgs e) => item.Focus(); // Focus on the new tab after loaded

            // Disable the add new tab button if reached the maximum number of tabs
            if (this.TabCount == TabCountLimit)
            {
                this.addNewTabButton.IsEnabled = false;
            }
        }
示例#12
0
        private void TabOfBuySubscription(PassType selectedPass)
        {
            var tab = new TabItem();

            foreach (TabItem t in tabControl.Items)
            {
                if (t.Header.ToString().Equals(selectedPass.ToString()))
                {
                    Dispatcher.InvokeAsync(() => t.Focus());
                    return;
                }
            }
            tab = new TabItem()
            {
                Header  = Properties.Resources.Menu_Buy_Subscription + " " + selectedPass.ToString(),
                Content = new BuySubscriptionView(selectedPass)
            };
            tabControl.Items.Add(tab);
            CloseTab(tab);
            // exécute la méthode Focus() de l'onglet pour lui donner le focus (càd l'activer)
            Dispatcher.InvokeAsync(() => tab.Focus());
        }
示例#13
0
        public MessageBoxResult CloseTab(object tab, bool openNewDocument = false)
        {
            MessageBoxResult messageBoxResult = MessageBoxResult.No;
            TabItem          tabItem          = tab as TabItem;

            if (tabItem != null)
            {
                tabItem.Focus();
                EditorRenderer currentEditorRenderer = this.CurrentEditorRenderer;
                if (currentEditorRenderer.Editor.HasChanges)
                {
                    messageBoxResult = CustomMessageBox.ShowYesNoCancel(LocalizationProvider.GetLocalizedString("SaveChangesMessage", false, "MarkdownPadStrings"), LocalizationProvider.GetLocalizedString("SaveChangesTitle", false, "MarkdownPadStrings") + " - " + currentEditorRenderer.Title, LocalizationProvider.GetLocalizedString("Save", false, "MarkdownPadStrings"), LocalizationProvider.GetLocalizedString("DoNotSave", false, "MarkdownPadStrings"), LocalizationProvider.GetLocalizedString("Cancel", false, "MarkdownPadStrings"), MessageBoxImage.Question);
                }
                MessageBoxResult messageBoxResult2 = messageBoxResult;
                if (messageBoxResult2 != MessageBoxResult.Cancel)
                {
                    if (messageBoxResult2 == MessageBoxResult.Yes)
                    {
                        bool flag = this.CurrentEditorRenderer.SaveDocument();
                        if (flag)
                        {
                            currentEditorRenderer.Dispose();
                            this.tabControl.Items.Remove(tab);
                        }
                    }
                    else
                    {
                        currentEditorRenderer.Dispose();
                        this.tabControl.Items.Remove(tab);
                    }
                }
                if (openNewDocument && this.tabControl.Items.Count == 0)
                {
                    this.AddNewTab("");
                }
            }
            this.OnPropertyChanged("NumberOfOpenDocuments");
            return(messageBoxResult);
        }
示例#14
0
        private void newTabForPresence(int idOccurence)
        {
            Course course        = null;
            string dateOccurence = "?????";

            foreach (var res in App.Model.courseoccurrence)
            {
                if (res.Id == idOccurence)
                {
                    course        = res.Course;
                    dateOccurence = res.Date.ToString("dd/MM/yyyy");
                }
            }
            var tmpCourse = "Presence - " + course.Code + " - " + dateOccurence;

            var tab = new TabItem()
            {
                Header  = tmpCourse,
                Content = new PresenceView(idOccurence)
            };

            tab.MouseDown += (o, e) =>
            {
                if (e.ChangedButton == MouseButton.Middle && e.ButtonState == MouseButtonState.Pressed)
                {
                    tabControl.Items.Remove(o);
                }
            };
            tab.KeyDown += (o, e) =>
            {
                if (e.Key == Key.W && Keyboard.IsKeyDown(Key.LeftCtrl))
                {
                    tabControl.Items.Remove(o);
                }
            };
            tabControl.Items.Add(tab);
            Dispatcher.InvokeAsync(() => tab.Focus());
        }
示例#15
0
        public void Navigate(string url, TabItem jumpToTab = null)
        {
            try
            {
                if (Browser.CoreWebView2 == null)
                {
                    Browser.Source = new Uri(url);
                }
                else
                {
                    Browser.CoreWebView2?.Navigate(url);
                }

                if (jumpToTab != null)
                {
                    jumpToTab.Focus();
                }
            }
            catch (Exception ex)
            {
                Debug.Print($"Error navigating to '{url}': {ex.Message}");
            }
        }
示例#16
0
        private void TabSubscriptions()
        {
            var str = Properties.Resources.Menu_Subscriptions;

            foreach (TabItem t in tabControl.Items)
            {
                if (t.Header.ToString().Equals(str))
                {
                    Dispatcher.InvokeAsync(() => t.Focus());
                    return;
                }
            }
            var tab = new TabItem()
            {
                Header  = str,
                Content = new SubscriptionsView()
            };

            tabControl.Items.Add(tab);
            CloseTab(tab);
            // exécute la méthode Focus() de l'onglet pour lui donner le focus (càd l'activer)
            Dispatcher.InvokeAsync(() => tab.Focus());
        }
示例#17
0
 private void TabOfCourse(Course c, bool isNew)
 {
     if (c != null)
     {
         foreach (TabItem t in tabControl.Items)
         {
             if (t.Header.ToString().Equals(c.ToString()))
             {
                 Dispatcher.InvokeAsync(() => t.Focus());
                 return;
             }
         }
         var tab = new TabItem()
         {
             Header  = isNew ? "<new course>" : c.ToString(),
             Content = new CourseDetailView(c)
         };
         tabControl.Items.Add(tab);
         CloseTab(tab);
         // exécute la méthode Focus() de l'onglet pour lui donner le focus (càd l'activer)
         Dispatcher.InvokeAsync(() => tab.Focus());
     }
 }
示例#18
0
        public void OpenPlugin(Key key, ModifierKeys modifierkeys)
        {
            foreach (Plugin p in Plugins)
            {
                if (modifierkeys == p.ModifierKeys && key == p.Key)
                {
                    try
                    {
                        TabItem t = (TabItem)((FrameworkElement)p.Root).Parent;
                        t.IsSelected = true;
                        t.Focus();

                        UpdateLayout();

                        if (t.Content is FrameworkElement)
                        {
                            (t.Content as FrameworkElement).MoveFocus(new TraversalRequest(FocusNavigationDirection.First));
                        }
                    }
                    catch { }
                }
            }
        }
示例#19
0
        public void AddNewTab(string fileToOpenOnLoad = "")
        {
            TabItem        tabItem = new TabItem();
            EditorRenderer editorRenderer;

            if (!System.IO.File.Exists(fileToOpenOnLoad))
            {
                editorRenderer = new EditorRenderer("");
            }
            else
            {
                foreach (TabItem tabItem2 in (System.Collections.IEnumerable) this.tabControl.Items)
                {
                    string text = tabItem2.Tag.ToString();
                    if (text.ToUpper(System.Globalization.CultureInfo.InvariantCulture) == fileToOpenOnLoad.ToUpper(System.Globalization.CultureInfo.InvariantCulture))
                    {
                        TabbedDocumentInterface._logger.Trace("File already open in editor, focusing: " + fileToOpenOnLoad);
                        int selectedIndex = this.tabControl.Items.IndexOf(tabItem2);
                        this.tabControl.SelectedIndex = selectedIndex;
                        return;
                    }
                }
                if (this.NumberOfOpenDocuments > 0 && !this.CurrentEditorRenderer.Editor.HasChanges && string.IsNullOrEmpty(this.CurrentEditorRenderer.Filename) && this.tabControl.SelectedIndex == 0)
                {
                    this.CloseTab(this.CurrentTab, false);
                }
                editorRenderer = new EditorRenderer(fileToOpenOnLoad);
            }
            tabItem.Header  = editorRenderer.Title;
            tabItem.Content = editorRenderer;
            tabItem.Tag     = editorRenderer.Filename;
            this.tabControl.Items.Add(tabItem);
            tabItem.ContextMenu = this.TabContextMenu;
            tabItem.Focus();
            tabItem.DataContext = editorRenderer.Editor;
            this.OnPropertyChanged("NumberOfOpenDocuments");
        }
示例#20
0
 private void TabOfCompetition(Competition c, bool isNew)
 {
     if (!isNew && c != null)
     {
         var tab = new TabItem();
         foreach (TabItem t in tabControl.Items)
         {
             if (t.Header.ToString().Equals(c.ToString()))
             {
                 Dispatcher.InvokeAsync(() => t.Focus());
                 return;
             }
         }
         tab = new TabItem()
         {
             Header  = c.ToString(),
             Content = new CompetitionDetailView(c)
         };
         tabControl.Items.Add(tab);
         CloseTab(tab);
         // exécute la méthode Focus() de l'onglet pour lui donner le focus (càd l'activer)
         Dispatcher.InvokeAsync(() => tab.Focus());
     }
     else if (App.CurrentUser.Pseudo.CompareTo("admin") == 0)
     {
         var tab = new TabItem();
         tab = new TabItem()
         {
             Header  = "<new competition>",
             Content = new CompetitionCreateView()
         };
         tabControl.Items.Add(tab);
         CloseTab(tab);
         // exécute la méthode Focus() de l'onglet pour lui donner le focus (càd l'activer)
         Dispatcher.InvokeAsync(() => tab.Focus());
     }
 }
示例#21
0
        private void ShowTab(string name, Type controlType)
        {
            TabItem tab = Tabs.Items.OfType <TabItem>().SingleOrDefault(n => n.Header.ToString() == name);

            if (tab != null)
            {
                tab.Focus();
            }
            else
            {
                UserControl item = Activator.CreateInstance(controlType, new object[0]) as UserControl;
                tab = new TabItem
                {
                    Content = item,
                    HorizontalContentAlignment = HorizontalAlignment.Stretch,
                    VerticalContentAlignment   = VerticalAlignment.Stretch,
                    Header = name,
                    //Style = Application.Current.Resources["FaneStil"] as Style
                };

                Tabs.Items.Add(tab);
                Tabs.SelectedIndex = Tabs.Items.Count - 1;
            }
        }
示例#22
0
        public MainView()
        {
            DataContext = this;

            InitializeComponent();

            // CLIENT EDIT COMMANDS
            App.Messenger.Register(App.MSG_NEW_CLIENT, () =>
            {
                var client = App.Model.Clients.Create();
                var tab    = new TabItem()
                {
                    Header  = "<new client>",
                    Content = new ClientEdit(client, true)
                };

                AddTabControls(tab);

                tabControl.Items.Add(tab);
                Dispatcher.InvokeAsync(() => tab.Focus());
            });

            App.Messenger.Register <Client>(App.MSG_CLIENT_CHANGED, (c) =>
            {
                (tabControl.SelectedItem as TabItem).Header = "<" + c.FullName + ">";
            });

            App.Messenger.Register <Client>(App.MSG_EDIT_CLIENT, (c) =>
            {
                if (c != null)
                {
                    TabItem tab   = null;
                    string Header = "<" + c.FullName + ">";
                    foreach (TabItem t in tabControl.Items)
                    {
                        if (t.Header.Equals(Header))
                        {
                            tab = t;
                        }
                    }

                    if (tab == null)
                    {
                        var clientEdit = new ClientEdit(c, false);
                        tab            = new TabItem()
                        {
                            Header  = "<" + c.FullName + ">",
                            Content = clientEdit
                        };


                        AddTabControls(tab, () => { if (clientEdit.CanSaveOrCancelAction())
                                                    {
                                                        clientEdit.CancelAction();
                                                    }
                                       });

                        tabControl.Items.Add(tab);
                    }

                    Dispatcher.InvokeAsync(() => tab.Focus());
                }
            });


            // SHOW EDIT COMMANDS
            App.Messenger.Register(App.MSG_NEW_SHOW, () =>
            {
                var show = App.Model.Shows.Create();
                var tab  = new TabItem()
                {
                    Header  = "<new show>",
                    Content = new ShowEdit(show, true)
                };

                AddTabControls(tab);

                tabControl.Items.Add(tab);
                Dispatcher.InvokeAsync(() => tab.Focus());
            });

            App.Messenger.Register <Show>(App.MSG_SHOW_CHANGED, (s) =>
            {
                (tabControl.SelectedItem as TabItem).Header = "<" + s.Name + ">";
            });

            App.Messenger.Register <Show>(App.MSG_EDIT_SHOW, (s) =>
            {
                if (s != null)
                {
                    TabItem tab   = null;
                    string Header = "<" + s.Name + ">";
                    foreach (TabItem t in tabControl.Items)
                    {
                        if (t.Header.Equals(Header))
                        {
                            tab = t;
                        }
                    }

                    if (tab == null)
                    {
                        var editShow = new ShowEdit(s, false);
                        tab          = new TabItem()
                        {
                            Header  = "<" + s.Name + ">",
                            Content = editShow
                        };

                        AddTabControls(tab, () => { if (editShow.CanSaveOrCancelAction())
                                                    {
                                                        editShow.CancelAction();
                                                    }
                                       });

                        tabControl.Items.Add(tab);
                    }

                    Dispatcher.InvokeAsync(() => tab.Focus());
                }
            });


            // RESERVATION EDIT COMMANDS
            App.Messenger.Register(App.MSG_NEW_RESERVATION, () =>
            {
                var reservation = App.Model.Reservations.Create();
                var tab         = new TabItem()
                {
                    Header  = "<new reservation>",
                    Content = new ReservationEdit(reservation, true)
                };

                AddTabControls(tab);

                tabControl.Items.Add(tab);
                Dispatcher.InvokeAsync(() => tab.Focus());
            });

            App.Messenger.Register <Client>(App.MSG_NEW_CLIENT_RESERVATION, (c) =>
            {
                if (c != null)
                {
                    var reservation    = App.Model.Reservations.Create();
                    reservation.Client = c;
                    var tab            = new TabItem()
                    {
                        Header  = "<new reservation>",
                        Content = new ReservationEdit(reservation, true)
                    };

                    AddTabControls(tab);

                    tabControl.Items.Add(tab);
                    Dispatcher.InvokeAsync(() => tab.Focus());
                }
            });

            App.Messenger.Register <Show>(App.MSG_NEW_SHOW_RESERVATION, (s) =>
            {
                if (s != null)
                {
                    if (s.FreePlacesTotal <= 0)
                    {
                        MessageBoxResult result = MessageBox.Show(Properties.Resources.NoPlaces, Properties.Resources.NotPossible, MessageBoxButton.OK, MessageBoxImage.Information);
                    }
                    else
                    {
                        var reservation  = App.Model.Reservations.Create();
                        reservation.Show = s;
                        var tab          = new TabItem()
                        {
                            Header  = "<new reservation>",
                            Content = new ReservationEdit(reservation, true)
                        };

                        AddTabControls(tab);

                        tabControl.Items.Add(tab);
                        Dispatcher.InvokeAsync(() => tab.Focus());
                    }
                }
            });

            App.Messenger.Register <Reservation>(App.MSG_RESERVATION_CHANGED, (r) =>
            {
                (tabControl.SelectedItem as TabItem).Header = r.TabHeader;
            });

            App.Messenger.Register <Reservation>(App.MSG_EDIT_RESERVATION, (r) =>
            {
                if (r != null)
                {
                    TabItem tab   = null;
                    string Header = r.TabHeader;
                    foreach (TabItem t in tabControl.Items)
                    {
                        if (t.Header.Equals(Header))
                        {
                            tab = t;
                        }
                    }

                    if (tab == null)
                    {
                        var resEdit = new ReservationEdit(r, false);
                        tab         = new TabItem()
                        {
                            Header  = r.TabHeader,
                            Content = resEdit
                        };

                        AddTabControls(tab, () => { if (resEdit.CanSaveOrCancelAction())
                                                    {
                                                        resEdit.CancelAction();
                                                    }
                                       });

                        tabControl.Items.Add(tab);
                    }

                    Dispatcher.InvokeAsync(() => tab.Focus());
                }
            });



            // CLOSE TABS
            App.Messenger.Register <string>(App.MSG_CLOSE_TAB, (pseudo) =>
            {
                string tHeader = "<" + pseudo + ">";
                foreach (TabItem t in tabControl.Items)
                {
                    if (t.Header.Equals(tHeader))
                    {
                        tabControl.Items.Remove(t);
                        break;
                    }
                }
            });
        }
示例#23
0
        public MainView()
        {
            DataContext = this;

            SaveChanges   = new RelayCommand <Course>(c => { App.Messenger.NotifyColleagues(App.MSG_SAVE, c); });
            CancelChanges = new RelayCommand <Course>(c => { App.Messenger.NotifyColleagues(App.MSG_CANCEL, c); });

            InitializeComponent();

            App.Messenger.Register <TabItem>(App.MSG_CLOSE_TAB, tab =>
            {
                tabControl.Items.Remove(tab);
            });

            App.Messenger.Register <string>(App.MSG_CODE_CHANGED, (s) =>
            {
                (tabControl.SelectedItem as TabItem).Header = s;
            });

            App.Messenger.Register <Course>(App.MSG_DISPLAY_COURSE, course =>
            {
                if (course != null)
                {
                    var tab = (from TabItem t in tabControl.Items where (string)t.Header == "Course " + course.Code select t).FirstOrDefault();
                    if (tab == null)
                    {
                        newTabForCourse(course, false);
                    }
                    else
                    {
                        //Dispatcher.InvokeAsync(() => tab.Focus());
                        tab.Focus();
                    }
                }
            });

            App.Messenger.Register <CourseOccurrence>(App.MSG_DISPLAY_ENCODAGE, courseoccurrence =>
            {
                if (courseoccurrence != null)
                {
                    var tab = (from TabItem t in tabControl.Items where (string)t.Header == "Présences" select t).FirstOrDefault();
                    if (tab == null)
                    {
                        newTabForCourseOccurrence(courseoccurrence);
                    }
                    else
                    {
                        //Dispatcher.InvokeAsync(() => tab.Focus());
                        tab.Focus();
                    }
                }
            });

            App.Messenger.Register(App.MSG_NEW_COURSE,
                                   () =>
            {
                // crée une nouvelle instance pour un nouveau client
                var course = App.Model.course.Create();
                newTabForCourse(course, true);
            });


            void newTabForCourse(Course course, bool isNew)
            {
                var tab = new TabItem()
                {
                    Header  = isNew ? "<New Course>" : "Course " + course.Code,
                    Content = new CoursesFormView(course, isNew)
                };

                tab.MouseDown += (o, e) =>
                {
                    if (e.ChangedButton == MouseButton.Middle && e.ButtonState == MouseButtonState.Pressed)
                    {
                        tabControl.Items.Remove(o);
                    }
                };
                tab.KeyDown += (o, e) =>
                {
                    if (e.Key == Key.W && Keyboard.IsKeyDown(Key.LeftCtrl))
                    {
                        tabControl.Items.Remove(o);
                    }
                };
                tabControl.Items.Add(tab);
                Dispatcher.InvokeAsync(() => tab.Focus());
            }

            void newTabForCourseOccurrence(CourseOccurrence courseoccurrence)
            {
                var tab = new TabItem()
                {
                    Header  = "Présences -" + courseoccurrence.Course.Code + "- " + courseoccurrence.Date.ToShortDateString(),
                    Content = new EncodageView(courseoccurrence)
                };

                tab.MouseDown += (o, e) =>
                {
                    if (e.ChangedButton == MouseButton.Middle && e.ButtonState == MouseButtonState.Pressed)
                    {
                        tabControl.Items.Remove(o);
                    }
                };
                tab.KeyDown += (o, e) =>
                {
                    if (e.Key == Key.W && Keyboard.IsKeyDown(Key.LeftCtrl))
                    {
                        tabControl.Items.Remove(o);
                    }
                };
                tabControl.Items.Add(tab);
                Dispatcher.InvokeAsync(() => tab.Focus());
            }
        }
        public void Load_Dataframe(DataSource ds)
        {
            logService.Info("Grid Loading started." + ds.Name);
            bool bo = false; //These two lines for testing refresh on new row addition. Remove them later.

            if (bo)
            {
                closeTab();
            }

            ///DocumentPanel panel = new DocumentPanel();
            //C1DockControlPanel c1panel = new C1DockControlPanel();//Anil
            StackPanel sp = new StackPanel(); //sp.Background = Brushes.Black;

            sp.Orientation = Orientation.Horizontal;
            //sp.HorizontalAlignment = HorizontalAlignment.Center;
            sp.VerticalAlignment = VerticalAlignment.Center;
            //sp.Margin = new Thickness(1, 1, 1, 1);

            Label lb           = new Label(); lb.FontWeight = FontWeights.DemiBold;
            var   tabtextcolor = new SolidColorBrush(Color.FromArgb(255, (byte)48, (byte)88, (byte)144));//Foreground="#FF1579DA"

            lb.Foreground = tabtextcolor;
            lb.Content    = Path.GetFileName(ds.FileName) + " (" + ds.Name + ")";//06Aug2012
            lb.ToolTip    = ds.FileName; lb.Margin = new Thickness(1, 1, 1, 1);
            //Button b = new Button(); b.Content="x";

            Image b = new Image(); b.MouseLeftButtonUp += new System.Windows.Input.MouseButtonEventHandler(b_MouseLeftButtonUp);

            b.ToolTip = "Close this dataset"; b.Height = 16.0; b.Width = 22.0;
            string packUri = "pack://application:,,,/BlueSky;component/Images/closetab.png";

            b.Source = new ImageSourceConverter().ConvertFromString(packUri) as ImageSource;

            sp.Children.Add(lb);
            sp.Children.Add(b); //sp.Children.Add(b);

            TabItem panel = new TabItem();

            //panel.Margin = new Thickness(1, 1, 1, 1);
            b.Tag = panel;                //for remove
            ///////triggers///08Feb2013
            Binding bind = new Binding(); //for close image to hide for inactive tabs

            bind.Source    = panel;
            bind.Path      = new PropertyPath("IsSelected");
            bind.Converter = new BooleanToVisibilityConverter();
            b.SetBinding(Image.VisibilityProperty, bind);

            Style st     = new Style(typeof(TabItem));
            var   brush1 = new SolidColorBrush(Color.FromArgb(255, (byte)212, (byte)227, (byte)242));//#FFD4E3F2

            st.Setters.Add(new Setter()
            {
                Property = TabItem.BackgroundProperty, Value = brush1
            });

            Trigger tg = new Trigger {
                Property = TabItem.IsSelectedProperty, Value = true
            };
            var brush2 = new SolidColorBrush(Color.FromArgb(255, (byte)234, (byte)239, (byte)245));//#FFEAEFF5

            tg.Setters.Add(new Setter()
            {
                Property = TabItem.BackgroundProperty, Value = brush2
            });

            st.Triggers.Add(tg);

            panel.Style = st;
            ///triggers///

            DataPanel datapanel = new DataPanel();

            datapanel.sortasccolnames  = sortasccolnames;
            datapanel.sortdesccolnames = sortdesccolnames;

            //IList list = new VirtualListDynamic(_analyticsService, ds);
            VirtualListDynamic vld = new VirtualListDynamic(_analyticsService, ds);

            vld.DataF = _analyticsService.GetDataFrame(ds);
            IList list = vld;

            panel.Tag      = ds; //panel.Tag = ds;
            datapanel.DS   = ds; //sending reference
            datapanel.Data = list;

            datapanel.Variables = ds.Variables;

            datapanel.statusbar.Text = ""; // "No Split";//03Dec2013 Status bar
            datapanel.DisableEnableAllNavButtons();
            panel.Header  = sp;            ///Path.GetFileName(ds.FileName);
            panel.Content = datapanel;
            docGroup.Items.Add(panel);     //panel
            panel.IsSelected      = true;
            docGroup.SelectedItem = panel;

            ///layoutManager.Activate(panel);
            //docGroup.UpdateLayout();
            //panel.UpdateLayout();

            //Following focus will not work until the main window is active. Say you called this function
            //from some dialog window created in C#(not analysis dialog). And the dialog is still on top
            //of the app while datagrid window will be in back. So following line will have no effect.
            panel.Focus();//15Oct2015
            logService.Info("Grid Loading finished.");
        }
        public void LoadNewDataSet(DataSource ds)
        {
            logService.Info("Grid Loading started." + ds.Name);
            bool bo = false; //These two lines for testing refresh on new row addition. Remove them later.

            if (bo)
            {
                closeTab();
            }

            if (!DataSourceExists(ds))
            {
                ///DocumentPanel panel = new DocumentPanel();
                //C1DockControlPanel c1panel = new C1DockControlPanel();//Anil
                StackPanel sp = new StackPanel(); //sp.Background = Brushes.Red;
                sp.Orientation         = Orientation.Horizontal;
                sp.HorizontalAlignment = HorizontalAlignment.Center;
                sp.VerticalAlignment   = VerticalAlignment.Center;
                //sp.Margin = new Thickness(1, 1, 1, 1);

                string sheetname = string.Empty;//29Apr2015
                if (ds.SheetName != null && ds.SheetName.Trim().Length > 0)
                {
                    sheetname = "{" + ds.SheetName + "}";
                }
                Label lb           = new Label(); lb.FontWeight = FontWeights.DemiBold;
                var   tabtextcolor = new SolidColorBrush(Color.FromArgb(255, (byte)48, (byte)88, (byte)144)); //Foreground="#FF1579DA"
                lb.Foreground = tabtextcolor;
                lb.Content    = Path.GetFileName(ds.FileName) + sheetname + " (" + ds.Name + ")";             //06Aug2012
                lb.ToolTip    = ds.FileName + sheetname;
                lb.Margin     = new Thickness(1, 1, 1, 1);
                //Button b = new Button(); b.Content="x";
                Image b = new Image(); b.MouseLeftButtonUp += new System.Windows.Input.MouseButtonEventHandler(b_MouseLeftButtonUp);
                b.ToolTip = "Close this dataset"; b.Height = 16.0; b.Width = 22.0;

                string packUri = "pack://application:,,,/BlueSky;component/Images/closetab.png";
                b.Source = new ImageSourceConverter().ConvertFromString(packUri) as ImageSource;
                sp.Children.Add(lb);
                sp.Children.Add(b); //sp.Children.Add(b);

                TabItem panel = new TabItem();
                //panel.Margin = new Thickness(1, 1, 1, 1);
                b.Tag = panel;                //for remove
                ///////triggers///08Feb2013
                Binding bind = new Binding(); //for close image to hide for inactive tabs
                bind.Source    = panel;
                bind.Path      = new PropertyPath("IsSelected");
                bind.Converter = new BooleanToVisibilityConverter();
                b.SetBinding(Image.VisibilityProperty, bind);

                Style st     = new Style(typeof(TabItem));
                var   brush1 = new SolidColorBrush(Color.FromArgb(255, (byte)212, (byte)227, (byte)242));//#FFD4E3F2
                st.Setters.Add(new Setter()
                {
                    Property = TabItem.BackgroundProperty, Value = brush1
                });

                Trigger tg = new Trigger {
                    Property = TabItem.IsSelectedProperty, Value = true
                };
                var brush2 = new SolidColorBrush(Color.FromArgb(255, (byte)234, (byte)239, (byte)245));//#FFEAEFF5
                tg.Setters.Add(new Setter()
                {
                    Property = TabItem.BackgroundProperty, Value = brush2
                });

                st.Triggers.Add(tg);

                panel.Style = st;
                ///triggers///

                DataPanel datapanel = new DataPanel();
                //datapanel.sortcolnames = sortcolnames;//11Apr2014
                //datapanel.sortorder = sortorder; //14Apr2014
                datapanel.sortasccolnames  = sortasccolnames;
                datapanel.sortdesccolnames = sortdesccolnames;

                VirtualListDynamic vld = new VirtualListDynamic(_analyticsService, ds);
                vld.DataF = _analyticsService.GetDataFrame(ds);
                if (vld.DataF == null)
                {
                    return;                    //03Aug2015 When SaveAs fails and tries to load the dataset closing the current one.
                }
                IList list = vld;
                panel.Tag      = ds; //panel.Tag = ds;
                datapanel.DS   = ds; //sending reference
                datapanel.Data = list;

                datapanel.Variables = ds.Variables;

                datapanel.statusbar.Text = ""; // "No Split";//03Dec2013 Status bar
                datapanel.DisableEnableAllNavButtons();
                panel.Header = sp;             ///Path.GetFileName(ds.FileName);

                panel.Content = datapanel;
                docGroup.Items.Add(panel);//panel
                //panel.IsSelected = true;
                docGroup.SelectedItem = panel;
                //docGroup.SelectedIndex = docGroup.Items.Count - 1;
                //docGroup.Background = Brushes.Red; /color around open dataset
                ///layoutManager.Activate(panel);

                panel.Focus(); //15Oct2015

                //foreach (TabItem tbit in docGroup.Items)
                //{
                //    tbit.IsSelected = false;
                //}
                //panel.IsSelected = true;
                //docGroup.SelectedIndex = docGroup.Items.Count - 1;
            }
            logService.Info("Grid Loading finished.");
        }
示例#26
0
        /// <summary>
        /// Interaction logic for ParameterDialog.xaml
        /// </summary>
        public ParameterDialog(DataForm Form)
        {
            InitializeComponent();
            this.form = Form;

            this.Title = Form.Title;

            Panel        Container  = this.DialogPanel;
            TabControl   TabControl = null;
            TabItem      TabItem;
            StackPanel   StackPanel;
            ScrollViewer ScrollViewer;
            Control      First = null;
            Control      Control;

            if (Form.HasPages)
            {
                TabControl = new TabControl();
                this.DialogPanel.Children.Add(TabControl);
                DockPanel.SetDock(TabControl, Dock.Top);
            }
            else
            {
                ScrollViewer = new ScrollViewer()
                {
                    VerticalScrollBarVisibility = ScrollBarVisibility.Auto
                };

                this.DialogPanel.Children.Add(ScrollViewer);
                DockPanel.SetDock(ScrollViewer, Dock.Top);

                StackPanel = new StackPanel()
                {
                    Margin = new Thickness(10, 10, 10, 10),
                };

                ScrollViewer.Content = StackPanel;
                Container            = StackPanel;
            }

            foreach (Networking.XMPP.DataForms.Layout.Page Page in Form.Pages)
            {
                if (TabControl != null)
                {
                    TabItem = new TabItem()
                    {
                        Header = Page.Label
                    };

                    TabControl.Items.Add(TabItem);

                    ScrollViewer = new ScrollViewer()
                    {
                        VerticalScrollBarVisibility = ScrollBarVisibility.Auto
                    };

                    TabItem.Content = ScrollViewer;

                    StackPanel = new StackPanel()
                    {
                        Margin = new Thickness(10, 10, 10, 10)
                    };

                    ScrollViewer.Content = StackPanel;
                    Container            = StackPanel;
                }
                else
                {
                    TabItem = null;
                }

                if (Form.Instructions != null && Form.Instructions.Length > 0)
                {
                    foreach (string Row in Form.Instructions)
                    {
                        TextBlock TextBlock = new TextBlock()
                        {
                            TextWrapping = TextWrapping.Wrap,
                            Margin       = new Thickness(0, 5, 0, 5),
                            Text         = Row
                        };

                        Container.Children.Add(TextBlock);
                    }
                }

                foreach (LayoutElement Element in Page.Elements)
                {
                    Control = this.Layout(Container, Element, Form);
                    if (First is null)
                    {
                        First = Control;
                    }
                }

                if (TabControl != null && TabControl.Items.Count == 1)
                {
                    TabItem.Focus();
                }
            }

            if (First != null)
            {
                First.Focus();
            }

            this.CheckOkButtonEnabled();
        }
示例#27
0
        void OrgItemQueueableViewModel_ItemsToQueue(object sender, Classes.ItemsToQueueArgs e)
        {
            TabItem tab = LogicalTreeHelper.GetParent(this) as TabItem;

            tab.Focus();
        }
示例#28
0
        private void OpenTab(CustomTabItem header, TabControlBase instance)
        {
            if (!CanOpenNew(instance))
            {
                return;
            }

            if (!IsFeatureEnabled(instance.GetType()))
            {
                var notAvailableHeader = new CustomTabItem {
                    Label = { Content = "Strona niedostępna" }
                };

                var functionNotAvailable = new FunctionNotAvailable(GetFeatureName(instance.GetType()));
                DispatcherHelper.CheckBeginInvokeOnUI(() =>
                {
                    var item = new TabItem
                    {
                        Header  = notAvailableHeader,
                        Content = functionNotAvailable
                    };

                    functionNotAvailable.TabItem = item;

                    notAvailableHeader.CloseButton.Click += CloseButton_Click;
                    functionNotAvailable.CloseRequested  += instance_CloseRequested;

                    TabCollection.Add(item);


                    item.Focus();
                });

                return;
            }

            DispatcherHelper.CheckBeginInvokeOnUI(() =>
            {
                var item = new TabItem
                {
                    Header  = header,
                    Content = instance
                };

                instance.TabItem = item;

                header.CloseButton.Click += CloseButton_Click;
                instance.CloseRequested  += instance_CloseRequested;

                if (instance is MainWindow)
                {
                    //  RemoveAllSaleHandlers();
                    //  header.CloseButton.Visibility = Visibility.Collapsed;
                    //
                    //  TabCollection.Insert(0, item);
                }
                else
                {
                    TabCollection.Add(item);
                }


                item.Focus();
            });
        }
示例#29
0
        /*
         * Protected override methods
         *
        */
        /// <summary>
        /// OnApplyTemplate override
        /// </summary>
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            // set up the event handler for the template parts
            _toggleButton = this.Template.FindName("PART_DropDown", this) as ToggleButton;
            if (_toggleButton != null)
            {
                // create a context menu for the togglebutton
                System.Windows.Controls.ContextMenu cm = new ContextMenu();
                cm.PlacementTarget = _toggleButton;
                cm.Placement = PlacementMode.Bottom;

                // create a binding between the togglebutton's IsChecked Property
                // and the Context Menu's IsOpen Property
                Binding b = new Binding();
                b.Source = _toggleButton;
                b.Mode = BindingMode.TwoWay;
                b.Path = new PropertyPath(ToggleButton.IsCheckedProperty);

                cm.SetBinding(ContextMenu.IsOpenProperty, b);

                _toggleButton.ContextMenu = cm;
                _toggleButton.Checked += DropdownButton_Checked;
            }

            ScrollViewer scrollViewer = this.Template.FindName("PART_ScrollViewer", this) as ScrollViewer;

            // set up event handlers for the RepeatButtons Click event
            RepeatButton repeatLeft = this.Template.FindName("PART_RepeatLeft", this) as RepeatButton;
            if (repeatLeft != null)
            {
                repeatLeft.Click += delegate
                {
                    if (scrollViewer != null)
                        scrollViewer.LineLeft();

                    GC.Collect();
                };
            }

            RepeatButton repeatRight = this.Template.FindName("PART_RepeatRight", this) as RepeatButton;
            if (repeatRight != null)
            {
                repeatRight.Click += delegate
                {
                    if (scrollViewer != null)
                        scrollViewer.LineRight();

                    GC.Collect();
                };
            }

            // set up the event handler for the 'New Tab' Button Click event
            ButtonBase button = this.Template.FindName("PART_NewTabButton", this) as ButtonBase;
            if (button != null)
            {
                button.Click += delegate
                {
                    int i = this.SelectedIndex;

                    TabItem item = new TabItem();
                    item.Header = "New Tab";

                    if (i == -1 || i == this.Items.Count - 1 || AddNewTabToEnd)
                        this.Items.Add(item);
                    else
                        this.Items.Insert(++i, item);

                    if (SelectNewTabOnCreate)
                    {
                        SelectedItem = item;

                        VirtualizingTabPanel itemsHost = Helper.FindVirtualizingTabPanel(this);
                        if (itemsHost != null)
                            itemsHost.MakeVisible(item, Rect.Empty);

                        item.Focus();

                        if (TabItemSelected != null)
                            TabItemSelected(this, new TabItemEventArgs(item));
                    }

                    if (TabItemAdded != null)
                        TabItemAdded(this, new TabItemEventArgs(item));
                };
            }
        }
示例#30
0
        internal bool SelectTabItem(TabItem ti)
        {
            var panel = Helper.FindVirtualizingTabPanel(this);

            if (panel != null)
                panel.MakeVisible(ti, Rect.Empty);

            SelectedItem = ti;

            var result = ti.Focus();

            if (TabItemSelected != null)
                TabItemSelected(this, new TabItemEventArgs(ti));

            return result;
        }
示例#31
0
        /*
         * Protected override methods
         * 
        */

        /// <summary>
        /// OnApplyTemplate override
        /// </summary>
        public override void OnApplyTemplate()
        {
            try
            {
                base.OnApplyTemplate();
                this.AllowDrop = true;
                _RowDefinition0 = this.Template.FindName("RowDefinition0", this) as RowDefinition;
                // set up the event handler for the template parts
                _toggleButton = this.Template.FindName("PART_DropDown", this) as ToggleButton;
                if (_toggleButton != null)
                {
                    // create a context menu for the togglebutton
                    ContextMenu cm = new ContextMenu();
                    cm.PlacementTarget = _toggleButton;
                    cm.Placement = PlacementMode.Bottom;

                    // create a binding between the togglebutton's IsChecked Property
                    // and the Context Menu's IsOpen Property
                    Binding b = new Binding();
                    b.Source = _toggleButton;
                    b.Mode = BindingMode.TwoWay;
                    b.Path = new PropertyPath(ToggleButton.IsCheckedProperty);

                    cm.SetBinding(ContextMenu.IsOpenProperty, b);

                    _toggleButton.ContextMenu = cm;
                    _toggleButton.Checked += DropdownButton_Checked;
                }

                ScrollViewer scrollViewer = this.Template.FindName("PART_ScrollViewer", this) as ScrollViewer;

                // set up event handlers for the RepeatButtons Click event
                RepeatButton repeatLeft = this.Template.FindName("PART_RepeatLeft", this) as RepeatButton;
                if (repeatLeft != null)
                {
                    repeatLeft.Click += delegate
                    {
                        if (scrollViewer != null)
                            scrollViewer.LineLeft();
                        GC.Collect();
                    };
                }

                RepeatButton repeatRight = this.Template.FindName("PART_RepeatRight", this) as RepeatButton;
                if (repeatRight != null)
                {
                    repeatRight.Click += delegate
                    {
                        if (scrollViewer != null)
                            scrollViewer.LineRight();
                        GC.Collect();
                    };
                }

                // set up the event handler for the 'New Tab' Button Click event
                ButtonBase button = this.Template.FindName("PART_NewTabButton", this) as ButtonBase;
                if (button != null)
                {
                    button.Click += delegate
                    {
                        VMukti.App.blnIsTwoPanel = false;
                        TabItem item = new TabItem();
                        item.Width = 250;
                        item.MinWidth = 250;
                        item.MaxWidth = 250;

                        item.OwnerID = VMuktiAPI.VMuktiInfo.CurrentPeer.ID;
                        item.OwnerPageIndex = VMukti.App.pageCounter++;

                        ctlPgTabHeader objPgTabHeader = new ctlPgTabHeader();
                        // objPgTabHeader.Title = "New Page - " + this.Items.Count.ToString();
                        //TextBlock txtBlock = new TextBlock();
                        //txtBlock.Text = "New Tab - " + this.Items.Count.ToString();
                        if (VMuktiAPI.VMuktiInfo.CurrentPeer.CurrentMachineIP == VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName || VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName == "")
                        {
                            objPgTabHeader.Title = "New Page";
                        }
                        else
                        {
                            objPgTabHeader.Title = VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName;
                        }
                        Image imgIcon = new Image();
                        imgIcon.Source = new BitmapImage(new Uri(@"\Skins\Images\VMuktiIcon.ico", UriKind.RelativeOrAbsolute));
                        imgIcon.Height = 16;
                        imgIcon.Width = 16;

                        //item.Header = txtBlock;
                        item.Header = objPgTabHeader;
                        item.Icon = imgIcon;

                        item.Content = NewTabControl();
                        if (VMuktiAPI.VMuktiInfo.CurrentPeer.ID > 0)
                        {
                            item.AddBuddy(VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName);
                            item.SetMaxCounter(0, VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName);
                        }
                        //if (i == -1 || i == this.Items.Count - 1 || AddNewTabToEnd)

                        this.Items.Add(item);
                        //else
                        //this.Items.Insert(++i, item);

                        if (SelectNewTabOnCreate)
                        {
                            SelectedItem = item;

                            VirtualizingTabPanel itemsHost = Helper.FindVirtualizingTabPanel(this);
                            if (itemsHost != null)
                                itemsHost.MakeVisible(item, Rect.Empty);

                            item.Focus();
                        }

                        if (TabItemAdded != null)
                            TabItemAdded(this, new TabItemEventArgs(item));
                    };
                    this.Drop += new DragEventHandler(TabControl_Drop);
                }

                LoadDefaultPage();
                objSendPageInfo = new DelSendPageInfo(SendPageInfo);

            }
            catch (Exception ex)
            {
                VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "OnapplyTemplate()", "Controls\\VMuktiGrid\\Page\\TabControl.cs");
            }
        }
示例#32
0
        public void LoadPage(int pageID, int confID)
        {
            try
            {
                VMukti.Business.VMuktiGrid.ClsPage objPage = VMukti.Business.VMuktiGrid.ClsPage.Get_PageInfo(pageID);

                TabItem item = new TabItem();
                item.ObjectID = pageID;
                item.IsSaved = true;
                item.OwnerID = VMuktiAPI.VMuktiInfo.CurrentPeer.ID;
                item.OwnerPageIndex = VMukti.App.pageCounter++;



                item.ConfID = confID;


                item.Width = 250;
                item.MinWidth = 250;
                item.MaxWidth = 250;

                ctlPgTabHeader objPgTabHeader = new ctlPgTabHeader();
                objPgTabHeader.Title = objPage.PageTitle;
                //TextBlock txtBlock = new TextBlock();
                //txtBlock.Text = "New Tab - " + this.Items.Count.ToString();

                //Image imgIcon = new Image();
                //imgIcon.Source = new BitmapImage(new Uri(@"\Skins\Images\VMuktiIcon.ico", UriKind.RelativeOrAbsolute));
                //imgIcon.Height = 16;
                //imgIcon.Width = 16;

                //item.Header = txtBlock;
                item.Header = objPgTabHeader;
                //  item.Icon = imgIcon;

                item.Content = NewTabControl(pageID);

                //this.ConfID = confID;
                //if (i == -1 || i == this.Items.Count - 1 || AddNewTabToEnd)
                #region Permission of rename or delet the page
                if (pageID == 1 || pageID == 2)
                {
                    item.CanDelete = false;
                    item.CanRename = false;

                }
                #endregion
                this.Items.Add(item);

                //else
                //this.Items.Insert(++i, item);

                if (SelectNewTabOnCreate)
                {
                   // SelectedItem = item;

                    VirtualizingTabPanel itemsHost = Helper.FindVirtualizingTabPanel(this);
                    if (itemsHost != null)
                        itemsHost.MakeVisible(item, Rect.Empty);

                   // item.Focus();
                }

                if (TabItemAdded != null)
                    TabItemAdded(this, new TabItemEventArgs(item));

                item.Focus();
                item.Loaded += new RoutedEventHandler(item_Loaded);
            }
            catch (Exception ex)
            {
                VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "LoadPage--2()", "Controls\\VMuktiGrid\\Page\\TabControl.cs");
            }
        }
示例#33
0
        public void LoadPage()
        {
            try
            {
                TabItem item = new TabItem();
                item.Width = 250;
                item.MinWidth = 250;
                item.MaxWidth = 250;

                item.OwnerID = VMuktiAPI.VMuktiInfo.CurrentPeer.ID;
                item.OwnerPageIndex = VMukti.App.pageCounter++;

                ctlPgTabHeader objPgTabHeader = new ctlPgTabHeader();
                if (VMuktiAPI.VMuktiInfo.CurrentPeer.CurrentMachineIP == VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName || VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName == "")
                {
                    objPgTabHeader.Title = "New Page";
                }
                else
                {
                    objPgTabHeader.Title = "Instant Meeting - "+VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName;
                }
                Image imgIcon = new Image();
                imgIcon.Source = new BitmapImage(new Uri(@"\Skins\Images\VMuktiIcon.ico", UriKind.RelativeOrAbsolute));
                imgIcon.Height = 16;
                imgIcon.Width = 16;

                item.Header = objPgTabHeader;
                item.Icon = imgIcon;

                item.Content = NewTabControl();
                if (VMuktiAPI.VMuktiInfo.CurrentPeer.ID > 0)
                {
                    item.AddBuddy(VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName);
                    item.SetMaxCounter(0, VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName);
                }

                this.Items.Add(item);


                if (SelectNewTabOnCreate)
                {
                    SelectedItem = item;

                    VirtualizingTabPanel itemsHost = Helper.FindVirtualizingTabPanel(this);
                    if (itemsHost != null)
                        itemsHost.MakeVisible(item, Rect.Empty);

                    item.Focus();
                }

                if (TabItemAdded != null)
                    TabItemAdded(this, new TabItemEventArgs(item));

                this.Drop += new DragEventHandler(TabControl_Drop);
               item.Loaded+=new RoutedEventHandler(item_Loaded);
            }

            catch (Exception ex)
            {
                VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "LoadPage()", "Controls\\VMuktiGrid\\Page\\TabControl.cs");
            }
        }
示例#34
0
        /// <summary>
        /// Interaction logic for ParameterDialog.xaml
        /// </summary>
        public ParameterDialog(DataForm Form)
        {
            InitializeComponent();
            this.form = Form;

            this.Title = Form.Title;

            Panel        Container  = this.DialogPanel;
            TabControl   TabControl = null;
            TabItem      TabItem;
            StackPanel   StackPanel;
            ScrollViewer ScrollViewer;

            if (Form.HasPages)
            {
                TabControl = new TabControl();
                this.DialogPanel.Children.Add(TabControl);
                DockPanel.SetDock(TabControl, Dock.Top);
            }
            else
            {
                ScrollViewer = new ScrollViewer()
                {
                    VerticalScrollBarVisibility = ScrollBarVisibility.Auto
                };

                this.DialogPanel.Children.Add(ScrollViewer);
                DockPanel.SetDock(ScrollViewer, Dock.Top);

                StackPanel = new StackPanel()
                {
                    Margin = new Thickness(10, 10, 10, 10),
                };

                ScrollViewer.Content = StackPanel;
                Container            = StackPanel;
            }

            foreach (Networking.XMPP.DataForms.Layout.Page Page in Form.Pages)
            {
                if (TabControl != null)
                {
                    TabItem = new TabItem()
                    {
                        Header = Page.Label
                    };

                    TabControl.Items.Add(TabItem);

                    ScrollViewer = new ScrollViewer()
                    {
                        VerticalScrollBarVisibility = ScrollBarVisibility.Auto
                    };

                    TabItem.Content = ScrollViewer;

                    StackPanel = new StackPanel()
                    {
                        Margin = new Thickness(10, 10, 10, 10)
                    };

                    ScrollViewer.Content = StackPanel;
                    Container            = StackPanel;
                }
                else
                {
                    TabItem = null;
                }

                foreach (LayoutElement Element in Page.Elements)
                {
                    this.Layout(Container, Element, Form);
                }

                if (TabControl != null && TabControl.Items.Count == 1)
                {
                    TabItem.Focus();
                }
            }

            this.CheckOkButtonEnabled();
        }