/// <summary> /// 点击菜单栏弹出指定页面 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void RadMenuItem_Click(object sender, Telerik.Windows.RadRoutedEventArgs e) { RadMenuItem mn = sender as RadMenuItem; if (mn.Tag == null) { return; } //去除重复项 foreach (var item in tabcontrols.Items) { RadTabItem child = item as RadTabItem; if (child.Header == mn.Header) { return; } } RadTabItem rb = new RadTabItem(); rb.Header = mn.Header; Frame newframe = new Frame(); newframe.NavigationUIVisibility = NavigationUIVisibility.Hidden; newframe.JournalOwnership = System.Windows.Navigation.JournalOwnership.OwnsJournal; newframe.BorderThickness = new Thickness(1); newframe.Source = new Uri(mn.Tag.ToString(), UriKind.Relative); rb.Content = newframe; rb.IsSelected = true; tabcontrols.Items.Add(rb); }
/// <summary> /// Creates or identifies the element that is used to display the given item. /// </summary> /// <param name="item">The item to get the container for.</param> /// <param name="itemCollection">The parent's <see cref="ItemCollection"/>.</param> /// <returns>The element that is used to display the given item.</returns> protected virtual RadTabItem GetContainerForItem(object item, ItemCollection itemCollection) { if (itemCollection == null) { throw new ArgumentNullException("itemCollection"); } RadTabItem container = item as RadTabItem; if (container != null && ((bool)container.GetValue(IsGeneratedProperty)) == false) { return(container); } foreach (RadTabItem tabItem in itemCollection) { if ((bool)tabItem.GetValue(IsGeneratedProperty)) { if (tabItem.Content == item) { return(tabItem); } } } return(null); }
private void GridList_MouseDoubleClick(object sender, MouseButtonEventArgs e) { API.BorowInfo b = GridList.SelectedItem as API.BorowInfo; API.Book bok = new API.Book(); bok.BAuthor = b.BAuthor; bok.BID = b.BID; bok.BookName = b.BookName; bok.BPrice = b.BPrice; bok.BTypeID = b.BTypeID; bok.BTypeName = b.BTypeName; bok.IsBorow = !b.IsReturn; bok.PubDate = b.PubDate; bok.Publisher = b.Publisher; bok.SerialNum = b.SerialNum; bok.SMPosition = b.SMPosition; RadTabItem rb = new RadTabItem(); rb.Header = bok.BookName;//"图书简介" //Frame newframe = new Frame(); //newframe.NavigationUIVisibility = NavigationUIVisibility.Hidden; //newframe.JournalOwnership = System.Windows.Navigation.JournalOwnership.OwnsJournal; //newframe.BorderThickness = new Thickness(1); //newframe.Source = new Uri("BookDetail.xaml", UriKind.Relative); BookDetail bd = new BookDetail(bok); rb.Content = bd; rb.IsSelected = true; Main.AddTabItem(rb); }
private void OnSaveChangesCompleted(IAsyncResult result) { DataServiceResponse resp = null; // Use the Dispatcher to ensure that the operation returns in the UI thread. this.Dispatcher.BeginInvoke(new OperationResultCallback(delegate { try { // Complete the save changes operation. //result.AsyncWaitHandle.WaitOne(); // ???? resp = this.context.EndSaveChanges(result); this.gridView.Rebind(); this.statusInfo.Text = "Datos actualizados exitosamente"; } catch (DataServiceRequestException ex) { this.statusInfo.Text = string.Format("Error actualizando datos: {0}", ex.ToString()); // ???? // if the prev operation fails, then // the next one fails as well (either same or different entity) // Is this a service issue? this.context.CancelRequest(result); } RadTabItem listadoTab = this.paisesTab.Items[0] as RadTabItem; this.paisesTab.SelectedItem = listadoTab; }), null); }
/// <summary> /// Override to change how RadTabItem's are prepared for items. /// </summary> /// <param name="item">The item to wrap in a RadTabItem</param> /// <param name="parent">The parent <see cref="DependencyObject"/></param> /// <returns>A tab item that wraps the supplied <paramref name="item"/></returns> protected virtual RadTabItem PrepareContainerForItem(object item, DependencyObject parent) { var container = item as RadTabItem; if (container == null) { var dataContext = GetDataContext(item); container = new RadTabItem { Content = item, Style = _hostControl.ItemContainerStyle, DataContext = dataContext, Header = dataContext }; var headerTemplateSelector = GetHeaderTemplateSelector(parent); if (headerTemplateSelector != null) { container.HeaderTemplate = headerTemplateSelector.SelectTemplate(dataContext, parent); } container.SetValue(IsGeneratedProperty, true); } return(container); }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { var intervals = value as IEnumerable; if (intervals != null) { var result = new List <RadTabItem>(); foreach (Interval interval in intervals) { var view = IoC.Resolve <IIntervalDesignerView>(); view.Model.Interval = interval; if (parameter != null && "nochoice".Equals(parameter.ToString())) { view.Model.AllowSingleOrMultipleVideoSelection = false; } var tabItem = new RadTabItem(); tabItem.SetValue(RadTabItem.TabOrientationProperty, Orientation.Horizontal); tabItem.Header = interval.Title; tabItem.Content = view; result.Add(tabItem); } return(result); } return(null); }
private void RadTabControl_SelectionChanged(object sender, Telerik.Windows.Controls.RadSelectionChangedEventArgs e) { RadTabItem item = tabMenu.SelectedItem as RadTabItem; datagridPending.SelectedItem = null; datagridDelivered.SelectedItem = null; datagridDeclined.SelectedItem = null; }
private void RadTabControl_SelectionChanged(object sender, Telerik.Windows.Controls.RadSelectionChangedEventArgs e) { RadTabItem item = Opciones.SelectedItem as RadTabItem; uid = Convert.ToInt16(item.Uid); //materiaTemaSelect = Convert.ToInt16(item.Tag); this.LaunchBusyIndicator(); }
/// <summary> /// Gets the item contained in the <see cref="RadTabItem"/>. /// </summary> /// <param name="tabItem">The container item.</param> /// <returns>The item contained in the <paramref name="tabItem"/> if it was generated automatically by the behavior; otherwise <paramref name="tabItem"/>.</returns> protected virtual object GetContainedItem(RadTabItem tabItem) { if (tabItem == null) throw new ArgumentNullException("tabItem"); if ((bool)tabItem.GetValue(IsGeneratedProperty)) { return tabItem.Content; } return tabItem; }
public BankruptcyCaseDetailUC(BankruptcyCase _BankruptcyCase, RadTabControl rtc, RadTabItem rt) { _selectedBankruptcyCase = _BankruptcyCase; _rtc = rtc; _rt = rt; InitializeComponent(); GridMain.DataContext = _selectedBankruptcyCase; }
private void CheckNotifications(object state) { try { Dispatcher.BeginInvoke(new Action(() => { bool hastNotification = NotificationServiceClient.SystemHasNotification(Lib.Static.CurrentUser.UserId); if (hastNotification) { horn.Start(); List <string> tabs = NotificationServiceClient.TabsWithActiveNotification(Lib.Static.CurrentUser.UserId); foreach (var item in TabControlIOs.Items) { RadTabItem tabItem = (RadTabItem)item; TabHeaderUserControl tabHeader = (TabHeaderUserControl)tabItem.Header; string header = tabHeader.GetHeader(); if (tabs.Any(x => x.Equals(header))) { tabHeader.ShowAlarmAnimation(); } else { tabHeader.HideAlarmAnimation(); } } BlackAllTabs = true; } else { horn.Stop(); if (BlackAllTabs) { foreach (var item in TabControlIOs.Items) { RadTabItem tabItem = (RadTabItem)item; TabHeaderUserControl tabHeader = (TabHeaderUserControl)tabItem.Header; tabHeader.HideAlarmAnimation(); } BlackAllTabs = false; } } })); } catch (Exception ex) { Logger.LogIndustrialMonitoring(ex); } }
public DealerDetailUC(Dealer _dealer, RadTabControl rtc, RadTabItem rt) { InitializeComponent(); blnLoadStates = false; _rtc = rtc; _rt = rt; try { System.Net.IPHostEntry e = System.Net.Dns.GetHostEntry("www.bing.com"); } catch { MainMap.Manager.Mode = AccessMode.CacheOnly; //MainMap.CacheLocation = "J:\\"; MessageBox.Show("No internet connection avaible, going to CacheOnly mode.", "GMap.NET - Demo.WindowsPresentation", MessageBoxButton.OK, MessageBoxImage.Warning); } // setup zoom min/max sliderZoom.Maximum = MainMap.MaxZoom; sliderZoom.Minimum = MainMap.MinZoom; if (_dealer == null) { _selectedDealer = new Dealer(); _selectedDealer.CurrentCustomer = true; _selectedDealer.MaxDistance = 100; } else { _selectedDealer = _dealer; } LoadDealer(); LoadPreviousMailings(); // set cache mode only if no internet avaible // map events //MainMap.OnCurrentPositionChanged += new CurrentPositionChanged(MainMap_OnCurrentPositionChanged); //MainMap.OnTileLoadComplete += new TileLoadComplete(MainMap_OnTileLoadComplete); //MainMap.OnTileLoadStart += new TileLoadStart(MainMap_OnTileLoadStart); //MainMap.OnMapTypeChanged += new MapTypeChanged(MainMap_OnMapTypeChanged); //MainMap.MouseMove += new System.Windows.Input.MouseEventHandler(MainMap_MouseMove); //MainMap.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(MainMap_MouseLeftButtonDown); //MainMap.Loaded += new RoutedEventHandler(MainMap_Loaded); //MainMap.MouseEnter += new MouseEventHandler(MainMap_MouseEnter); //if (_dealer.MaxDistance != null && _dealer.MaxDistance > 0.0 && _dealer.Latitude != null) // AddCircleZone((double)_dealer.MaxDistance, new PointLatLng(){Lat=(double)_dealer.Latitude, Lng=(double)_dealer.Longitude}); }
private void ItemVoucherImport_Click(object sender, Telerik.Windows.RadRoutedEventArgs e) { UCs.UcMgtZWPZK uc = new UCs.UcMgtZWPZK(); RadTabItem item = new RadTabItem() { Content = uc, Header = ((RadPanelBarItem)sender).Header }; TclMain.Items.Add(item); item.IsSelected = true; }
/// <summary> /// Undoes the effects of the <see cref="PrepareContainerForItem"/> method. /// </summary> /// <param name="tabItem">The container element for the item.</param> protected virtual void ClearContainerForItem(RadTabItem tabItem) { if (tabItem == null) { throw new ArgumentNullException("tabItem"); } if (( bool )tabItem.GetValue(IsGeneratedProperty)) { tabItem.Content = null; } }
private void GridList_MouseDoubleClick(object sender, MouseButtonEventArgs e) { API.Book bok = GridList.SelectedItem as API.Book; RadTabItem rb = new RadTabItem(); rb.Header = bok.BookName; rb.Content = new BookDetail(bok); rb.IsSelected = true; Main.AddTabItem(rb); }
private void btnAddNewDealer_Click(object sender, RoutedEventArgs e) { RadTabItem tabToAdd = new RadTabItem(); tabToAdd.Header = "Add New Dealer.."; tabToAdd.Margin = new System.Windows.Thickness(0, 0, 5, 0); tabToAdd.Content = new DealerDetailUC(null, tabCtrlMain, tabToAdd); tabToAdd.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Stretch; //should only be one addTabItemMenu(tabToAdd); this.tabCtrlMain.Items.Add(tabToAdd); this.tabCtrlMain.SelectedItem = tabToAdd; }
/// <summary> /// Gets the item contained in the <see cref="RadTabItem"/>. /// </summary> /// <param name="tabItem">The container item.</param> /// <returns>The item contained in the <paramref name="tabItem"/> if it was generated automatically by the behavior; otherwise <paramref name="tabItem"/>.</returns> protected virtual object GetContainedItem(RadTabItem tabItem) { if (tabItem == null) { throw new ArgumentNullException("tabItem"); } if (( bool )tabItem.GetValue(IsGeneratedProperty)) { return(tabItem.Content); } return(tabItem); }
private void closeTabItem(RadTabItem item) { if (item != null) { // find the parent tab control RadTabControl tabControl = item.Parent as RadTabControl; if (tabControl != null) { tabControl.Items.Remove(item); } this.tabCtrlMain.SelectedItem = tabControl.Items[1]; // remove tabItem } }
private void GridContextMenu_ItemClick(object sender, Telerik.Windows.RadRoutedEventArgs e) { MenuItem item = (e.OriginalSource as RadMenuItem).DataContext as MenuItem; switch (item.Text) { case "Detalle": if (this.checkBox.IsChecked.HasValue) { if (this.checkBox.IsChecked.Value) { return; } } //this.gridView.BeginInsert(); RadTabItem detalleTab = this.paisesTab.Items[1] as RadTabItem; detalleTab.IsEnabled = true; this.checkBox.IsEnabled = false; //detalleTab.Visibility = Visibility.Visible; //detalleTab.Focus(); //this.txtId.Text = if (this.ClickedRow != null) { // Clicked not on a valid row if (this.ClickedRow.DataContext == null) { return; } // To refactor! // Clicked on a new row but it is empty Pais pais = this.ClickedRow.DataContext as Pais; if (pais == null) { return; } this.txtId.Text = pais.id.ToString(); this.txtNombre.Text = pais.nombre; this.txtPrefijo.Text = pais.prefijo.HasValue ? pais.prefijo.Value.ToString() : ""; } this.paisesTab.SelectedItem = detalleTab; break; case "Provincias": this.gridView.BeginEdit(); break; } }
/// <summary> /// Override to change how RadTabItem's are prepared for items. /// </summary> /// <param name="item">The item to wrap in a RadTabItem</param> /// <param name="parent">The parent <see cref="DependencyObject"/></param> /// <returns>A tab item that wraps the supplied <paramref name="item"/></returns> protected virtual RadTabItem PrepareContainerForItem(object item, DependencyObject parent) { RadTabItem container = item as RadTabItem; if (container == null) { object dataContext = GetDataContext(item); container = new RadTabItem(); container.Content = item; container.Style = RadTabControlRegionAdapter.GetItemContainerStyle(parent); container.Header = dataContext; container.SetValue(IsGeneratedProperty, true); } return(container); }
void Main_AddRTItem(RadTabItem rb) { bool has = false; foreach (var item in tabcontrols.Items) { RadTabItem child = item as RadTabItem; if (child.Header == rb.Header) { has = true; break; } } if (!has) { tabcontrols.Items.Add(rb); } }
private void GridViewBankruptcyCases_KeyDown(object sender, KeyEventArgs e) { var grid = (RadGridView)sender; if (Key.Enter == e.Key) { foreach (var row in grid.SelectedItems) { RadTabItem tabToAdd = new RadTabItem(); tabToAdd.Header = "Case: " + ((BankruptcyCase)row).FullName; tabToAdd.Margin = new System.Windows.Thickness(0, 0, 5, 0); //should only be one this.tabCtrlMain.Items.Add(tabToAdd); this.tabCtrlMain.SelectedItem = tabToAdd; } } }
private void btnOpenCase_Click(object sender, RoutedEventArgs e) { RadButton _button = (RadButton)sender; int ID = ((BankruptcyCase)_button.DataContext).ID; BankruptcyCase _selectedBankruptcyCase = BankruptcyCaseService.GetByID(ID); //MessageBox.Show("The double-clicked row is " + ((PacerImportTransaction)row.DataContext).ID); RadTabItem tabToAdd = new RadTabItem(); tabToAdd.Header = "Case: " + _selectedBankruptcyCase.FullName; tabToAdd.Margin = new System.Windows.Thickness(0, 0, 5, 0); tabToAdd.Content = new BankruptcyCaseDetailUC(_selectedBankruptcyCase, tabCtrlMain, tabToAdd); tabToAdd.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Stretch; //should only be one addTabItemMenu(tabToAdd); this.tabCtrlMain.Items.Add(tabToAdd); this.tabCtrlMain.SelectedItem = tabToAdd; }
private void addTabItemMenu(RadTabItem item) { ContextMenu contextMenu1; contextMenu1 = new ContextMenu(); MenuItem menuItem1; menuItem1 = new MenuItem(); //add menu item in context menu contextMenu1.Items.Add(menuItem1); menuItem1.Header = "Close"; // define name of context menu //Create Tab Items // define clicking event of menuitem menuItem1.Click += delegate { closeTabItem(item); }; // Incorporate context menu with tab items item.ContextMenu = contextMenu1; }
private void OnViewsChanged(object sender, NotifyCollectionChangedEventArgs e) { if (e.Action == NotifyCollectionChangedAction.Add) { foreach (object newItem in e.NewItems) { RadTabItem tabItem = this.PrepareContainerForItem(newItem, this.hostControl); this.hostControl.Items.Add(tabItem); } } else if (e.Action == NotifyCollectionChangedAction.Remove) { foreach (object oldItem in e.OldItems) { RadTabItem tabItem = this.GetContainerForItem(oldItem, this.hostControl.Items); this.hostControl.Items.Remove(tabItem); this.ClearContainerForItem(tabItem); } } }
private void GridList_MouseDoubleClick(object sender, MouseButtonEventArgs e) { API.Book bok = GridList.SelectedItem as API.Book; RadTabItem rb = new RadTabItem(); rb.Header = bok.BookName;//"图书简介" //Frame newframe = new Frame(); //newframe.NavigationUIVisibility = NavigationUIVisibility.Hidden; //newframe.JournalOwnership = System.Windows.Navigation.JournalOwnership.OwnsJournal; //newframe.BorderThickness = new Thickness(1); //newframe.Source = new Uri("BookDetail.xaml", UriKind.Relative); BookDetail bd = new BookDetail(bok); rb.Content = bd; rb.IsSelected = true; Main.AddTabItem(rb); }
void Products_SelectionChanged(object sender, System.Windows.RoutedEventArgs e) { RadTabItem item = Products.SelectedItem as RadTabItem; if (item == null) { return; } if (item.Tag.Equals("0")) { this.Category1.ItemsSource = ProductsDataSource.GetProductsByCategory("1"); } else if (item.Tag.Equals("1")) { this.Category2.ItemsSource = ProductsDataSource.GetProductsByCategory("2"); } else if (item.Tag.Equals("2")) { this.Category3.ItemsSource = ProductsDataSource.GetProductsByCategory("3"); } }
private void GridViewBankruptcyCases_MouseDoubleClick(object sender, MouseButtonEventArgs e) { FrameworkElement originalSender = e.OriginalSource as FrameworkElement; if (originalSender != null) { var row = originalSender.ParentOfType <Telerik.Windows.Controls.GridView.GridViewRow>(); if (row != null) { //MessageBox.Show("The double-clicked row is " + ((PacerImportTransaction)row.DataContext).ID); RadTabItem tabToAdd = new RadTabItem(); tabToAdd.Header = "Case: " + (((BankruptcyCase)row.DataContext)).FullName; tabToAdd.Margin = new System.Windows.Thickness(0, 0, 5, 0); tabToAdd.Content = new BankruptcyCaseDetailUC((BankruptcyCase)row.DataContext, tabCtrlMain, tabToAdd); tabToAdd.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Stretch; //should only be one addTabItemMenu(tabToAdd); this.tabCtrlMain.Items.Add(tabToAdd); this.tabCtrlMain.SelectedItem = tabToAdd; } } }
private void SynchronizeItems() { List <object> existingItems = new List <object>(); if (this.hostControl.Items.Count > 0) { // Control must be empty before "Binding" to a region foreach (object childItem in this.hostControl.Items) { existingItems.Add(childItem); } } foreach (object view in this.Region.Views) { RadTabItem tabItem = this.PrepareContainerForItem(view, this.hostControl); this.hostControl.Items.Add(tabItem); } foreach (object existingItem in existingItems) { this.Region.Add(existingItem); } }
/// <summary> /// Override to change how RadTabItem's are prepared for items. /// </summary> /// <param name="item">The item to wrap in a RadTabItem</param> /// <param name="parent">The parent <see cref="DependencyObject"/></param> /// <returns>A tab item that wraps the supplied <paramref name="item"/></returns> protected virtual RadTabItem PrepareContainerForItem(object item, DependencyObject parent) { RadTabItem container = item as RadTabItem; if (container == null) { object dataContext = GetDataContext(item); container = new RadTabItem(); container.Content = item; container.Style = RadTabControlRegionAdapter.GetItemContainerStyle(parent); container.Header = dataContext; container.SetValue(IsGeneratedProperty, true); } return container; }
public void OpenTimesheetListTab(int userdId) { //Check whether we already have this issue open bool tabAlreadyOpen = false; foreach (RadTabItem tabItem in MainTabControl.Items) { var view = tabItem.Content as TimesheetListView; if (view != null && tabItem.DropDownContent.Equals("Timesheets")) { //Issue is already open so select it tabItem.IsSelected = true; tabAlreadyOpen = true; break; } } if (tabAlreadyOpen == false) { var ti = new RadTabItem(); var th = new TabHeader(ti, this); th.headerLabel.Content = string.Format("Timesheets"); ti.Header = th; ti.Content = new TimesheetListView(userdId); ti.IsSelected = true; ti.DropDownContent = th.headerLabel.Content.ToString(); MainTabControl.Items.Add(ti); } }
private void OpenUriReport(Uri uri) { //Check whether we already have this issue open var ti = new RadTabItem(); var th = new TabHeader(ti, this); th.headerLabel.Content = string.Format("Report [{0}]", "Name"); ti.Header = th; ti.Content = new ReportTab(uri); ti.IsSelected = true; ti.DropDownContent = th.headerLabel.Content.ToString(); MainTabControl.Items.Add(ti); }
private void OpenPreferredEquipmentTab(CommonUtils.EquipmentTypeCode equipmentTypeCode) { //Check whether we already have this issue open bool tabAlreadyOpen = false; foreach (RadTabItem tabItem in MainTabControl.Items) { var view = tabItem.Content as PreferredEquipmetListView; if (view != null) { //Issue is already open so select it tabItem.IsSelected = true; tabAlreadyOpen = true; break; } } if (tabAlreadyOpen == false) { var ti = new RadTabItem(); var th = new TabHeader(ti, this); th.headerLabel.Content = string.Format("{0} Preferred Equipment", GetPreferredEquipmentTitle(equipmentTypeCode)); ti.Header = th; ti.Content = new PreferredEquipmetListView(equipmentTypeCode); ti.IsSelected = true; ti.DropDownContent = th.headerLabel.Content.ToString(); MainTabControl.Items.Add(ti); } }
private void OpenPipeSummaryListTab(List<int> ids) { //Check whether we already have this issue open bool tabAlreadyOpen = false; foreach (RadTabItem tabItem in MainTabControl.Items) { var view = tabItem.Content as PipeSummaryListView; if (view != null) { //Issue is already open so select it tabItem.IsSelected = true; tabAlreadyOpen = true; break; } } if (tabAlreadyOpen == false) { var ti = new RadTabItem(); var th = new TabHeader(ti, this); th.headerLabel.Content = string.Format("Pipes"); ti.Header = th; ti.Content = new PipeSummaryListView(ids); ti.IsSelected = true; ti.DropDownContent = th.headerLabel.Content.ToString(); MainTabControl.Items.Add(ti); } }
private void OpenMobilePlantTab(QuickMobilePlant mobilePlant) { if (mobilePlant == null || !mobilePlant.IsActive) { return; } //Check whether we already have this issue open bool tabAlreadyOpen = false; foreach (RadTabItem tabItem in MainTabControl.Items) { var mobilePlantPanel = tabItem.Content as MobilePlantPanel; if (mobilePlantPanel != null && mobilePlantPanel.ViewModel.Equipment != null) { if (mobilePlantPanel.ViewModel.Equipment.Id == mobilePlant.Id) { //Issue is already open so select it tabItem.IsSelected = true; tabAlreadyOpen = true; break; } } } if (tabAlreadyOpen == false) { var ti = new RadTabItem(); var th = new TabHeader(ti, this); th.headerLabel.Content = String.Format("Mobile Plant: {0}", mobilePlant.Name); ti.Header = th; ti.Content = new MobilePlantPanel(mobilePlant.Id); ti.IsSelected = true; ti.DropDownContent = th.headerLabel.Content.ToString(); MainTabControl.Items.Add(ti); if (CMS.EffectivePrivileges.MobilePlantTab.CanModify || CMS.EffectivePrivileges.AdminTab.CanModify) { BuildTabLockEventHandler(th.headerLabel.Content.ToString()); } } }
private void OpenIssueGraphicSummaryListTab(List<int> ids, string graphicName) { //Check whether we already have this issue open bool tabAlreadyOpen = false; foreach (RadTabItem tabItem in MainTabControl.Items) { var view = tabItem.Content as IssueSummaryListView; if (view != null && tabItem.Name.Contains(graphicName)) { //Issue is already open so select it tabItem.IsSelected = true; tabAlreadyOpen = true; break; } } if (tabAlreadyOpen == false) { var ti = new RadTabItem(); var th = new TabHeader(ti, this); th.headerLabel.Content = string.Format("Issues for: {0}", graphicName); ti.Header = th; ti.Content = new IssueSummaryListView(ids, CommonUtils.SummaryViewType.GraphicRelatedIssues, string.Empty); ti.IsSelected = true; ti.DropDownContent = th.headerLabel.Content.ToString(); MainTabControl.Items.Add(ti); } }
public TabHeader(RadTabItem radTabItem, MainPage mainPage) { mRadTabItem = radTabItem; mMainPage = mainPage; InitializeComponent(); }
private void txtPathMockup_TextChanged(object sender, TextChangedEventArgs e) { if (txtPathMockup.Text.Length > 0) { #region Get product type: men, women, mug, pillow, ... var folderRoot = Directory.EnumerateDirectories(txtPathMockup.Text); // men, women, mug, pillow List <string> productType = new List <string>(); foreach (var item in folderRoot) { string[] splitItem = item.Split("\\"); string type = FirstCharToUpper(splitItem[splitItem.Length - 1]); productType.Add(type); } mockupTabControl.ItemsSource = productType; #endregion #region Get product kind: classic, hoodie, longsleeve, sweatshirt, ... foreach (var tabItem in mockupTabControl.ItemsSource) { RadTabItem radTabItem = mockupTabControl.ItemContainerGenerator.ContainerFromItem(tabItem) as RadTabItem; // classic, hoodie, longsleeve, sweatshirt of MEN, WOMEN List <string> folderProductType = Directory.EnumerateDirectories(txtPathMockup.Text + "\\" + radTabItem.Header.ToString().ToLower()).ToList <string>(); List <string> shirtType = new List <string>(); // 01, 02, 03, ... foreach (var typeItem in folderProductType) { string[] splitItem = typeItem.Split("\\"); string type = FirstCharToUpper(splitItem[splitItem.Length - 1]); shirtType.Add(type); } // if product type MEN, WOMEN if (folderProductType.Count > 0) { RadTabControl radTabControl = new RadTabControl() { //ItemsSource = shirtType, BorderThickness = new Thickness(0) }; try { // classic, hoodie, ... for (int i = 0; i < shirtType.Count; i++) { #region Setting listbox // Setting listbox ListBox listBoxImage = new ListBox() { Height = 360, BorderThickness = new Thickness(0) }; ScrollViewer.SetHorizontalScrollBarVisibility(listBoxImage, ScrollBarVisibility.Disabled); ScrollViewer.SetVerticalScrollBarVisibility(listBoxImage, ScrollBarVisibility.Auto); // Config listbox item panel FrameworkElementFactory ugTemplate = new FrameworkElementFactory(typeof(UniformGrid), "UniformGrid"); //ugTemplate.SetValue(UniformGrid.RowsProperty, 3); ugTemplate.SetValue(UniformGrid.ColumnsProperty, 4); listBoxImage.ItemsPanel = new ItemsPanelTemplate(ugTemplate); // Config listbox itemTemplate listBoxImage.ItemTemplate = (DataTemplate)this.Resources["TabItemTemplate"]; // Setting add event selection changed listBoxImage.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.ListBoxMock_SelectionChanged); #endregion // Import image List <Mockup> mockups = new List <Mockup>(); List <string> folderType = Directory.EnumerateDirectories(txtPathMockup.Text + @"\" + radTabItem.Header.ToString() + @"\" + shirtType[i]).ToList <string>(); List <string> fileImage = Directory.GetFiles(txtPathMockup.Text + @"\" + radTabItem.Header.ToString() + @"\" + shirtType[i], "*", SearchOption.AllDirectories).ToList <string>(); ScrollViewer.SetVerticalScrollBarVisibility(listBoxImage, ScrollBarVisibility.Auto); foreach (var imgFile in fileImage) { string[] splitFodler = imgFile.Split("\\"); string fileName = splitFodler[splitFodler.Length - 1].Split('.')[0]; mockups.Add(new Mockup() { MockupName = fileName, MockupSymbolPath = imgFile, }); } listBoxImage.ItemsSource = mockups; RadTabItem tempTabItem = new RadTabItem() { Header = shirtType[i], Content = listBoxImage, }; radTabControl.Items.Add(tempTabItem); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } StyleManager.SetTheme(radTabControl, new FluentTheme()); radTabItem.Content = radTabControl; } else { List <string> imageProduct = Directory.EnumerateFiles(txtPathMockup.Text + "\\" + radTabItem.Header.ToString().ToLower()).ToList <string>(); MessageBox.Show(imageProduct[0]); List <Mockup> mockups = new List <Mockup>(); try { #region Setting ListBox // Setting listbox ListBox listBoxImage = new ListBox() { Height = 396, BorderThickness = new Thickness(0) }; // Setting scroll item ScrollViewer.SetHorizontalScrollBarVisibility(listBoxImage, ScrollBarVisibility.Disabled); // Config listbox item panel FrameworkElementFactory ugTemplate = new FrameworkElementFactory(typeof(UniformGrid), "UniformGrid"); ugTemplate.SetValue(UniformGrid.RowsProperty, 3); ugTemplate.SetValue(UniformGrid.ColumnsProperty, 4); listBoxImage.ItemsPanel = new ItemsPanelTemplate(ugTemplate); // Config listbox itemTemplate listBoxImage.ItemTemplate = (DataTemplate)this.Resources["TabItemTemplate"]; // Setting add event selection changed listBoxImage.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.ListBoxMock_SelectionChanged); if (imageProduct.Count < 8) { ScrollViewer.SetVerticalScrollBarVisibility(listBoxImage, ScrollBarVisibility.Hidden); } else { ScrollViewer.SetVerticalScrollBarVisibility(listBoxImage, ScrollBarVisibility.Visible); } #endregion // read file image mockup foreach (var imgFile in imageProduct) { var designsName = System.IO.Path.GetFileName(imgFile); mockups.Add(new Mockup() { MockupSymbolPath = imgFile, MockupName = designsName.Split('.')[0], IsSelected = false }); } listBoxImage.ItemsSource = mockups; radTabItem.Content = listBoxImage; } catch (Exception ex) { } } mockupTabControl.SelectedIndex = 0; } #endregion } }
private void OptionsGrid_RowDetailsVisibilityChanged(object sender, GridViewRowDetailsEventArgs e) { if (e.Visibility == Visibility.Visible) { GridViewRow row = e.Row as GridViewRow; if (row != null) { SimplePAG ed = row.DataContext as SimplePAG; decimal retailprice = 0; if (row != null && ed != null) { StackPanel panel = (StackPanel)e.DetailsElement; RadTabControl rtc = (RadTabControl)panel.FindName("tabDesc"); CheckBox chksitework = (CheckBox)panel.FindName("chkSitework"); RadTabItem im = (RadTabItem)rtc.FindName("tabstandarddesc"); TextBox txtdesc = (TextBox)im.Content; RadTabItem imadd = (RadTabItem)rtc.FindName("tabadditionaldesc"); Image addionalimage = (Image)imadd.FindName("imgAdditional"); if (ed.AdditionalNotes.Trim() != "") { addionalimage.Visibility = Visibility.Visible; } else { addionalimage.Visibility = Visibility.Collapsed; } RadTabItem imextra = (RadTabItem)rtc.FindName("tabextradesc"); Image extraimage = (Image)imadd.FindName("imgExtra"); if (ed.ExtraDescription.Trim() != "") { extraimage.Visibility = Visibility.Visible; } else { extraimage.Visibility = Visibility.Collapsed; } RadTabItem iminternal = (RadTabItem)rtc.FindName("tabinternaldesc"); Image internalimage = (Image)imadd.FindName("imgInternal"); if (ed.InternalDescription.Trim() != "") { internalimage.Visibility = Visibility.Visible; } else { internalimage.Visibility = Visibility.Collapsed; } RadComboBox cmbcategory = (RadComboBox)panel.FindName("cmbCategory"); GetNonStandardAreas(cmbcategory, ed.AreaID); RadComboBox cmbPriceDisplay = (RadComboBox)panel.FindName("cmbPriceDisplay"); cmbPriceDisplay.ItemsSource = ((AddOptionViewModel)LayoutRoot.DataContext).EstimateNonStandardPriceDisplayCode; cmbPriceDisplay.SelectedValue = ed.PriceDisplayCodeId; RadComboBox cmbgroup = (RadComboBox)panel.FindName("cmbGroup"); GetNonStandardGroups(ed.AreaID, cmbgroup, ed.GroupID); if (ed.ItemAllowToChangeDisplayCode) { TextBlock txtPriceDisplay = (TextBlock)panel.FindName("txtPriceDisplay"); txtPriceDisplay.Visibility = System.Windows.Visibility.Collapsed; cmbPriceDisplay.Visibility = System.Windows.Visibility.Visible; } else { TextBlock txtPriceDisplay = (TextBlock)panel.FindName("txtPriceDisplay"); txtPriceDisplay.Visibility = System.Windows.Visibility.Visible; cmbPriceDisplay.Visibility = System.Windows.Visibility.Collapsed; } if (ed.AreaName.ToUpper().Contains("NON STANDARD REQUEST")) { cmbcategory.IsEnabled = true; cmbgroup.IsEnabled = true; if (txtdesc != null) { txtdesc.IsReadOnly = false; } chksitework.IsEnabled = true; } else { cmbcategory.IsEnabled = false; chksitework.IsEnabled = false; cmbgroup.IsEnabled = false; } if (ed.ItemAllowToChangeDescription) { txtdesc.IsReadOnly = false; } else { if (txtdesc != null) { txtdesc.IsReadOnly = true; } } TextBox txtPrice = (TextBox)panel.FindName("txtPrice"); retailprice = decimal.Parse(txtPrice.Text); if (!ed.ItemAllowToChangePrice) { txtPrice.IsReadOnly = true; } else { txtPrice.IsReadOnly = false; } TextBox txtQty = (TextBox)panel.FindName("txtQuantity"); if (!ed.ItemAllowToChangeQuantity) { txtQty.IsReadOnly = true; } else { txtQty.IsReadOnly = false; } TextBox txtCost = (TextBox)panel.FindName("txtCostExcGST"); TextBlock lblCost = (TextBlock)panel.FindName("lblcost"); TextBox txtMargin = (TextBox)panel.FindName("txtMargin"); TextBlock lblMargin = (TextBlock)panel.FindName("lblmargin"); if ((App.Current as App).CurrentRoleAccessModule.AccessMarginModule && ed.ItemAllowToChangePrice)// only sales estimator can change cost { txtCost.IsReadOnly = false; txtMargin.IsEnabled = true; } else { txtCost.IsReadOnly = true; txtMargin.IsEnabled = false; } CheckBox derivedcost = (CheckBox)panel.FindName("chkDerivedCost"); TextBlock lblderivedcost = (TextBlock)panel.FindName("lblderivedcost"); if (((App)App.Current).CurrentRoleAccessModule.AccessMarginModule) { if (ed.Margin.Trim() != "" && retailprice >= 0) { txtMargin.Text = ed.Margin.ToString() + "%"; } else { txtMargin.Text = ""; } lblMargin.Visibility = Visibility.Visible; txtMargin.Visibility = Visibility.Visible; lblCost.Visibility = Visibility.Visible; txtCost.Visibility = Visibility.Visible; lblderivedcost.Visibility = Visibility.Visible; derivedcost.Visibility = Visibility.Visible; } else { lblMargin.Visibility = Visibility.Collapsed; txtMargin.Visibility = Visibility.Collapsed; lblCost.Visibility = Visibility.Collapsed; txtCost.Visibility = Visibility.Collapsed; lblderivedcost.Visibility = Visibility.Collapsed; derivedcost.Visibility = Visibility.Collapsed; } TextBox txtSubtotal = (TextBox)panel.FindName("txtSubtotal"); txtSubtotal.IsReadOnly = true; CheckBox chkAccepted = (CheckBox)panel.FindName("chkAccepted"); if (!EstimateList.revisiontypepermission.ReadOnly && (App.Current as App).SelectedEstimateAllowToAcceptItem) { chkAccepted.IsEnabled = true; } else { chkAccepted.IsEnabled = false; } } } } }
/// <summary> /// Override to change how RadTabItem's are prepared for items. /// </summary> /// <param name="item">The item to wrap in a RadTabItem</param> /// <param name="parent">The parent <see cref="DependencyObject"/></param> /// <returns>A tab item that wraps the supplied <paramref name="item"/></returns> protected virtual RadTabItem PrepareContainerForItem( object item, DependencyObject parent ) { var container = item as RadTabItem; if ( container == null ) { var dataContext = GetDataContext ( item ); container = new RadTabItem { Content = item, Style = _hostControl.ItemContainerStyle, DataContext = dataContext, Header = dataContext }; var headerTemplateSelector = GetHeaderTemplateSelector ( parent ); if ( headerTemplateSelector != null ) { container.HeaderTemplate = headerTemplateSelector.SelectTemplate ( dataContext, parent ); } container.SetValue ( IsGeneratedProperty, true ); } return container; }
/// <summary> /// Undoes the effects of the <see cref="PrepareContainerForItem"/> method. /// </summary> /// <param name="tabItem">The container element for the item.</param> protected virtual void ClearContainerForItem(RadTabItem tabItem) { if (tabItem == null) throw new ArgumentNullException("tabItem"); if ((bool)tabItem.GetValue(IsGeneratedProperty)) { tabItem.Content = null; } }
private void OpenDocumentVersionPreview(DocumentVersion documentVersion) { const string HEADERLABEL = "Document Version Preview"; bool found = false; RadTabItem foundTabItem = null; foreach (RadTabItem tabItem in MainTabControl.Items) { var content = tabItem.Content as DocumentVersionPreview; if (content != null) { foundTabItem = tabItem; found = true; break; } } if (found) { foundTabItem.Content = new DocumentVersionPreview(documentVersion); } else { var ti = new RadTabItem(); var th = new TabHeader(ti, this); th.headerLabel.Content = string.Format(HEADERLABEL); ti.Header = th; ti.Content = new DocumentVersionPreview(documentVersion); // ti.IsSelected = true; ti.DropDownContent = th.headerLabel.Content.ToString(); MainTabControl.Items.Add(ti); } }
private void OpenFavoritesTab(CommonUtils.FavouriteType favouriteType) { //Check whether we already have this issue open bool tabAlreadyOpen = false; foreach (RadTabItem tabItem in MainTabControl.Items) { var view = tabItem.Content as MyFavouritesView; if (view != null && view.FavouriteType == favouriteType) { tabItem.IsSelected = true; tabAlreadyOpen = true; break; } } if (tabAlreadyOpen == false) { var ti = new RadTabItem(); var th = new TabHeader(ti, this); switch (favouriteType) { case CommonUtils.FavouriteType.Document: th.headerLabel.Content = "My Favourite Documents"; break; case CommonUtils.FavouriteType.Issue: th.headerLabel.Content = "My Favourite Issues"; break; case CommonUtils.FavouriteType.DocumentRole: th.headerLabel.Content = "Documents Frequently Used in My Role"; break; } ti.Header = th; var view = new MyFavouritesView(); view.IsLoaded += s1 => { ti.Content = view; ti.IsSelected = true; ti.DropDownContent = th.headerLabel.Content.ToString(); MainTabControl.Items.Add(ti); }; view.SetView(favouriteType); } }
private void RenderPrivileges(SecurityObject secObject, RadTabItem tabItem) { int rowHeight = 20; int rowIndex = 0; tabItem.Style = (Style)Application.Current.Resources["InnerTabItem"]; ScrollViewer sv = new ScrollViewer(); sv.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; sv.HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden; //sv.Margin = new Thickness(3); sv.Background = (SolidColorBrush)Application.Current.Resources["PanelDarkBackground"]; sv.BorderBrush = (SolidColorBrush)Application.Current.Resources["PanelDarkBackground"]; Grid grid = new Grid(); grid.Background = (SolidColorBrush)Application.Current.Resources["PanelDarkBackground"]; sv.Content = grid; tabItem.Content = sv; foreach (var privilege in mPrivileges) { grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(rowHeight) }); CheckBox checkBox = new CheckBox(); grid.Children.Add(checkBox); checkBox.Content = privilege.Name; Grid.SetRow(checkBox, rowIndex); Grid.SetColumn(checkBox, 0); rowIndex++; RolePrivilegeViewModel rolePrivilegeViewModel; //Check set privileges var rolePrivilege = mRole.RolePrivileges.FirstOrDefault(x => x.SecObjectId == secObject.Id && x.PrivilegeId == privilege.Id); if (rolePrivilege != null) { rolePrivilegeViewModel = new RolePrivilegeViewModel(rolePrivilege); rolePrivilegeViewModel.HasAccess = true; } else { rolePrivilege = new RolePrivilege(); rolePrivilege.RoleId = mRoleId; rolePrivilege.SecObjectId = secObject.Id; rolePrivilege.PrivilegeId = privilege.Id; rolePrivilegeViewModel = new RolePrivilegeViewModel(rolePrivilege); rolePrivilegeViewModel.HasAccess = false; } mRolePrivilegesViewModel.Add(rolePrivilegeViewModel); //Bind System.Windows.Data.Binding checkBoxBinding = new System.Windows.Data.Binding("HasAccess"); checkBoxBinding.Mode = System.Windows.Data.BindingMode.TwoWay; checkBoxBinding.Source = rolePrivilegeViewModel; checkBox.SetBinding(CheckBox.IsCheckedProperty, checkBoxBinding); } }
private void OpenIssueSummaryListTab(IssueSummaryDataTranferObject dto) { //Check whether we already have this issue open bool tabAlreadyOpen = false; foreach (RadTabItem tabItem in MainTabControl.Items) { var view = tabItem.Content as IssueSummaryListView; if (view != null) { if (view.SummaryType == dto.SummaryType && view.FilterName == dto.FilterName) { //Issue is already open so select it tabItem.IsSelected = true; tabAlreadyOpen = true; break; } } } if (tabAlreadyOpen == false) { var ti = new RadTabItem(); var th = new TabHeader(ti, this); if (string.IsNullOrEmpty(dto.FilterName)) { th.headerLabel.Content = "Issues [All Statuses]"; } else { th.headerLabel.Content = string.Format("Issues [{0}]", dto.FilterName); } ti.Header = th; ti.Content = new IssueSummaryListView(dto.IssueIds, dto.SummaryType, dto.FilterName); ti.IsSelected = true; ti.DropDownContent = th.headerLabel.Content.ToString(); MainTabControl.Items.Add(ti); } }
private void DisplayPrivileges() { PermissionTabControl.BackgroundVisibility = Visibility.Collapsed; //Display Roles in a tab foreach (var secObjects in mSecObjects) { RadTabItem radTabItem = new RadTabItem(); radTabItem.Header = secObjects.Name; RenderPrivileges(secObjects, radTabItem); PermissionTabControl.Items.Add(radTabItem); } //Select first tab if (PermissionTabControl.Items.Count > 0) { PermissionTabControl.SelectedItem = PermissionTabControl.Items[0]; } IsBusyIndicator.IsBusy = false; }
private void OpenMyInTrayListTab() { //Check whether we already have this issue open bool tabAlreadyOpen = false; foreach (RadTabItem tabItem in MainTabControl.Items) { var view = tabItem.Content as MyInTrayView; if (view != null) { //Issue is already open so select it tabItem.IsSelected = true; tabAlreadyOpen = true; break; } } if (tabAlreadyOpen == false) { var ti = new RadTabItem(); var th = new TabHeader(ti, this); th.headerLabel.Content = "My In-Tray"; ti.Header = th; MainTabControl.Items.Add(ti); var view = new MyInTrayView(); view.IsLoaded += s1 => { ti.Content = view; ti.IsSelected = true; ti.DropDownContent = th.headerLabel.Content.ToString(); }; } }
private void AddFields() { //Add Fields! - get the Layout definition Fields.Children.Clear(); if (_setgbborder) _sObjectDef.SetGBBorder(_gbborder); //This is where all the work is done - reads the layouts and builds everything _sObjectDef.BuildLayouts(_d,FieldChanged); if (_rootobject && _rootWindow!=null) { if (!_zoom) { _rootWindow.Header = "Axiom IRIS - " + _sObjectDef.PluralLabel; } else { _rootWindow.Header = "" + _sObjectDef.PluralLabel; } } //Remove any sub tabs for (int x = tab1.Items.Count-1; x >0; x--) { tab1.Items.RemoveAt(x); } //Sort out the Grid - add all the columns this.radGridView1.Columns.Clear(); this.radGridView1.AutoGenerateColumns = false; _sObjectDef.AddColumns(radGridView1); //Switch on and off features if (_paged && rp2.Header.ToString()=="Search") { radDataPager1.Visibility = System.Windows.Visibility.Visible; } else { radDataPager1.Visibility = System.Windows.Visibility.Collapsed; } if (rp2.Header.ToString() == "List") { _filter = false; } if (!_filter) { cbFilter.Visibility = System.Windows.Visibility.Collapsed; } else { cbFilter.Visibility = System.Windows.Visibility.Visible; } // sort out the filter entries if (_filter) { cbFilter.Items.Clear(); if (_sObjectDef.GridFilters.Count == 0) { // none defined just add in My Records and All Records RadComboBoxItem rci = new RadComboBoxItem(); rci.Content = "My Records"; cbFilter.Items.Add(rci); rci = new RadComboBoxItem(); rci.Content = "All Records"; cbFilter.Items.Add(rci); cbFilter.SelectedIndex = 0; _sObjectDef.Filter = "My Records"; } else { // add the filters string dflt = ""; string first = ""; foreach (string key in _sObjectDef.GridFilters.Keys) { SObjectDef.FilterEntry f = _sObjectDef.GridFilters[key]; RadComboBoxItem rci = new RadComboBoxItem(); rci.Content = f.Name; cbFilter.Items.Add(rci); if (f.Default) { dflt = f.Name; } if (first == "") { first = f.Name; } } if (dflt != "") { cbFilter.Text = dflt; _sObjectDef.Filter = dflt; } else { cbFilter.Text = first; _sObjectDef.Filter = first; } } // Add in the handler cbFilter.SelectionChanged += cbFilter_SelectionChanged; } // Set the form to have the default Record Type if (_sObjectDef.DefaultRecordType == null) { string firstkey = _sObjectDef.Layouts.ElementAt(0).Key; StackPanel sp = _sObjectDef.Layouts[firstkey]; FieldContent.Content = sp; _CurrentRecordTypeId = firstkey; _CurrentRecordTypeName = firstkey; } else { StackPanel sp = _sObjectDef.Layouts[_sObjectDef.DefaultRecordType]; FieldContent.Content = sp; _CurrentRecordTypeId = _sObjectDef.DefaultRecordType; _CurrentRecordTypeName = _sObjectDef.DefaultRecordType; } if (_sObjectDef.RecordTypes.Keys.Count > 0) { foreach (string rt in _sObjectDef.RecordTypes.Keys) { RadMenuItem mi = new RadMenuItem(); mi.Header = _sObjectDef.RecordTypes[rt]; mi.Tag = rt; this.NewButtonContent.Items.Add(mi); } } else { RadMenuItem mi = new RadMenuItem(); mi.Header = _sObjectDef.Label; mi.Tag = ""; this.NewButtonContent.Items.Add(mi); } // Show the buttons DisplayButtons(); //Wire Up the ReSize rpg1.SizeChanged += new SizeChangedEventHandler(Fields_SizeChanged); //Subtabs _childobj = new List<SForceEdit.AxObject>(); _childattachments = null; if (_rootobject) { string tabdefinition = Globals.ThisAddIn.GetSettings(_sObjectDef.Name, "Tabs"); if (tabdefinition != "") { foreach (string tdef in tabdefinition.Split('|')) { if (tdef == "Attachment" || tdef == "Attachment:") { //Add an attacment object - just a grid with buttons - give it the parent its attached to so it knows //what to do if the attachment is opened in a sidebar _childattachments = new SForceEdit.AxAttachment(_sObjectDef.Name); RadTabItem tabItem = new RadTabItem() { Header = "Attachments", Content = _childattachments }; tab1.Items.Add(tabItem); } else if (tdef.Contains(':')) { string subobject = tdef.Split(':')[0]; string rel = tdef.Split(':')[1]; //Add the subpanel if we have the definition if (_d.GetSObject(subobject) != null) { // get the tab filters if they exist string tabfilters = Globals.ThisAddIn.GetSettings(_sObjectDef.Name, "TabFilters", subobject); SForceEdit.AxObject axObj = new SForceEdit.AxObject(subobject, rel, this, tabfilters); _childobj.Add(axObj); RadTabItem tabItem = new RadTabItem() { Header = axObj.GetLabelPlural(), Content = axObj }; tab1.Items.Add(tabItem); } } } } } else { //If not root add the attachments if it is defined string tabdefinition = Globals.ThisAddIn.GetSettings(_sObjectDef.Name, "Tabs"); if (tabdefinition != "") { foreach (string tdef in tabdefinition.Split('|')) { if (tdef == "Attachment" || tdef == "Attachment:") { //Add an attacment object - just a grid with buttons - give it the parent its attached to so it knows //what to do if the attachment is opened in a sidebar _childattachments = new SForceEdit.AxAttachment(_sObjectDef.Name); RadTabItem tabItem = new RadTabItem() { Header = "Attachments", Content = _childattachments }; tab1.Items.Add(tabItem); } } } } this.UpdateTextWidth(); }
private void OpenPipeTab(QuickPipe pipe) { if (pipe == null || !pipe.IsActive) { return; } //Check whether we already have this issue open bool tabAlreadyOpen = false; foreach (RadTabItem tabItem in MainTabControl.Items) { var pipesPanel = tabItem.Content as PipePanel; if (pipesPanel != null) { if (pipesPanel.Pipe.Id == pipe.Id) { //Issue is already open so select it tabItem.IsSelected = true; tabAlreadyOpen = true; break; } } } if (tabAlreadyOpen == false) { var ti = new RadTabItem(); var th = new TabHeader(ti, this); th.headerLabel.Content = String.Format("Pipe {0}", pipe.Name); ti.Header = th; ti.Content = new PipePanel(pipe.Id); ti.IsSelected = true; ti.DropDownContent = th.headerLabel.Content.ToString(); MainTabControl.Items.Add(ti); if (CMS.EffectivePrivileges.PipeTab.CanModify || CMS.EffectivePrivileges.AdminTab.CanModify) { BuildTabLockEventHandler(th.headerLabel.Content.ToString()); } } }
private void OpenActiveOverrideSummaryListTab(SummaryViewDataTranferObject dto) { //Check whether we already have this issue open bool tabAlreadyOpen = false; foreach (RadTabItem tabItem in MainTabControl.Items) { var view = tabItem.Content as ActiveOverrideSummaryListView; if (view != null) { //Issue is already open so select it tabItem.IsSelected = true; tabAlreadyOpen = true; break; } } if (tabAlreadyOpen == false) { var ti = new RadTabItem(); var th = new TabHeader(ti, this); th.headerLabel.Content = string.Format("Active Overrides"); ti.Header = th; ti.Content = new ActiveOverrideSummaryListView(dto.IncludeRemoved); ti.IsSelected = true; ti.DropDownContent = th.headerLabel.Content.ToString(); MainTabControl.Items.Add(ti); } }
private void OpenTab(QuickIssue issue) { //Check whether we already have this issue open bool issueAlreadyOpen = false; foreach (RadTabItem tabItem in MainTabControl.Items) { var issuePanel = tabItem.Content as IssuesPanel; if (issuePanel != null) { if (issuePanel.IssueId == issue.Id) { //Issue is already open so select it tabItem.IsSelected = true; issueAlreadyOpen = true; break; } } } if (issueAlreadyOpen == false) { var ti = new RadTabItem(); MainTabControl.Items.Add(ti); var th = new TabHeader(ti, this); th.headerLabel.Content = String.Format("Issue #{0}", issue.Id); ti.Header = th; ti.IsSelected = true; ti.DropDownContent = th.headerLabel.Content.ToString(); ti.Content = new IssuesPanel(issue.Id); if (CMS.EffectivePrivileges.IssueTab.CanModify || CMS.EffectivePrivileges.AdminTab.CanModify) { BuildTabLockEventHandler(th.headerLabel.Content.ToString()); } } }
private void OpenDocumentsSummaryListTab(List<QuickDocument> quickDocuments) { //Check whether we already have this issue open bool tabAlreadyOpen = false; foreach (RadTabItem tabItem in MainTabControl.Items) { var view = tabItem.Content as DocumentsSummaryListView; if (view != null) { //Issue is already open so select it tabItem.IsSelected = true; tabAlreadyOpen = true; break; } } if (tabAlreadyOpen == false) { var ti = new RadTabItem(); var th = new TabHeader(ti, this); th.headerLabel.Content = string.Format("Documents"); ti.Header = th; ti.Content = new DocumentsSummaryListView(quickDocuments.Select(x => x.Id).ToList(), CommonUtils.FavouriteType.All); // ti.IsSelected = true; ti.DropDownContent = th.headerLabel.Content.ToString(); MainTabControl.Items.Add(ti); } }
public void CloseTab(RadTabItem radTabItem) { var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); var tab = radTabItem.Content as ITab; if (tab != null) { tab.ShowCloseDialog( () => { tab.RemoveTabReferences(); var th = radTabItem.Header as TabHeader; if (th != null) { string headerLabel = th.headerLabel.Content.ToString(); radTabItem.Header = null; radTabItem.Content = null; MainTabControl.Items.Remove(radTabItem); cmsWebServiceClient.UserClosedTabAsync(headerLabel, CMS.User.UserName); } }); } }
private void OpenDocumentTab(QuickDocument document) { if (document == null) return; //Check whether we already have this open bool tabAlreadyOpen = false; foreach (RadTabItem tabItem in MainTabControl.Items) { var panel = tabItem.Content as DocumentPanel; if (panel != null) { if (panel.LoadedDocument.Id == document.Id) { //already open so select it tabItem.IsSelected = true; tabAlreadyOpen = true; break; } } } if (tabAlreadyOpen == false) { var ti = new RadTabItem(); var th = new TabHeader(ti, this); ti.Content = new DocumentPanel(document); if (string.IsNullOrEmpty(document.Name)) { th.headerLabel.Content = String.Format("Document : {0}", document.Id); } else { th.headerLabel.Content = String.Format("Document : {0}", document.Name); } ti.Header = th; ti.IsSelected = true; ti.DropDownContent = th.headerLabel.Content.ToString(); MainTabControl.Items.Add(ti); if (CMS.EffectivePrivileges.DocumentTab.CanModify || CMS.EffectivePrivileges.AdminTab.CanModify) { BuildTabLockEventHandler(th.headerLabel.Content.ToString()); } } }
private void BindControl(string bindName, RadTabItem radTabItem) { Binding binding = new Binding(bindName) { Mode = BindingMode.OneWay }; radTabItem.SetBinding(HeaderedContentControl.HeaderProperty, binding); }
private void LoadTabs() { View.RadTabControl.Items.Clear(); foreach (var promptGroup in PromptGroups) { Binding textBlockBinding = new Binding("IsSelected") {Mode = BindingMode.TwoWay}; RelativeSource rs = new RelativeSource {AncestorType = typeof (RadTabItem)}; textBlockBinding.RelativeSource = rs; textBlockBinding.Converter = new BackgroundColourConverter(); TextBlock textBlock = new TextBlock {Text = promptGroup.Name}; textBlock.SetBinding(TextBlock.ForegroundProperty, textBlockBinding); RadTabItem newTabItem = new RadTabItem { Header = textBlock, Tag = promptGroup }; View.RadTabControl.Items.Add(newTabItem); } View.RadTabControl.SelectedItem = View.RadTabControl.Items[0]; this.PromptGroup = ((RadTabItem) View.RadTabControl.SelectedItem).Tag as PromptGroup; View.RadTabControl.SelectionChanged += RadTabControlOnSelectionChanged; }