public override void Create(VisualElement root) { var tabs = new Tabs(); var stats = new TabPage("Stats"); stats.Add(new Slider("Hp")); stats.Add(new Slider("Attack")); stats.Add(new Slider("Defense")); stats.Add(new Slider("Speed")); tabs.Add(stats); var equipment = new TabPage("Equipment"); equipment.Add(new TextField("Helmet")); equipment.Add(new TextField("Gloves")); equipment.Add(new TextField("Sword")); equipment.Add(new TextField("Shield")); equipment.Add(new TextField("Boots")); tabs.Add(equipment); var inventory = new TabPage("Inventory"); inventory.Add(new IntegerField("Money")); inventory.Add(new IntegerField("Potions")); tabs.Add(inventory); root.Add(tabs); }
public void Clear() { Tabs.Clear(); Tabs.Add(new StartTab(this)); SelectedTab = Tabs.Last(); RecognizedCount = "0"; }
public RadegastTab AddTab(string name, string label, Control control) { // WORKAROUND: one should never add tab that alrady exists // but under some weird conditions disconnect/connect // fire in the wrong order if (TabExists(name)) { Logger.Log("Force closing tab '" + name + "'", Helpers.LogLevel.Warning, client); ForceCloseTab(name); } control.Visible = false; control.Dock = DockStyle.Fill; toolStripContainer1.ContentPanel.Controls.Add(control); ToolStripButton button = (ToolStripButton)tstTabs.Items.Add(label); button.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText; button.Image = null; button.AutoToolTip = false; button.Tag = name.ToLower(); button.AllowDrop = true; button.Click += new EventHandler(TabButtonClick); RadegastTab tab = new RadegastTab(instance, button, control, name.ToLower(), label); if (control is RadegastTabControl) { ((RadegastTabControl)control).RadegastTab = tab; } tab.TabAttached += new EventHandler(tab_TabAttached); tab.TabDetached += new EventHandler(tab_TabDetached); tab.TabSelected += new EventHandler(tab_TabSelected); tab.TabClosed += new EventHandler(tab_TabClosed); tab.TabHidden += new EventHandler(tab_TabHidden); Tabs.Add(name.ToLower(), tab); if (OnTabAdded != null) { try { OnTabAdded(this, new TabEventArgs(tab)); } catch (Exception) { } } button.MouseDown += (msender, margs) => { if (margs.Button == MouseButtons.Middle) { if (tab.AllowClose) { tab.Close(); } else if (tab.AllowHide) { tab.Hide(); } } }; return(tab); }
private MDITabItem NewTab() { var model = new GraphModel(); var graphViewModel = new GraphViewModel(model); graphViewModel.ModelChanged += OnModelChanged; var area = new GraphArea { DataContext = graphViewModel, Background = Brushes.WhiteSmoke, Name = "graphArea", Focusable = true }; area.MouseMove += GraphAreaOnMouseMove; area.SubscribeEvents(); var tab = new MDITabItem { Header = $"Tab {_indexNewTab}", Content = area, GraphViewModel = graphViewModel }; _indexNewTab++; tab.CloseTab += TabOnCloseTab; Tabs.Add(tab); return(tab); }
public DockManagerViewModel() { Documents = new ObservableCollection <ViewModelBase>(); var vm = new DockWindowViewModel { Title = "Test Window" }; Documents.Add(vm); Tabs.Add(new RibbonTabViewModel() { Title = "File" }); Tabs.Add(new RibbonTabViewModel() { Title = "Edit" }); Tabs.Add(new RibbonTabViewModel() { Title = "View" }); Tabs.Add(new RibbonTabViewModel() { Title = "Tools" }); Tabs.Add(new RibbonTabViewModel() { Title = "Project" }); Tabs.Add(new RibbonTabViewModel() { Title = "Help" }); }
public DesignerVM() { // trigger the MedcinData static constructor; yeah, it's a hack Console.WriteLine("Loading MedcinTerms ({0}) ...", Terms.ToString()); // instantiate the resource tab this.resourceTab = new DesignerTabVM(this); // first page of template; we leave the resource tab out // so it doesn't interfere with assigning the collection to the tabcontrol later Tabs.Add(new DesignerTabVM(this)); Tabs.Add(new DesignerTabVM(this)); Tabs[0].Name = "Tab 1"; Tabs[1].Name = "Tab 2"; ActiveTab = Tabs[0]; // Register MyCommands AddTabCommand = new MyCommand(ExecuteAddTabCommand); RemoveTabCommand = new MyCommand(ExecuteRemoveTabCommand); CreateNewFormTemplateCommand = new MyCommand(ExecuteCreateNewFormTemplateCommand); ExportTemplateCommand = new MyCommand(ExecuteExportTemplateCommand); Mediator.Instance.Register(this); }
private void AddButton_OnClick(object sender, RoutedEventArgs e) { var tabViewModel = new TabViewModel(); Tabs.Add(tabViewModel); tabViewModel.IsSelected = true; }
/// <summary> /// Initializes the Singleton instance /// </summary> private void Initialize() { Tabs.Add( new TabDescriptor( new GUIContent("Children", TextureCache.Instance.OrderNormal), new GUIContent("Children", TextureCache.Instance.OrderSelected) ) ); Tabs.Add( new TabDescriptor( new GUIContent("Layout", TextureCache.Instance.LayoutNormal), new GUIContent("Layout", TextureCache.Instance.Layout) ) ); Tabs.Add( new TabDescriptor( new GUIContent("Events", TextureCache.Instance.EventsNormal), new GUIContent("Events", TextureCache.Instance.Events) ) ); TabIndex = EditorSettings.TabIndex; }
private void AddTab(string path) { var type = routeService.GetComponent(path); if (type == null) { if (path != "/") { MessageService.Show($"路由为 {path} 的页面未找到", MessageType.Warning); } return; } ActiveTabName = path; if (!Tabs.Any(x => x.Name == ActiveTabName)) { var model = (MenuModel)CurrentMenu.Model; Tabs.Add(new TabModel() { Title = model.Title ?? model.Label, Name = ActiveTabName, Content = type }); } StateHasChanged(); }
public void Handle(BoardOpenMessage message) { var tabItem = Tabs.FirstOrDefault(t => { var tabData = (t.Content as Control).DataContext; var msgData = (message.BoardView.Content as Control).DataContext; if (!(tabData is BoardViewModel) || !(msgData is BoardViewModel)) { return(false); } return((tabData as BoardViewModel).CurrentBoard.ID == (msgData as BoardViewModel).CurrentBoard.ID); }); if (tabItem == null) { Tabs.Add(message.BoardView); SelectedTab = message.BoardView; } else { SelectedTab = tabItem; } }
public TransformEditDlg(Window owner, SettingsViewModel vmSettings, MDictionaryEdit itemEdit) { InitializeComponent(); //SourceInitialized += (x, y) => this.HideMinimizeAndMaximizeButtons(); Owner = owner; DataContext = vm = new TransformEditViewModelWPF(vmSettings, itemEdit); tcTranform.DataContext = this; templateCtrl = new TransformTemplateControl(vm); sourceCtrl = new TransformSourceControl(vm); resultCtrl = new TransformResultControl(vm); intermediateCtrl = new TransformIntermediateControl(vm); Tabs.Add(new ActionTabItem { Header = "Source", Content = sourceCtrl }); Tabs.Add(new ActionTabItem { Header = "Result", Content = resultCtrl }); Tabs.Add(new ActionTabItem { Header = "Intermediate", Content = intermediateCtrl }); Tabs.Add(new ActionTabItem { Header = "Template", Content = templateCtrl }); Action <ReactiveCommand <Unit, Unit> > f = cmd => cmd.WhenFinishedExecuting().Subscribe(_ => tcTranform.SelectedIndex = 1); f(vm.ExecuteTransformCommand); f(vm.GetAndTransformCommand); }
private void HandleTab(TabMessage tabMessage) { string id = tabMessage.Id ?? tabMessage.ViewModel?.Id; var item = Tabs.FirstOrDefault(x => x.Id == id); switch (tabMessage.Action) { case TabMessageAction.BringToFront: SelectedTab = item; break; case TabMessageAction.Close: Tabs.Remove(item); break; case TabMessageAction.Create: if (item == null) { item = tabMessage.ViewModel; Tabs.Add(tabMessage.ViewModel); } SelectedTab = item; break; } }
private void Config_Ready(object sender, CustomEventArgs.ConfigReadyEventArgs e) { var sitesList = e.Sites; var prepTabs = new List <TabItemViewModel>(); foreach (var site in sitesList) { Credntials.CredentialsManager.DefaultInstance.Username = site.Username; Credntials.CredentialsManager.DefaultInstance.Password = site.Password; var prepTab = new TabItemViewModel(); prepTab.Title = site.Name; prepTab.Watched = site.Watched; prepTab.Url = site.Mirrors[0]; prepTab.Mirrors = site.Mirrors; prepTab.Closeable = !site.Watched; prepTab.ErrorMessage = site.Message; prepTab.WarningSoundPath = site.WarningSoundPath; prepTab.ErrorSoundPath = site.ErrorSoundPath; prepTab.HeartbeatTimeout = site.HeartbeatTimeout; prepTab.PageLoadTimeout = site.LoadPageTimeout; prepTab.SwitchMirrorTimeout = site.SwitchMirrorTimeout; prepTab.AlertDelayTime = site.AlertDelayTime; prepTab.Close += TabClosed; prepTab.NewTabRequest += Tab_NewTabRequest; prepTab.UrlChanged += PrepTab_MirrorChanged; lock (locker) { Tabs.Add(prepTab); } } RaisePropertyChanged(nameof(Tabs)); SelectedTab = Tabs[0]; }
public string NewTab(string url) { driver.SwitchTo().Window(driver.WindowHandles[0]); // TODO: This is not covered by the retry mechanism string newTabScript = "var d=document,a=d.createElement('a');" + "a.target='_blank';a.href='" + url + "';" + "a.innerHTML='new tab';" + "d.body.appendChild(a);" + "a.click();" + "a.parentNode.removeChild(a);"; List <string> oldWindowTabs = driver.WindowHandles.ToList(); IJavaScriptExecutor scriptExecutor = (IJavaScriptExecutor)driver; scriptExecutor.ExecuteScript(newTabScript); List <string> newWindowTabs = driver.WindowHandles.ToList(); string openedWindowTabs = newWindowTabs.Except(oldWindowTabs).Single(); Tabs.Add(openedWindowTabs); SwitchToTab(openedWindowTabs); return(openedWindowTabs); }
public static TopTab AddTab(string name, string url, int order = 0) { var tab = new TopTab(name, url, order); Tabs.Add(tab.Order, tab); return(tab); }
void Add(TabViewModel addThis) { if (addThis == null) { throw new ArgumentNullException("addThis"); } ServiceManager.GetService <IViewService>().OpenDialog(addThis); if (addThis.Result != MessageResult.Okay) { return; // Cancelled add } // Check if any other tabs have this title. if (Tabs.Any(sectionElem => sectionElem.Title == addThis.Title)) { ServiceManager.GetService <IMessageBoxService>().Show( "Tab with that title already exists", "Astounding Dock", MessageIcon.Error); // Re-open dialog. Add(addThis); return; } addThis.TabOrder = Tabs.Max(x => x.TabOrder) + 1; Tabs.Add(addThis); }
void LoadSideBarConfig(XmlElement el) { foreach (XmlElement sideTabEl in el.ChildNodes) { SideTab tab = new SideTab(this, sideTabEl.GetAttribute("text")); tab.DisplayName = StringParser.Parse(tab.Name); if (tab.Name == el.GetAttribute("activetab")) { ActiveTab = tab; } else { if (ActiveTab == null) { ActiveTab = tab; } } foreach (XmlElement sideTabItemEl in sideTabEl.ChildNodes) { tab.Items.Add(SideTabItemFactory.CreateSideTabItem(sideTabItemEl.GetAttribute("text"), sideTabItemEl.GetAttribute("value"))); } if (sideTabEl.GetAttribute("clipboardring") == "true") { tab.CanBeDeleted = false; tab.CanDragDrop = false; tab.Name = "${res:SharpDevelop.SideBar.ClipboardRing}"; tab.DisplayName = StringParser.Parse(tab.Name); clipboardRing = tab; } Tabs.Add(tab); } }
private void BuildTree() { TreeRoot.Clear(); var root = new TreeViewItemViewModel(this) { Text = FileName, Icon = "/icons/data.ico", IsExpanded = true }; TreeRoot.Add(root); var generalTab = Container.GetExportedValue <GeneralTabViewModel>(); root.Items.Add(new TreeViewItemViewModel(this) { Text = "(General)", Icon = "/icons/general.ico", Tab = generalTab }); Tabs.Add(generalTab); if (PEHeader.ExportDirectory.VirtualAddress > 0) { var exportTab = Container.GetExportedValue <ExportsTabViewModel>(); root.Items.Add(new TreeViewItemViewModel(this) { Text = "Exports (.edata)", Icon = "/icons/export1.ico", Tab = exportTab }); } if (PEHeader.ImportDirectory.VirtualAddress > 0) { var importsTab = Container.GetExportedValue <ImportsTabViewModel>(); root.Items.Add(new TreeViewItemViewModel(this) { Text = "Imports (.idata)", Icon = "/icons/import2.ico", Tab = importsTab }); } //if(PEHeader.ImportAddressTableDirectory.VirtualAddress > 0) { // var iatTab = Container.GetExportedValue<ImportAddressTableTabViewModel>(); // root.Items.Add(new TreeViewItemViewModel(this) { Text = "Import Address Table", Icon = "/icons/iat.ico", Tab = iatTab }); //} if (PEHeader.ResourceDirectory.VirtualAddress > 0) { root.Items.Add(new TreeViewItemViewModel(this) { Text = "Resources (.rsrc)", Icon = "/icons/resources.ico", Tab = Container.GetExportedValue <ResourcesTabViewModel>() }); } //if(PEHeader.ComDescriptorDirectory.VirtualAddress > 0) { // root.Items.Add(new TreeViewItemViewModel(this) { // Text = "CLR", // Icon = "/icons/cpu.ico", // Tab = Container.GetExportedValue<CLRTabViewModel>() // }); //} SelectedTab = generalTab; }
/// <summary> /// Creates a new tab to hold <paramref name="form"/>. /// </summary> /// <param name="form">Form instance that we are to open in a new tab.</param> protected void ShowInEmptyTab(Form form) { // If we're opening the form from an unconnected ConnectionWindow, just replace its content with the new form if (SelectedTab != null && SelectedTab.Content is ConnectionWindow && !(SelectedTab.Content as ConnectionWindow).IsConnected) { Form oldWindow = SelectedTab.Content; SelectedTab.Content = form; ResizeTabContents(); oldWindow.Close(); } // Otherwise, create a new tab associated with the form else { TitleBarTab newTab = new TitleBarTab(this) { Content = form }; Tabs.Add(newTab); ResizeTabContents(newTab); SelectedTabIndex = _tabs.Count - 1; } form.Show(); if (_overlay != null) { _overlay.Render(true); } }
/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> /// <param name="movieService">Instance of MovieService</param> /// <param name="movieHistoryService">Instance of MovieHistoryService</param> /// <param name="applicationService">Instance of ApplicationService</param> public MoviePageViewModel(IMovieService movieService, IMovieHistoryService movieHistoryService, IApplicationService applicationService) { _movieService = movieService; _movieHistoryService = movieHistoryService; ApplicationService = applicationService; GenresMovie = new GenresMovieViewModel(_movieService); RegisterMessages(); RegisterCommands(); Search = new SearchMovieViewModel(); DispatcherHelper.CheckBeginInvokeOnUI(async() => { Tabs.Add(new PopularMovieTabViewModel(ApplicationService, _movieService, _movieHistoryService)); Tabs.Add(new GreatestMovieTabViewModel(ApplicationService, _movieService, _movieHistoryService)); Tabs.Add(new RecentMovieTabViewModel(ApplicationService, _movieService, _movieHistoryService)); Tabs.Add(new FavoritesMovieTabViewModel(ApplicationService, _movieService, _movieHistoryService)); Tabs.Add(new SeenMovieTabViewModel(ApplicationService, _movieService, _movieHistoryService)); SelectedTab = Tabs.First(); SelectedMoviesIndexMenuTab = 0; var loadMoviesTask = Tabs.ParallelForEachAsync(async tab => { await tab.LoadMoviesAsync(); }); var loadGenreTask = GenresMovie.LoadGenresAsync(); await Task.WhenAll(new List <Task> { loadMoviesTask, loadGenreTask }); }); }
private void OpenDefaultTab() { Tab tab = null; string defaultTabFile = Path.Combine(BasePath, "Default.xml"); if (File.Exists(defaultTabFile)) { try { var fs = new FileStream(defaultTabFile, FileMode.Open); var serial = new XmlSerializer(typeof(Tab)); tab = (Tab)serial.Deserialize(fs); fs.Close(); } catch (Exception ex) { while (ex.InnerException != null) { ex = ex.InnerException; } MessageBox.Show(ex.Message, "Load Tab", MessageBoxButton.OK, MessageBoxImage.Error); } } if (tab == null) { tab = new Tab("Default", 2, 2); } Tabs.Add(tab); tabControl.SelectedItem = tab; }
/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> /// <param name="movieService">Instance of MovieService</param> /// <param name="userService">Instance of UserService</param> /// <param name="applicationService">Instance of ApplicationService</param> /// <param name="genreService">The genre service</param> public MoviePageViewModel(IMovieService movieService, IUserService userService, IApplicationService applicationService, IGenreService genreService) { _movieService = movieService; _userService = userService; ApplicationService = applicationService; GenreViewModel = new GenreViewModel(userService, genreService); RegisterMessages(); RegisterCommands(); Search = new SearchMovieViewModel(); DispatcherHelper.CheckBeginInvokeOnUI(async() => { Tabs.Add(new PopularMovieTabViewModel(ApplicationService, _movieService, _userService)); Tabs.Add(new GreatestMovieTabViewModel(ApplicationService, _movieService, _userService)); Tabs.Add(new RecentMovieTabViewModel(ApplicationService, _movieService, _userService)); Tabs.Add(new FavoritesMovieTabViewModel(ApplicationService, _movieService, _userService)); Tabs.Add(new SeenMovieTabViewModel(ApplicationService, _movieService, _userService)); SelectedTab = Tabs.First(); SelectedMoviesIndexMenuTab = 0; await GenreViewModel.LoadGenresAsync().ConfigureAwait(false); await Tabs.ToList().ParallelForEachAsync(async tab => { await tab.LoadMoviesAsync().ConfigureAwait(false); }).ConfigureAwait(false); }); }
private void ExecuteOpenTabCommand(EventInformation <MouseEventArgs> e) { var fileEntry = e.CommandArgument as FileEntryViewModel; if (fileEntry == null || fileEntry.Blocks.Any(b => b.Health != FileBlockHealthStatus.Ok)) { return; } var existing = Tabs.SingleOrDefault(t => t.Header == fileEntry.Name); if (existing != null) { SelectedTab = existing; return; } var stfs = fileEntry.Parent; if (fileEntry.Name == "PEC") { var newTab = new ProfileRebuilderTabItemViewModel(fileEntry.Name, ParseStfs(stfs.ExtractPec())); Tabs.Add(newTab); SelectedTab = newTab; } else if (fileEntry.Name.EndsWith(".gpd")) { var gpd = stfs.ExtractFile(fileEntry.Name); var model = ModelFactory.GetModel <GpdFile>(gpd); model.Parse(); var newTab = new ProfileRebuilderTabItemViewModel(fileEntry.Name, new GpdFileViewModel(model)); Tabs.Add(newTab); SelectedTab = newTab; } }
private void loadTabMenuItem_Click(object sender, RoutedEventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.InitialDirectory = BasePath; openFileDialog.Filter = "Tab settings (*.xml)|*.xml"; openFileDialog.Title = "Load Tab"; if (openFileDialog.ShowDialog() == true) { try { var fs = (FileStream)openFileDialog.OpenFile(); var serial = new XmlSerializer(typeof(Tab)); var tab = (Tab)serial.Deserialize(fs); Tabs.Add(tab); tabControl.SelectedItem = tab; fs.Close(); } catch (Exception ex) { while (ex.InnerException != null) { ex = ex.InnerException; } MessageBox.Show(ex.Message, "Load Tab", MessageBoxButton.OK, MessageBoxImage.Error); } } }
public void TabAdd(List <TabItemBase> tabs) { foreach (var t in tabs) { Tabs.Add(t); } }
public override void LoadDataAsync(LoadCommand cmd, LoadDataAsyncParameters cmdParam, Action <PaneViewModelBase> success = null, Action <PaneViewModelBase, Exception> error = null) { base.LoadDataAsync(cmd, cmdParam, success, error); switch (cmd) { case LoadCommand.Load: WorkHandler.Run( () => { _packageContent = (BinaryContent)cmdParam.Payload; _stfs = ModelFactory.GetModel <StfsPackage>(_packageContent.Content); return(true); }, result => { IsLoaded = true; Tabs.Add(new ProfileRebuilderTabItemViewModel(Resx.FileStructure, ParseStfs(_stfs))); SelectedTab = Tabs.First(); if (success != null) { success.Invoke(this); } }, exception => { if (error != null) { error.Invoke(this, exception); } }); break; } }
public MainWindowViewModel(string repositotyFileName) { _repositoryFileName = repositotyFileName; _repositoryViewModel = new RepositoryViewModel(_repositoryFileName); _repositoryViewModel.FuncSqlViewModelSelected += _repositoryViewModel_RequestSelected; base.DisplayName = "Тестирование сервиса jqsbyt"; Tabs.Add(new SearchViewModel()); Tabs.Add(new ShemaUchetViewModel()); Tabs.Add(new ManualRequestViewModel() { DisplayName = "Ручной запрос" }); SelectedItem = Tabs[0]; CreateNewManualRequestTabCommand = new DelegateCommand(() => { var list = Tabs.Where((t) => (t is ManualRequestViewModel) && (t.DisplayName.StartsWith("Запрос данных"))).ToList(); ManualRequestViewModel mrvm = new ManualRequestViewModel(); if (list != null) { mrvm.DisplayName += " (" + (list.Count + 1) + ")"; } Tabs.Add(mrvm); }); }
/// <summary> /// Apply the base configuration for all <see cref="TabItem"/> <see langword="objects"/> in the <see cref="TabCollection"/> /// </summary> /// <param name="_tab">The tab to configure</param> /// <param name="_showContent">Whether or not to show the tab after configuration</param> private void ConfigurateTab(TabItem _tab, bool _showContent) { #region On Click Behaviour _tab.OnClick = (o, e) => { ITabItem other = FindTab(item => item.IsVisible == true); if (other != null) { MinimizeTab(other); } OpenTab(_tab); }; #endregion #region On Close Behaviour _tab.OnCloseClick = (o, e) => { CloseTab(_tab); }; #endregion Tabs.Add(_tab); _tab.Construct(tabDisplay, contentArea); if (_showContent) { MinimizeTab(FindTab(item => item.IsVisible == true && item.ID != _tab.ID)); } }
public void AddTag(string tag) { if (Tabs.Contains(tag) == false) { Tabs.Add(tag); } }
/// <summary> /// Constructor /// </summary> /// <param name="applicationService">The application service</param> /// <param name="showService">The show service</param> /// <param name="userService">The user service</param> /// <param name="genreService">The genre service</param> public ShowPageViewModel(IApplicationService applicationService, IShowService showService, IUserService userService, IGenreService genreService) { _showService = showService; _userService = userService; _applicationService = applicationService; GenreViewModel = new GenreViewModel(userService, genreService); RegisterCommands(); RegisterMessages(); Search = new SearchShowViewModel(); DispatcherHelper.CheckBeginInvokeOnUI(async() => { Tabs.Add(new PopularShowTabViewModel(_applicationService, showService, userService)); Tabs.Add(new GreatestShowTabViewModel(_applicationService, showService, userService)); Tabs.Add(new RecentShowTabViewModel(_applicationService, showService, userService)); Tabs.Add(new FavoritesShowTabViewModel(_applicationService, showService, userService)); SelectedTab = Tabs.First(); SelectedShowsIndexMenuTab = 0; await GenreViewModel.LoadGenresAsync().ConfigureAwait(false); await Tabs.ToList().ParallelForEachAsync(async tab => { await tab.LoadShowsAsync().ConfigureAwait(false); }).ConfigureAwait(false); }); }
protected void createTabXML() { bool isDefault = false; Tabs allTabs = new Tabs(); DataTable tabsDataTable = TabDataTable; DataTable permissionDataTable = TabPermissionDataTable; DataTable permissionConditionDataTable = PermissionConditionDataTable; foreach (DataRow drTab in tabsDataTable.Rows) { ushort index = Convert.ToUInt16(drTab[Constants.TabField.Index]); string title = drTab[Constants.TabField.Title].ToString(); string desc = drTab[Constants.TabField.Description].ToString(); bool isTabDefault = Helper.ConvertToBool( drTab[Constants.TabField.IsDefault].ToString()); int tabID = Convert.ToInt32(drTab[Constants.RowID]); Tab t1 = new Tab(index, title, desc); t1.CommaSeperatedFields = drTab[Constants.TabField.FieldToString].ToString(); t1.IsSelected = isTabDefault; DataTable permissionOfSelectedTab = Helper.GetViewFromDataTable(permissionDataTable, tabID, Constants.PermissionField.TabRowID).ToTable(); if (permissionOfSelectedTab != null && permissionOfSelectedTab.Rows.Count > 0) { foreach (DataRow drPermission in permissionOfSelectedTab.Rows) { bool IsDefault = Helper.ConvertToBool(drPermission[Constants.PermissionField.IsDefault].ToString()); Enums.PermissionLevel permissionLevel = (Enums.PermissionLevel)(Convert.ToInt32(drPermission[Constants.PermissionField.PermissionID].ToString())); string OnForms = drPermission[Constants.PermissionField.OnFormIDs].ToString(); string ForSPPrinciples = drPermission[Constants.PermissionField.SPPrinciples].ToString(); Enums.Operator BySPPrinciplesOperator = (Enums.Operator)(Convert.ToInt32(drPermission[Constants.PermissionField.SPPrinciplesOperatorID].ToString())); int permissionID = Convert.ToInt32(drPermission[Constants.RowID]); TabPermission perm1 = new TabPermission(isDefault, permissionLevel, TabPermission.ParseForms(OnForms), ForSPPrinciples, BySPPrinciplesOperator); DataTable conditionOfSelectedPermission = Helper.GetViewFromDataTable(permissionConditionDataTable, permissionID, Constants.ConditionField.PermissionRowID).ToTable(); if (conditionOfSelectedPermission != null && conditionOfSelectedPermission.Rows.Count > 0) { foreach (DataRow drCondition in conditionOfSelectedPermission.Rows) { string OnField = drCondition[Constants.ConditionField.SPFieldName].ToString(); Enums.Operator ByFieldOperator = (Enums.Operator)Convert.ToInt32(drCondition[Constants.ConditionField.SPFieldOperatorID].ToString()); object Value = drCondition[Constants.ConditionField.Value].ToString(); perm1.Conditions.Add(new Condition(new Field(OnField), ByFieldOperator, Value)); } } t1.Permissions.Add(perm1); } } allTabs.Add(t1); } SPSecurity.RunWithElevatedPrivileges(delegate { using (SPSite objSite = new SPSite(SPContext.Current.Web.Url.ToString())) { using (SPWeb objWeb = objSite.OpenWeb()) { SPList list = objWeb.Lists[new Guid(Request.QueryString["List"])]; objWeb.AllowUnsafeUpdates = true; string xml = allTabs.ToString(); if (allTabs.Count > 0 && Helper.IsValidXml(xml)) { Helper.CreateConfigFile(list, Constants.ConfigFile.TabSettingFile, xml); } else { Helper.DeleteConfigFile(list, Constants.ConfigFile.TabSettingFile, xml); } objWeb.AllowUnsafeUpdates = false; } } }); }