Esempio n. 1
0
        public void ObjectDeselected(object obj)
        {
            try
            {
                ObjectValues objval = obj as ObjectValues;

                foreach (TabItem currentTab in TabValues)
                {
                    if (currentTab.Tag.ToString() == objval.UniqueId)
                    {
                        TabValues.Remove(currentTab);
                        break;
                    }
                }

                if (TabValues.Count == 0)
                {
                    GridWidth = new GridLength(0);
                    TitleSpan = 1;
                }
            }
            catch (Exception GeneralException)
            {
            }
        }
Esempio n. 2
0
        public void ObjectSelected(object obj)
        {
            try
            {
                if (GridWidth == new GridLength(0))
                {
                    GridWidth = new GridLength(500);
                    TitleSpan = 2;
                }

                ObjectValues objval = obj as ObjectValues;

                if (TabValues.Count < MaxTags)
                {
                    TabItem temptab = new TabItem();
                    temptab.Header             = objval.ObjectName;
                    temptab.Tag                = objval.UniqueId;
                    temptab.MouseLeftButtonUp += new MouseButtonEventHandler(temptab_MouseLeftButtonUp);
                    temptab.Unloaded          += new RoutedEventHandler(temptab_Unloaded);
                    TabValues.Add(temptab);

                    if (isFirstSelected)
                    {
                        temptab_MouseLeftButtonUp(temptab, null);
                        isFirstSelected = false;
                    }
                }
                else
                {
                    Views.MessageBox msgbox;
                    ViewModels.MessageBoxViewModel mboxvmodel;
                    msgbox             = new Views.MessageBox();
                    mboxvmodel         = new MessageBoxViewModel("Information", "Maximum number of tabs Exceeded. Please Deselect some objects to add more.", msgbox, "MainWindow", Settings.GetInstance().Theme);
                    msgbox.DataContext = mboxvmodel;
                    msgbox.ShowDialog();
                    objval.isGridChecked = false;
                }
            }
            catch (Exception GeneralException)
            {
            }
        }