private DataTable GenerateData(long rowLimit = 0) { if (!this._settingsAllreadyCreated) { return(new DataTable()); } List <ColumnProperties> dataColumns = new List <ColumnProperties>(); Head settingsHeader = this._head.Heads.FirstOrDefault(); if (settingsHeader != null) { ColumnGroup settingsColumnGroup = settingsHeader.ColumnGroups.FirstOrDefault(); if (settingsColumnGroup != null) { dataColumns = settingsColumnGroup.Columns.ToList(); } } SPList parentList = this._spView == null ? this._spList : this._spView.ParentList; List <int> userGroups = this._currentUser.Groups.Cast <SPGroup>().Select(g => g.ID).ToList(); if (string.IsNullOrWhiteSpace(this._sqlFilterString)) { DataTable tableData = this._syncProvider.GetItems(parentList, dataColumns, string.Empty, this._currentUser.ID, userGroups, rowLimit); return(tableData); } else { DataTable tableData = this._syncProvider.GetItems(parentList, dataColumns, this._sqlFilterString, this._currentUser.ID, userGroups, rowLimit); return(tableData); } }
public override Task <BoolResult> GarbageCollectAsync(OperationContext context) { return(context.PerformOperationAsync(Tracer, () => { // Get exclusive lock to prevent concurrent access while deleting column families // without this, we might try to read from a column family which does not exist return _keyValueStore.UseExclusive( (store, db) => { var otherColumnGroup = db.GetFormerColumnGroup(); store.Put(nameof(GlobalKeys.ActiveColummGroup), otherColumnGroup.ToString()); foreach (var column in EnumTraits <Columns> .EnumerateValues()) { var columnName = db.NameOf(column, otherColumnGroup); // Clear the column family by dropping and recreating store.DropColumnFamily(columnName); store.CreateColumnFamily(columnName); } _activeColumnsGroup = otherColumnGroup; return BoolResult.SuccessTask; }, this).ThrowOnError(); }, counter: Counters[ContentLocationDatabaseCounters.GarbageCollectContent], isCritical: true)); }
IEnumerable <ColumnGroup> GetGroups() { var result = new List <ColumnGroup>(); if (Columns.All(i => i.GroupName.IsEmpty())) { return(result); // No grouping has been provided. } foreach (var column in Columns) { var previousGroup = result.LastOrDefault(r => r.GroupName == column.GroupName); if (previousGroup != null) { previousGroup.Quantity++; } else { previousGroup = new ColumnGroup { GroupName = column.GroupName, Quantity = 0, Style = column.GroupingStyle }; result.Add(previousGroup); } } return(result); }
TryGetColumnGroupTable ( Microsoft.Office.Interop.Excel.Workbook oWorkbook, ColumnGroup eColumnGroup, out ListObject oTable ) { Debug.Assert(oWorkbook != null); oTable = null; String sColumnGroup = eColumnGroup.ToString(); if (sColumnGroup.StartsWith("Edge")) { return(ExcelUtil.TryGetTable(oWorkbook, WorksheetNames.Edges, TableNames.Edges, out oTable)); } if (sColumnGroup.StartsWith("Vertex")) { return(ExcelUtil.TryGetTable(oWorkbook, WorksheetNames.Vertices, TableNames.Vertices, out oTable)); } if (sColumnGroup.StartsWith("Group")) { return(ExcelUtil.TryGetTable(oWorkbook, WorksheetNames.Groups, TableNames.Groups, out oTable)); } Debug.Assert(false); return(false); }
IColumnGroupConfigurator <TConfigurator> IColumnGroupConfiguratorBase <TConfigurator> .Group(string name, string?prefix, string?separator, string?suffix) { var group = new ColumnGroup(name, prefix, separator, suffix); Group.AddColumn(group); return(new GroupConfigurator <TConfigurator>(group, (TConfigurator)(object)this)); }
private void OnClickCheck(object sender, RoutedEventArgs e) { var item = (sender as FrameworkElement).DataContext; int index = list_view_rows.Items.IndexOf(item); CheckRows row = rows.Find(r => r.index == index); if (row == null) { ModernDialog.ShowMessage("그런 row 없다", "ERROR", MessageBoxButton.OK); } // Find Master TagGroup tag_group = tag_group_list.Find(t => t.master_column.table_name == row.master_table_name && t.master_column.column_name == row.master_column_name); if (tag_group == null) { ModernDialog.ShowMessage("그런 TagGroup 없다", "ERROR", MessageBoxButton.OK); } List <string> master_list = tag_group.master_column.id_list; // Find Slave ColumnGroup column_group = tag_group.slave_columns.Find(s => s.table_name == row.slave_table_name && s.column_name == row.slave_column_name); if (column_group == null) { ModernDialog.ShowMessage("그런 ColumnGroup 없다", "ERROR", MessageBoxButton.OK); } List <string> slave_list = column_group.id_list; string added_string = ""; foreach (var slave in slave_list) { if (master_list.Find(m => m == slave) == null) { string log = string.Format("존재하지 않는 id입니다. {0} : {1}\r\n", tag_group.tag_name, slave); added_string += log; } } if (added_string == "") { rows[index].Result = "Success"; } else { rows[index].Result = "Failed"; result_box.Text += added_string; } result_box.Text += string.Format("Check를 완료했습니다. Checked index : {0}\r\n", index); result_box.Text += "=========================================================\r\n"; }
SetColumnGroupVisibility ( ColumnGroup columnGroup, Boolean show ) { AssertValid(); SetValue(GetColumnGroupSettingName(columnGroup), show); }
GetColumnGroupSettingName ( ColumnGroup columnGroup ) { AssertValid(); // Sample setting name: "Show Vertex Graph Metrics" return("Show " + EnumUtil.SplitName( columnGroup.ToString(), EnumSplitStyle.AllWordsStartUpperCase)); }
public async Task <ActionResult> Put(string id, ColumnGroup column) { Console.WriteLine("Made it inside the put function"); Console.WriteLine(column); var columnFromRepo = await _columnGroupRepo.Get(id); if (columnFromRepo == null) { return(NotFound()); } await _columnGroupRepo.Update(id, column); return(NoContent()); }
GetColumnGroupVisibility ( ColumnGroup columnGroup ) { AssertValid(); Boolean bColumnGroupVisibility = false; Object oColumnGroupVisibility; if (TryGetValue(GetColumnGroupSettingName(columnGroup), typeof(Boolean), out oColumnGroupVisibility)) { bColumnGroupVisibility = (Boolean)oColumnGroupVisibility; } return(bColumnGroupVisibility); }
public async Task <ActionResult> Post(ColumnGroup group) { var groupResult = await _columnGroupRepo.Create(group); var column1 = new KanBanColumn() { Title = "Doing", GroupId = groupResult.GroupId, KanBanColumn = true, }; var column2 = new KanBanColumn() { Title = "Done", GroupId = groupResult.GroupId, KanBanColumn = true, }; var column1Result = _columnRepo.Create(column1); var column2Result = _columnRepo.Create(column2); return(CreatedAtAction("Post", new object[] { groupResult, await column1Result, await column2Result })); }
public static ColumnGroupFunction getFunction(WP6Document doc, int index) { WP6_FunctionKey key = new WP6_FunctionKey(doc.data[index], doc.data[index + 1]); if (WP6_FunctionNames.map.ContainsKey(key)) { ColumnGroup name = (ColumnGroup)WP6_FunctionNames.map[key]; switch (name) { case ColumnGroup.left_margin_set: return(new LeftMarginSet(doc, index)); case ColumnGroup.right_margin_set: return(new RightMarginSet(doc, index)); case ColumnGroup.define_text_colums: return(new DefineTextColumns(doc, index)); default: return(new ColumnGroupFunction(doc, index)); } } return(new ColumnGroupFunction(doc, index)); }
ShowOrHideColumnGroup ( Microsoft.Office.Interop.Excel.Workbook workbook, ColumnGroup columnGroup, Boolean show, Boolean activateWorksheet ) { Debug.Assert(workbook != null); ListObject oTable; if (TryGetColumnGroupTable(workbook, columnGroup, out oTable)) { ExcelColumnHider.ShowOrHideColumns(oTable, GetColumnNames(workbook, columnGroup), show); if (columnGroup == ColumnGroup.VertexOtherColumns) { // Hiding the subgraph image column doesn't hide the images in // the column. TableImagePopulator.ShowOrHideImagesInColumn(workbook, WorksheetNames.Vertices, VertexTableColumnNames.SubgraphImage, show); } if (activateWorksheet) { ExcelUtil.ActivateWorksheet(oTable); } (new PerWorkbookSettings(workbook)).SetColumnGroupVisibility( columnGroup, show); } }
public static Screen MultiColumnGroups() { var s = new Screen() { BackColor = Color.DarkBlue, Size = new Size() { Width = 1280, Height = 720 }, HorizontalColumnGroupSpacing = 40, Title = "Sample", TitleColor = Color.Black, TitleFont = new Font("Arial", 20, FontStyle.Regular), ContentMargins = new System.Drawing.Printing.Margins() { Bottom = 20, Top = 40, Left = 20, Right = 20 }, ContentAlign = System.Drawing.ContentAlignment.TopCenter }; var ftGroup = new Font("Arial", 12, FontStyle.Regular); var ftTile = new Font("Arial", 10, FontStyle.Regular); var cg1 = new ColumnGroup() { WidthInColumns = 3, HorizontalSpacing = 20, VerticalSpacing = 20, TileSize = 120, VerticalGroupSpacing = 35 }; cg1.Groups.Add(new Group() { Title = "Group 1A", TitleFont = ftGroup, TitleOffset = new Point(0, 15) }); cg1.Groups.Add(new Group() { Title = "Group 1B", TitleFont = ftGroup, TitleOffset = new Point(0, 15) }); cg1.Groups[1].BorderTop.Width = 2; cg1.Groups[1].BorderLeft.Width = 2; cg1.Groups[1].BorderRight.Width = 2; cg1.Groups[1].BorderBottom.Width = 2; cg1.Groups.Add(new Group() { Title = "Group 1C", TitleFont = ftGroup, TitleOffset = new Point(0, 15) }); s.ColumnGroups.Add(cg1); var cg2 = new ColumnGroup() { WidthInColumns = 3, HorizontalSpacing = 20, VerticalSpacing = 20, TileSize = 120, VerticalGroupSpacing = 35 }; cg2.Groups.Add(new Group() { Title = "Group 2A", TitleFont = ftGroup, TitleOffset = new Point(0, 15) }); cg1.Groups[0].BorderTop.Width = 2; cg1.Groups[0].BorderLeft.Width = 2; cg1.Groups[0].BorderRight.Width = 2; cg1.Groups[0].BorderBottom.Width = 2; cg2.Groups.Add(new Group() { Title = "Group 2B", TitleFont = ftGroup, TitleOffset = new Point(0, 15) }); cg2.Groups.Add(new Group() { Title = "Group 2C", TitleFont = ftGroup, TitleOffset = new Point(0, 15) }); cg1.Groups[2].BorderTop.Width = 2; cg1.Groups[2].BorderLeft.Width = 2; cg1.Groups[2].BorderRight.Width = 2; cg1.Groups[2].BorderBottom.Width = 2; s.ColumnGroups.Add(cg2); var cg3 = new ColumnGroup() { WidthInColumns = 3, HorizontalSpacing = 20, VerticalSpacing = 20, TileSize = 120, VerticalGroupSpacing = 35 }; cg3.BorderTop.Width = 2; cg3.BorderLeft.Width = 2; cg3.BorderRight.Width = 2; cg3.BorderBottom.Width = 2; cg3.Groups.Add(new Group() { Title = "Group 3A", TitleFont = ftGroup, TitleOffset = new Point(0, 15) }); cg3.Groups.Add(new Group() { Title = "Group 3B", TitleFont = ftGroup, TitleOffset = new Point(0, 15) }); cg3.Groups.Add(new Group() { Title = "Group 3C", TitleFont = ftGroup, TitleOffset = new Point(0, 15) }); s.ColumnGroups.Add(cg3); return(s); }
protected GroupConfiguratorBase(ColumnGroup group) { Group = group; }
GetOtherColumnNames ( Microsoft.Office.Interop.Excel.Workbook oWorkbook, ColumnGroup eOtherColumnGroup ) { Debug.Assert(oWorkbook != null); List <String> oOtherColumnNames = new List <String>(); ListObject oTable; if (TryGetColumnGroupTable(oWorkbook, eOtherColumnGroup, out oTable)) { // Create a dictionary of the column names that are included in all // the non-other column groups in the table. The key is the column // name and the value isn't used. Dictionary <String, Byte> oColumnNamesInNonOtherGroups = new Dictionary <String, Byte>(); // All column groups in the edge table start with "Edge", and all // column groups in the vertex table start with "Vertex". String sStartsWith = null; switch (eOtherColumnGroup) { case ColumnGroup.EdgeOtherColumns: sStartsWith = "Edge"; break; case ColumnGroup.VertexOtherColumns: sStartsWith = "Vertex"; break; case ColumnGroup.GroupOtherColumns: sStartsWith = "Group"; break; default: Debug.Assert(false); break; } foreach (ColumnGroup eColumnGroup in Enum.GetValues(typeof(ColumnGroup))) { if ( eColumnGroup != eOtherColumnGroup && eColumnGroup.ToString().StartsWith(sStartsWith) ) { foreach (String sColumnNameInNonOtherGroup in GetColumnNames(oWorkbook, eColumnGroup)) { oColumnNamesInNonOtherGroups[ sColumnNameInNonOtherGroup] = 0; } } } // Any column not included in one of the non-other column groups is // an "other" column. foreach (ListColumn oColumn in oTable.ListColumns) { String sColumnName = oColumn.Name; if (!oColumnNamesInNonOtherGroups.ContainsKey(sColumnName)) { oOtherColumnNames.Add(sColumnName); } } } return(oOtherColumnNames.ToArray()); }
GetColumnNames ( Microsoft.Office.Interop.Excel.Workbook oWorkbook, ColumnGroup eColumnGroup ) { Debug.Assert(oWorkbook != null); String [] asColumnNames = null; switch (eColumnGroup) { case ColumnGroup.EdgeDoNotHide: asColumnNames = new String [] { EdgeTableColumnNames.Vertex1Name, EdgeTableColumnNames.Vertex2Name, }; break; case ColumnGroup.EdgeVisualAttributes: asColumnNames = new String [] { EdgeTableColumnNames.Color, EdgeTableColumnNames.Width, EdgeTableColumnNames.Style, CommonTableColumnNames.Alpha, CommonTableColumnNames.Visibility, }; break; case ColumnGroup.EdgeLabels: asColumnNames = new String [] { EdgeTableColumnNames.Label, }; break; case ColumnGroup.VertexDoNotHide: asColumnNames = new String [] { VertexTableColumnNames.VertexName, }; break; case ColumnGroup.VertexVisualAttributes: asColumnNames = new String [] { VertexTableColumnNames.Color, VertexTableColumnNames.Shape, VertexTableColumnNames.Radius, CommonTableColumnNames.Alpha, VertexTableColumnNames.ImageUri, CommonTableColumnNames.Visibility, }; break; case ColumnGroup.VertexGraphMetrics: asColumnNames = new String [] { VertexTableColumnNames.Degree, VertexTableColumnNames.InDegree, VertexTableColumnNames.OutDegree, VertexTableColumnNames.BetweennessCentrality, VertexTableColumnNames.ClosenessCentrality, VertexTableColumnNames.EigenvectorCentrality, VertexTableColumnNames.PageRank, VertexTableColumnNames.ClusteringCoefficient, }; break; case ColumnGroup.VertexLabels: asColumnNames = new String [] { VertexTableColumnNames.Label, VertexTableColumnNames.LabelFillColor, VertexTableColumnNames.LabelPosition, VertexTableColumnNames.ToolTip, }; break; case ColumnGroup.VertexLayout: asColumnNames = new String [] { VertexTableColumnNames.LayoutOrder, VertexTableColumnNames.X, VertexTableColumnNames.Y, VertexTableColumnNames.Locked, VertexTableColumnNames.PolarR, VertexTableColumnNames.PolarAngle, }; break; case ColumnGroup.EdgeInternalUse: case ColumnGroup.VertexInternalUse: asColumnNames = new String [] { CommonTableColumnNames.ID, CommonTableColumnNames.DynamicFilter, }; break; case ColumnGroup.EdgeOtherColumns: case ColumnGroup.VertexOtherColumns: case ColumnGroup.GroupOtherColumns: asColumnNames = GetOtherColumnNames(oWorkbook, eColumnGroup); break; case ColumnGroup.GroupDoNotHide: asColumnNames = new String [] { GroupTableColumnNames.Name, }; break; case ColumnGroup.GroupVisualAttributes: asColumnNames = new String [] { GroupTableColumnNames.VertexColor, GroupTableColumnNames.VertexShape, GroupTableColumnNames.Collapsed, }; break; case ColumnGroup.GroupGraphMetrics: asColumnNames = new String [] { GroupTableColumnNames.Vertices, GroupTableColumnNames.UniqueEdges, GroupTableColumnNames.EdgesWithDuplicates, GroupTableColumnNames.TotalEdges, GroupTableColumnNames.SelfLoops, GroupTableColumnNames.ConnectedComponents, GroupTableColumnNames.SingleVertexConnectedComponents, GroupTableColumnNames.MaximumConnectedComponentVertices, GroupTableColumnNames.MaximumConnectedComponentEdges, GroupTableColumnNames.MaximumGeodesicDistance, GroupTableColumnNames.AverageGeodesicDistance, GroupTableColumnNames.GraphDensity, }; break; case ColumnGroup.GroupInternalUse: asColumnNames = new String [] { CommonTableColumnNames.ID, }; break; default: Debug.Assert(false); break; } Debug.Assert(asColumnNames != null); return(asColumnNames); }
//************************************************************************* // Method: SetColumnGroupVisibility() // /// <summary> /// Sets a flag specifying whether a column group should be shown. /// </summary> /// /// <param name="columnGroup"> /// The column group to set the visibility for. /// </param> /// /// <param name="show"> /// true if the column group should be shown. /// </param> //************************************************************************* public void SetColumnGroupVisibility( ColumnGroup columnGroup, Boolean show ) { AssertValid(); SetValue(GetColumnGroupSettingName(columnGroup), show); }
//************************************************************************* // Method: GetColumnGroupSettingName() // /// <summary> /// Gets the setting name to use for getting or setting a flag specifying /// whether a column group should be shown. /// </summary> /// /// <param name="columnGroup"> /// The column group. /// </param> /// /// <returns> /// The setting name to use. /// </returns> //************************************************************************* protected String GetColumnGroupSettingName( ColumnGroup columnGroup ) { AssertValid(); // Sample setting name: "Show Vertex Graph Metrics" return ( "Show " + EnumUtil.SplitName( columnGroup.ToString(), EnumSplitStyle.AllWordsStartUpperCase) ); }
private bool Register(TableInfo table, ColumnInfo column, string condition = null) { // #0. tag_name eTagName tag_name = column.TagName; // #1. 기본 리스트(base_list)를 로드한다 / 밖으로 뺄 result_list 생성 ColumnGroup column_group = new ColumnGroup(); column_group.table_name = table.TableName; column_group.column_name = column.ColumnName; List <string> base_list = new List <string>(); List <string> result_list = new List <string>(); string base_key = table.TableName + " " + column.ColumnName; if (column_data_list.TryGetValue(base_key, out base_list) == false) { ModernDialog.ShowMessage("Not found column key", "ERROR", MessageBoxButton.OK); return(false); } // #2. 조건이 있는지 검색 if (condition != null && condition.Contains(':')) { // #3. 조건이 있을 경우 // 조건을 파싱 string[] split_string = condition.Split(':'); if (split_string.Length != 3) { ModernDialog.ShowMessage("Not valid condition string", "ERROR", MessageBoxButton.OK); return(false); } tag_name = (eTagName)Enum.Parse(typeof(eTagName), split_string[0]); string condition_name = split_string[1]; string condition_value = split_string[2]; // 조건에 해당하는 컨디션 키 생성 string condition_key = table.TableName + " " + condition_name; // 컨디션 리스트 로드 List <string> condition_list = new List <string>(); if (column_data_list.TryGetValue(condition_key, out condition_list) == false) { ModernDialog.ShowMessage("Not found condition key", "ERROR", MessageBoxButton.OK); return(false); } // 조건에 해당하는 row에 한해 result_list에 넣기 int index = 0; foreach (string condition_string in condition_list) { if (condition_string == condition_value) { result_list.Add(base_list[index]); } ++index; } } else { // #3. 조건이 없을 경우 result_list = base_list; } // #4. column_group.id_list 세팅하기 column_group.id_list = result_list; // #5. master column이라면 master에 추가 if (column.IsMaster == true) { TagGroup tag_group = SettingManager.Instance.tag_group_list.Find(t => t.tag_name == tag_name); if (tag_group != null) { if (tag_group.master_column != null) { ModernDialog.ShowMessage("Has master column already", "ERROR", MessageBoxButton.OK); return(false); } tag_group.master_column = column_group; } else { tag_group = new TagGroup(); tag_group.tag_name = tag_name; tag_group.master_column = column_group; tag_group.slave_columns = new List <ColumnGroup>(); SettingManager.Instance.tag_group_list.Add(tag_group); } } else // #5. slave column이라면 slave에 추가 { TagGroup tag_group = SettingManager.Instance.tag_group_list.Find(t => t.tag_name == tag_name); if (tag_group != null) { tag_group.slave_columns.Add(column_group); } else { tag_group = new TagGroup(); tag_group.tag_name = tag_name; tag_group.slave_columns = new List <ColumnGroup>(); tag_group.slave_columns.Add(column_group); SettingManager.Instance.tag_group_list.Add(tag_group); } } return(true); }
public static Screen Blank() { var s = new Screen() { BackColor = Color.DarkBlue, Size = new Size() { Width = 1280, Height = 720 }, HorizontalColumnGroupSpacing = 40, TitleColor = Color.Black, TitleFont = new Font("Arial", 20, FontStyle.Regular), HeaderContentAlign = System.Drawing.ContentAlignment.MiddleCenter, HeaderLocation = Position.Top, HeaderMargins = new Margins() { Bottom = 5, Top = 5, Left = 5, Right = 5 }, HeaderThickness = 80, ContentMargins = new Margins() { Bottom = 20, Top = 20, Left = 20, Right = 20 }, ContentAlign = System.Drawing.ContentAlignment.TopCenter }; var ftGroup = new Font("Arial", 12, FontStyle.Regular); var ftTile = new Font("Arial", 10, FontStyle.Regular); var titleTile = new Tile() { Title = "Title", BackColor = Color.White, TitleFont = new Font("Arial", 20, FontStyle.Regular), TitleAlign = System.Drawing.ContentAlignment.MiddleCenter, TitleColor = Color.Black, ColSpan = 21 }; s.Header.BorderBottom.Width = 2; s.Header.Padding = new Margins(5, 5, 5, 5); s.Header.TileSize = 60; s.Header.HorizontalSpacing = 0; s.Header.WidthInColumns = 21; s.Header.Groups.Add(new Group()); s.Header.Groups[0].Tiles.Add(titleTile); var cg1 = new ColumnGroup() { WidthInColumns = 3, HorizontalSpacing = 20, VerticalSpacing = 20, TileSize = 120, VerticalGroupSpacing = 35 }; var g1 = new Group() { Title = "Group", TitleFont = ftGroup }; g1.Tiles.Add(new Tile() { BackColor = Color.DarkCyan }); cg1.Groups.Add(g1); s.ColumnGroups.Add(cg1); return(s); }
private BoolResult Load(OperationContext context, StoreSlot activeSlot, bool clean) { try { var storeLocation = GetStoreLocation(activeSlot); if (clean) { Counters[ContentLocationDatabaseCounters.DatabaseCleans].Increment(); if (Directory.Exists(storeLocation)) { FileUtilities.DeleteDirectoryContents(storeLocation, deleteRootDirectory: true); } } bool dbAlreadyExists = Directory.Exists(storeLocation); Directory.CreateDirectory(storeLocation); Tracer.Info(context, $"Creating RocksDb store at '{storeLocation}'. Clean={clean}, Configured Epoch='{_configuration.Epoch}'"); var possibleStore = KeyValueStoreAccessor.Open( new RocksDbStoreConfiguration(storeLocation) { AdditionalColumns = ColumnNames, RotateLogsMaxFileSizeBytes = _configuration.LogsKeepLongTerm ? 0ul : ((ulong)"1MB".ToSize()), RotateLogsNumFiles = _configuration.LogsKeepLongTerm ? 60ul : 1, RotateLogsMaxAge = TimeSpan.FromHours(_configuration.LogsKeepLongTerm ? 12 : 1), EnableStatistics = true, FastOpen = true, // We take the user's word here. This may be completely wrong, but we don't have enough // information at this point to take a decision here. If a machine is master and demoted to // worker, EventHub may continue to process events for a little while. If we set this to // read-only during that checkpoint, those last few events will fail with RocksDbException. // NOTE: we need to check that the database exists because RocksDb will refuse to open an empty // read-only instance. ReadOnly = _configuration.OpenReadOnly && dbAlreadyExists, // The RocksDb database here is read-only from the perspective of the default column family, // but read/write from the perspective of the ClusterState (which is rewritten on every // heartbeat). This means that the database may perform background compactions on the column // families, possibly triggering a RocksDb corruption "block checksum mismatch" error. // Since the writes to ClusterState are relatively few, we can make-do with disabling // compaction here and pretending like we are using a read-only database. DisableAutomaticCompactions = !IsDatabaseWriteable, LeveledCompactionDynamicLevelTargetSizes = true, Compression = _configuration.Compression, UseReadOptionsWithSetTotalOrderSeekInDbEnumeration = _configuration.UseReadOptionsWithSetTotalOrderSeekInDbEnumeration, UseReadOptionsWithSetTotalOrderSeekInGarbageCollection = _configuration.UseReadOptionsWithSetTotalOrderSeekInGarbageCollection, }, // When an exception is caught from within methods using the database, this handler is called to // decide whether the exception should be rethrown in user code, and the database invalidated. Our // policy is to only invalidate if it is an exception coming from RocksDb, but not from our code. failureHandler: failureEvent => { // By default, rethrow is true iff it is a user error. We invalidate only if it isn't failureEvent.Invalidate = !failureEvent.Rethrow; }, // The database may be invalidated for a number of reasons, all related to latent bugs in our code. // For example, exceptions thrown from methods that are operating on the DB. If that happens, we // call a user-defined handler. This is because the instance is invalid after this happens. invalidationHandler: failure => OnDatabaseInvalidated(context, failure), // It is possible we may fail to open an already existing database. This can happen (most commonly) // due to corruption, among others. If this happens, then we want to recreate it from empty. This // only helps for the memoization store. onFailureDeleteExistingStoreAndRetry: _configuration.OnFailureDeleteExistingStoreAndRetry, // If the previous flag is true, and it does happen that we invalidate the database, we want to log // it explicitly. onStoreReset: failure => { Tracer.Error(context, $"RocksDb critical error caused store to reset: {failure.DescribeIncludingInnerFailures()}"); }); if (possibleStore.Succeeded) { var oldKeyValueStore = _keyValueStore; var store = possibleStore.Result; if (oldKeyValueStore == null) { _keyValueStore = new KeyValueStoreGuard(store); _keyValueStore.UseExclusive((db, state) => { if (db.TryGetValue(nameof(GlobalKeys.ActiveColummGroup), out var activeColumnGroup)) { _activeColumnsGroup = (ColumnGroup)Enum.Parse(typeof(ColumnGroup), activeColumnGroup); } else { _activeColumnsGroup = ColumnGroup.One; } return(true); }, this).ThrowOnError(); } else { // Just replace the inner accessor oldKeyValueStore.Replace(store, db => { if (db.TryGetValue(nameof(GlobalKeys.ActiveColummGroup), out var activeColumnGroup)) { _activeColumnsGroup = (ColumnGroup)Enum.Parse(typeof(ColumnGroup), activeColumnGroup); } else { _activeColumnsGroup = ColumnGroup.One; } }).ThrowOnError(); } _activeSlot = activeSlot; _storeLocation = storeLocation; } return(possibleStore.Succeeded ? BoolResult.Success : new BoolResult($"Failed to initialize a RocksDb store at {_storeLocation}:", possibleStore.Failure.DescribeIncludingInnerFailures())); } catch (Exception ex) when(ex.IsRecoverableIoException()) { return(new BoolResult(ex)); } }
public static Screen TwoColumns() { var s = new Screen() { BackColor = Color.DarkBlue, Size = new Size() { Width = 1280, Height = 720 }, HorizontalColumnGroupSpacing = 34, Title = "Sample", TitleAlign = System.Drawing.ContentAlignment.TopCenter, TitleColor = Color.White, TitleFont = new Font("Arial", 20, FontStyle.Regular), TitleOffset = new Point(0, 10), ContentMargins = new System.Drawing.Printing.Margins() { Bottom = 20, Top = 40, Left = 20, Right = 20 }, ContentAlign = System.Drawing.ContentAlignment.TopCenter }; var ftGroup = new Font("Arial", 12, FontStyle.Regular); var ftTile = new Font("Arial", 10, FontStyle.Regular); var cg1 = new ColumnGroup() { WidthInColumns = 3, HorizontalSpacing = 18, VerticalSpacing = 20, TileSize = 120, VerticalGroupSpacing = 35 }; var g1 = new Group() { Title = "Group 1", TitleFont = ftGroup }; g1.Tiles.Add(new Tile() { BackColor = Color.DarkCyan }); g1.Tiles.Add(new Tile() { BackColor = Color.DarkCyan, ColSpan = 2, RowSpan = 2, Title = "Big size", TitleFont = ftTile, TitleColor = Color.White }); g1.Tiles.Add(new Tile() { BackColor = Color.DarkGreen, RowSpan = 2 }); g1.Tiles.Add(new Tile() { BackColor = Color.DarkCyan, ColSpan = 2 }); g1.Tiles.Add(new Tile() { BackColor = Color.DarkCyan }); g1.Tiles.Add(new Tile() { BackColor = Color.DarkCyan, ColSpan = 2 }); g1.Tiles.Add(new Tile() { BackColor = Color.DarkCyan, ColSpan = 3, Title = "Wide cell", TitleFont = ftTile, TitleColor = Color.White, TitleAlign = System.Drawing.ContentAlignment.TopLeft }); g1.Tiles.Add(new Tile() { BackColor = Color.DarkCyan }); g1.Tiles.Add(new Tile() { BackColor = Color.Yellow, ColSpan = 2 }); cg1.Groups.Add(g1); s.ColumnGroups.Add(cg1); var cg2 = new ColumnGroup() { WidthInColumns = 6, HorizontalSpacing = 18, VerticalSpacing = 20, TileSize = 120, VerticalGroupSpacing = 35 }; var g2 = new Group() { Title = "Group 2", TitleFont = ftGroup }; g2.BorderTop.Width = 2; g2.BorderLeft.Width = 2; g2.BorderRight.Width = 2; g2.BorderBottom.Width = 2; g2.Tiles.Add(new Tile() { BackColor = Color.DarkCyan, Title = "Tile", TitleFont = ftTile, TitleColor = Color.White }); g2.Tiles.Add(new Tile() { BackColor = Color.DarkCyan, ColSpan = 2, RowSpan = 2 }); g2.Tiles.Add(new Tile() { BackColor = Color.DarkCyan }); g2.Tiles.Add(new Tile() { BackColor = Color.DarkGreen, ColSpan = 2, Title = "Double tile", TitleFont = ftTile, TitleColor = Color.White }); g2.Tiles.Add(new Tile() { BackColor = Color.DarkCyan }); g2.Tiles.Add(new Tile() { BackColor = Color.DarkCyan, RowSpan = 2 }); g2.Tiles.Add(new Tile() { BackColor = Color.DarkCyan, ColSpan = 2 }); g2.Tiles.Add(new Tile() { BackColor = Color.DarkCyan, ColSpan = 3 }); g2.Tiles.Add(new Tile() { BackColor = Color.DarkCyan }); g2.Tiles.Add(new Tile() { BackColor = Color.DarkCyan }); g2.Tiles.Add(new Tile() { BackColor = Color.Yellow, ColSpan = 2 }); g2.Tiles.Add(new Tile() { BackColor = Color.Yellow, ColSpan = 2 }); g2.Tiles.Add(new Tile() { BackColor = Color.Yellow, ColSpan = 2 }); g2.Tiles.Add(new Tile() { BackColor = Color.DarkMagenta, ColSpan = 6, RowSpan = 2, Title = "Extra large tile", TitleFont = ftTile, TitleColor = Color.White }); cg2.Groups.Add(g2); s.ColumnGroups.Add(cg2); return(s); }
//************************************************************************* // Method: GetColumnGroupVisibility() // /// <summary> /// Gets a flag specifying whether a column group should be shown. /// </summary> /// /// <param name="columnGroup"> /// The column group to get the visibility for. /// </param> /// /// <returns> /// true to show the column group. /// </returns> //************************************************************************* public Boolean GetColumnGroupVisibility( ColumnGroup columnGroup ) { AssertValid(); Boolean bColumnGroupVisibility = false; Object oColumnGroupVisibility; if ( TryGetValue(GetColumnGroupSettingName(columnGroup), typeof(Boolean), out oColumnGroupVisibility) ) { bColumnGroupVisibility = (Boolean)oColumnGroupVisibility; } return (bColumnGroupVisibility); }
public HeaderConfigurator(ColumnGroup group) : base(group) { }
public static Screen NoTitle() { var s = new Screen() { BackColor = Color.DarkBlue, Size = new Size() { Width = 1280, Height = 720 }, HorizontalColumnGroupSpacing = 40, TitleColor = Color.Black, TitleFont = new Font("Arial", 20, FontStyle.Regular), ContentMargins = new System.Drawing.Printing.Margins() { Bottom = 20, Top = 20, Left = 20, Right = 20 }, ContentAlign = System.Drawing.ContentAlignment.TopCenter }; var ftGroup = new Font("Arial", 12, FontStyle.Regular); var ftTile = new Font("Arial", 10, FontStyle.Regular); var cg1 = new ColumnGroup() { WidthInColumns = 9, HorizontalSpacing = 20, VerticalSpacing = 20, TileSize = 120 }; var g1 = new Group() { }; g1.Tiles.Add(new Tile() { BackColor = Color.DarkCyan }); g1.Tiles.Add(new Tile() { BackColor = Color.DarkCyan }); g1.Tiles.Add(new Tile() { BackColor = Color.DarkCyan }); g1.Tiles.Add(new Tile() { BackColor = Color.Gray, ColSpan = 3, RowSpan = 4, Title = "Big size", TitleFont = ftTile, TitleColor = Color.White, TitleAlign = System.Drawing.ContentAlignment.TopCenter }); g1.Tiles.Add(new Tile() { BackColor = Color.DarkGreen, RowSpan = 2 }); g1.Tiles.Add(new Tile() { BackColor = Color.DarkGreen, RowSpan = 2 }); g1.Tiles.Add(new Tile() { BackColor = Color.DarkGreen, RowSpan = 2 }); g1.Tiles.Add(new Tile() { BackColor = Color.DarkCyan, ColSpan = 3 }); g1.Tiles.Add(new Tile() { BackColor = Color.Yellow, ColSpan = 3, RowSpan = 2 }); g1.Tiles.Add(new Tile() { BackColor = Color.Yellow, ColSpan = 3, RowSpan = 2 }); g1.Tiles.Add(new Tile() { BackColor = Color.White }); g1.Tiles.Add(new Tile() { BackColor = Color.White }); g1.Tiles.Add(new Tile() { BackColor = Color.White }); g1.Tiles.Add(new Tile() { BackColor = Color.White, ColSpan = 6 }); cg1.Groups.Add(g1); s.ColumnGroups.Add(cg1); return(s); }
public static Screen FullScreen() { var s = new Screen() { BackColor = Color.DarkBlue, Size = new Size() { Width = 1280, Height = 720 }, HorizontalColumnGroupSpacing = 40, Title = "Sample", TitleColor = Color.Black, TitleFont = new Font("Arial", 20, FontStyle.Regular), HeaderThickness = 60, HeaderMargins = new Margins(20, 20, 20, 0), HeaderContentAlign = System.Drawing.ContentAlignment.MiddleCenter, ContentMargins = new Margins(20, 20, 20, 20), ContentAlign = System.Drawing.ContentAlignment.TopCenter }; var ftGroup = new Font("Arial", 12, FontStyle.Regular); var ftTile = new Font("Arial", 10, FontStyle.Regular); var titleTile = new Tile() { Title = "Sample", BackColor = Color.White, TitleFont = new Font("Arial", 20, FontStyle.Regular), TitleAlign = System.Drawing.ContentAlignment.MiddleCenter, TitleColor = Color.Black, ColSpan = 21 }; s.Header.TileSize = 60; s.Header.HorizontalSpacing = 0; s.Header.WidthInColumns = 21; s.Header.Groups.Add(new Group()); s.Header.Groups[0].Tiles.Add(titleTile); var cg1 = new ColumnGroup() { WidthInColumns = 10, HorizontalSpacing = 20, VerticalSpacing = 20, TileSize = 106 }; var g1 = new Group() { }; g1.Tiles.Add(new Tile() { BackColor = Color.DarkCyan }); g1.Tiles.Add(new Tile() { BackColor = Color.DarkCyan }); g1.Tiles.Add(new Tile() { BackColor = Color.DarkCyan }); g1.Tiles.Add(new Tile() { BackColor = Color.Gray, ColSpan = 4, RowSpan = 4, Title = "Big size", TitleFont = ftTile, TitleColor = Color.White, TitleAlign = System.Drawing.ContentAlignment.TopCenter }); g1.Tiles.Add(new Tile() { BackColor = Color.DarkGreen, RowSpan = 2 }); g1.Tiles.Add(new Tile() { BackColor = Color.DarkGreen, RowSpan = 2 }); g1.Tiles.Add(new Tile() { BackColor = Color.DarkGreen, RowSpan = 2 }); g1.Tiles.Add(new Tile() { BackColor = Color.DarkCyan, ColSpan = 3 }); g1.Tiles.Add(new Tile() { BackColor = Color.Yellow, ColSpan = 3, RowSpan = 2 }); g1.Tiles.Add(new Tile() { BackColor = Color.Yellow, ColSpan = 3, RowSpan = 2 }); g1.Tiles.Add(new Tile() { BackColor = Color.White }); g1.Tiles.Add(new Tile() { BackColor = Color.White }); g1.Tiles.Add(new Tile() { BackColor = Color.White }); g1.Tiles.Add(new Tile() { BackColor = Color.White, ColSpan = 7 }); cg1.Groups.Add(g1); s.ColumnGroups.Add(cg1); return(s); }
public GroupConfigurator(ColumnGroup group, TParent parent) : base(group) { _parent = parent; }
//************************************************************************* // Method: ShowColumnGroup() // /// <summary> /// Shows or hides a specified group of related columns in a single table. /// </summary> /// /// <param name="columnGroup"> /// The group of columns to show or hide. /// </param> /// /// <param name="show"> /// true to show the column group, false to hide it. /// </param> /// /// <param name="activateWorksheet"> /// true to activate the worksheet containing the column group. /// </param> /// /// <remarks> /// Columns that don't exist are ignored. /// /// <para> /// The column group's new show/hide state is stored in the workbook using /// the <see cref="PerWorkbookSettings" /> class. /// </para> /// /// </remarks> //************************************************************************* public void ShowColumnGroup( ColumnGroup columnGroup, Boolean show, Boolean activateWorksheet ) { AssertValid(); if ( !this.ExcelApplicationIsReady(true) ) { return; } this.ScreenUpdating = false; try { ColumnGroupManager.ShowOrHideColumnGroup(this.InnerObject, columnGroup, show, activateWorksheet); } finally { this.ScreenUpdating = true; } }