// Reset the iterator. public void Reset() { if (Segments != null) { Segments.Clear(); } }
public override void Build() { var results = BlockCounter.Refresh(); var seg1 = CreateStandardSegment(InsertPosition.ZeroCursor); seg1.AddInterpretter(Button.Quick( "Order by " + (BlockCounter.OrderByCount ? "name instead of by count" : "count instead of by name" ), new ToolTip("Change order"), () => { BlockCounter.OrderByCount = !BlockCounter.OrderByCount; Segments.Clear(); Build(); })); var seg2 = CreateTableSegment(2, results.Length); for (int i = 0; i < results.Length; i++) { var name = new StringDisplay(M.m(results[i].Key.ComponentId.Name), M.m(results[i].Key.GetToolTip())); name.Justify = TextAnchor.MiddleLeft; var count = StringDisplay.Quick(results[i].Value.ToString()); count.Justify = TextAnchor.MiddleRight; seg2.AddInterpretter(name, i, 0); seg2.AddInterpretter(count, i, 1); } }
public void ExpandPath() { // // Flatten all paths by converting <dim, greater-path> pairs by sequences of dimensions <dim, dim2, dim3,...> // List <DcColumn> allSegments = GetAllSegments(); Segments.Clear(); if (allSegments != null && allSegments.Count != 0) { Segments.AddRange(allSegments); } else { // ERROR: Wrong use: The path does not have the corresponding dimension } // // Adding missing paths. Particularly, non-stored paths (paths returning values which are stored only in the greater sets but not in this set). // if (!String.IsNullOrEmpty(RelationalFkName) /*&& Output.IdentityPrimitiveArity == 1*/) { Segments[0].Name = Name; // FK-name is overwritten and lost - attribute name is used instead } // // Dim name adjustment: for 1-column FK dimensions, we prefer to use its only column name instead of the FK-name (fkName is not used) // if (!String.IsNullOrEmpty(RelationalFkName) /*&& Output.IdentityPrimitiveArity == 1*/) { Segments[0].Name = Name; // FK-name is overwritten and lost - attribute name is used instead } }
private void CalculateSegments() { if (Segments == null) { Segments = new List <ISegment>(); } else { Segments.Clear(); } // 2 // x-------x // | | // 3 | o | 4 // | | // x-------x // 1 Segments.Add(new LineSegment( new Point(Centre.X - (Width / 2) + (Shrink / 2), Centre.Y - (Height / 2) + (Shrink / 2)), new Point(Centre.X + (Width / 2) - (Shrink / 2), Centre.Y - (Height / 2) + (Shrink / 2)))); Segments.Add(new LineSegment( new Point(Centre.X - (Width / 2) + (Shrink / 2), Centre.Y + (Height / 2) - (Shrink / 2)), new Point(Centre.X + (Width / 2) - (Shrink / 2), Centre.Y + (Height / 2) - (Shrink / 2)))); Segments.Add(new LineSegment( new Point(Centre.X - (Width / 2) + (Shrink / 2), Centre.Y - (Height / 2) + (Shrink / 2)), new Point(Centre.X - (Width / 2) + (Shrink / 2), Centre.Y + (Height / 2) - (Shrink / 2)))); Segments.Add(new LineSegment( new Point(Centre.X + (Width / 2) - (Shrink / 2), Centre.Y - (Height / 2) + (Shrink / 2)), new Point(Centre.X + (Width / 2) - (Shrink / 2), Centre.Y + (Height / 2) - (Shrink / 2)))); }
// Dispose the object. public void Dispose() { Input = null; Output = null; Segments.Clear(); Segments = null; }
public void Dispose() { for (int i = 0; i < Segments.Count; i++) { ArrayPool <byte> .Shared.Return(Segments[i]); } Segments.Clear(); }
/// <summary> /// Creates the segments of FastLineSeries. /// </summary> public override void CreateSegments() { if (GroupedSeriesYValues != null && GroupedSeriesYValues[0].Contains(double.NaN)) { List <List <double> > yValList; List <List <double> > xValList; this.CreateEmptyPointSegments(GroupedSeriesYValues[0], out yValList, out xValList); } else if (YValues.Contains(double.NaN)) { List <List <double> > yValList; List <List <double> > xValList; this.CreateEmptyPointSegments(YValues, out yValList, out xValList); } else { bool isGrouping = this.ActualXAxis is CategoryAxis ? (this.ActualXAxis as CategoryAxis).IsIndexed : true; if (!isGrouping) { xValues = GroupedXValuesIndexes; } else { xValues = (ActualXValues is IList <double> && !IsIndexed) ? ActualXValues as IList <double> : GetXValues(); } if (!isGrouping) { Segments.Clear(); Adornments.Clear(); if (Segment == null || Segments.Count == 0) { FastLineSegment segment = new FastLineSegment(xValues, GroupedSeriesYValues[0], this); Segment = segment; Segments.Add(segment); } } else { ClearUnUsedAdornments(this.DataCount); if (Segment == null || Segments.Count == 0) { FastLineSegment segment = new FastLineSegment(xValues, YValues, this); Segment = segment; Segments.Add(segment); } else if (ActualXValues != null) { Segment.SetData(xValues, YValues); (Segment as FastLineSegment).SetRange(); Segment.Item = ActualData; } } isAdornmentPending = true; } }
private void btnNewXML_Click(object sender, EventArgs e) { Segments.Clear(); listSegments.Items.Clear(); txtStatus.Text = ""; txtVersion.Text = "1"; XMLFile = ""; labelXML.Text = ""; }
public static void Cleanup() { Verticies = new VertexPositionColor[MaxTriangles * 3]; VertexCount = 0; Effect = null; Camera = null; Boxes.Clear(); Segments.Clear(); }
/// <summary> /// Releases unmanaged and - optionally - managed resources /// </summary> /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param> protected void Dispose(bool disposing) { if (disposing) { CleanupOutputStream(); HttpContent = null; HeaderParser = null; Segments.Clear(); } }
protected override void OnBindingPathChanged(DependencyPropertyChangedEventArgs args) { YValues.Clear(); Segments.Clear(); if (this.Area != null) { this.Area.IsUpdateLegend = true; } base.OnBindingPathChanged(args); }
private void GenerateBoundarySegments(int LElements, int HElements) { Segments.Clear(); for (int i = 0; i < LElements; i++) { Segment segment = new Segment(Nodes[i], Nodes[i + 1]); Segments.Add(segment); } }
private void ReadPath() { Segments.Clear(); var splitResult = FullPath.Split('.'); foreach (var item in splitResult) { Segments.Add(CreateSegment(item)); } }
private void onPreferencesChanged(IDatabasePreferences preferences) { DurationFormat = preferences.DurationFormat; dateFormat = preferences.DateFormat; var segments = Segments.Select(segment => segment.WithDurationFormat(DurationFormat)); Segments.Clear(); Segments.AddRange(segments); updateCurrentDateRangeString(); }
private void onSerialized(StreamingContext context) { if (Segments != null) { Segments.Clear(); } //if (Keys != null) //{ // Keys.Dispose(); // Keys = null; //} }
private void RefreshSegments(int id) { Segments.Clear(); using (OracleConnection connection = new OracleConnection(connectionString)) { //string queryString = String.Format("SELECT * FROM RECIPESEGMENT " + // "INNER JOIN segment ON RECIPESEGMENT.ID_segment=segment.id " + // "INNER JOIN recipe ON RECIPESEGMENT.ID_recipe=recipe.id " + // "where recipe.id={0};", id); string queryString = String.Format("SELECT * FROM SEGMENTS INNER JOIN RECIPES on SEGMENTS.ID_recipe = recipes.id where recipes.id = '{0}' order by segment_number", id); OracleCommand command = new OracleCommand(queryString, connection); connection.Open(); try { using (OracleDataReader reader = command.ExecuteReader()) { DataTable dataTable = new DataTable(); dataTable.Load(reader); //dataTable.Rows[0][] for (int i = 0; i < dataTable.Rows.Count; ++i) { Segments.Add(new Segment_Details { ID = Convert.ToInt32(dataTable.Rows[i][0]), Segment_Number = dataTable.Rows[i][2].ToString(), RAMP_SP = dataTable.Rows[i][3].ToString(), MIN_RAMP = dataTable.Rows[i][4].ToString(), MAX_RAMP = dataTable.Rows[i][5].ToString(), SOAK_SP = dataTable.Rows[i][6].ToString(), MIN_SOAK = dataTable.Rows[i][7].ToString(), MAX_SOAK = dataTable.Rows[i][8].ToString(), SOAK_TIME = dataTable.Rows[i][9].ToString(), LOW_TEMP_MODE_SP = dataTable.Rows[i][10].ToString(), ALARM_TEMP_TH = dataTable.Rows[i][11].ToString(), LOW_TEMP_MODE_EN = Convert.ToChar(dataTable.Rows[i][12]), }); } } } catch (Exception Ex) { MessageBox.Show(Ex.Message); } finally { connection.Close(); } } }
/// <summary> /// Called when DataSource property get changed /// </summary> /// <param name="oldValue">The Old Value</param> /// <param name="newValue">The New Value</param> protected override void OnDataSourceChanged(IEnumerable oldValue, IEnumerable newValue) { base.OnDataSourceChanged(oldValue, newValue); this.YValues.Clear(); Segments.Clear(); this.GeneratePoints(new[] { this.YBindingPath }, this.YValues); if (this.Area != null) { Area.IsUpdateLegend = true; } this.UpdateArea(); }
internal void Load(string outputString, IEnumerable <DocumentSegment> segments = null) { textDocument.Text = outputString; Segments.Clear(); if (segments != null) { foreach (DocumentSegment segment in segments) { Segments.Add(segment); } } textDocument.UndoStack.ClearAll(); }
public void Init() { //This is just because the sections and segments start at Idx=1 //Segment[0] doesn't do anything Segments.Clear(); XSecs.Clear(); Sectns.Clear(); //RacingLine = new RacingLine(); IsCircular = false; RoadSectn sectn = new RoadSectn(); Sectns.Add(sectn); sectn.Idx = 0; //Put all the materials in a dictionary for faster retrieval Material M; RoadMaterials = new Dictionary <string, Material>(); M = (Material)Resources.Load("Prefabs/Materials/Tarmac", typeof(Material)); RoadMaterials.Add("Tarmac", M); M = (Material)Resources.Load("Prefabs/Materials/Tarmac0", typeof(Material)); RoadMaterials.Add("Tarmac0", M); M = (Material)Resources.Load("Prefabs/Materials/Tarmac1", typeof(Material)); RoadMaterials.Add("Tarmac1", M); M = (Material)Resources.Load("Prefabs/Materials/Tarmac2", typeof(Material)); RoadMaterials.Add("Tarmac2", M); M = (Material)Resources.Load("Prefabs/Materials/Tarmac3", typeof(Material)); RoadMaterials.Add("Tarmac3", M); M = (Material)Resources.Load("Prefabs/Materials/Washboard0", typeof(Material)); RoadMaterials.Add("Washboard0", M); M = (Material)Resources.Load("Prefabs/Materials/Washboard1", typeof(Material)); RoadMaterials.Add("Washboard1", M); M = (Material)Resources.Load("Prefabs/Materials/DirtyRoad", typeof(Material)); RoadMaterials.Add("DirtyRoad", M); M = (Material)Resources.Load("Prefabs/Materials/DirtRoad0", typeof(Material)); RoadMaterials.Add("DirtRoad0", M); M = (Material)Resources.Load("Prefabs/Materials/DirtRoad1", typeof(Material)); RoadMaterials.Add("DirtRoad1", M); M = (Material)Resources.Load("Prefabs/Materials/DirtRoad2", typeof(Material)); RoadMaterials.Add("DirtRoad2", M); M = (Material)Resources.Load("Prefabs/Materials/DirtRoad3", typeof(Material)); RoadMaterials.Add("DirtRoad3", M); M = (Material)Resources.Load("Prefabs/Materials/TarmacUnderside", typeof(Material)); RoadMaterials.Add("TarmacUnderside", M); M = (Material)Resources.Load("Prefabs/Materials/WashboardUnderside", typeof(Material)); RoadMaterials.Add("WashboardUnderside", M); M = (Material)Resources.Load("Prefabs/Materials/DirtyRoadUnderside", typeof(Material)); RoadMaterials.Add("DirtyRoadUnderside", M); SkidMks = new Queue <FlatLineRenderer>(); }
private void RefreshRecipes(object obj) { Recipes.Clear(); SelectedRecipeName = ""; SelectedRecipeNumber = ""; Segments.Clear(); using (OracleConnection connection = new OracleConnection(connectionString)) { string queryString = "SELECT * from RECIPES"; OracleCommand command = new OracleCommand(queryString, connection); connection.Open(); OracleDataReader reader = command.ExecuteReader(); try { using (OracleDataReader da = command.ExecuteReader()) { DataTable dataTable = new DataTable(); dataTable.Load(reader); foreach (DataRow dataRow in dataTable.Rows) { foreach (var item in dataRow.ItemArray) { Console.WriteLine(item); } } for (int i = 0; i < dataTable.Rows.Count; ++i) { Recipes.Add(new Recipe_Details { Recipe_ID = Convert.ToInt32(dataTable.Rows[i][0]), Recipe_Name = dataTable.Rows[i][1].ToString(), Recipe_Number = dataTable.Rows[i][2].ToString(), }); } } } catch (Exception Ex) { MessageBox.Show(Ex.Message); } finally { reader.Close(); } } }
public override void CreateEmptyPointSegments(IList <double> YValues, out List <List <double> > yValList, out List <List <double> > xValList) { if (this.ActualXAxis is CategoryAxis && (!(this.ActualXAxis as CategoryAxis).IsIndexed)) { xValues = GroupedXValuesIndexes; base.CreateEmptyPointSegments(GroupedSeriesYValues[0], out yValList, out xValList); } else { xValues = (ActualXValues is IList <double> && !IsIndexed) ? ActualXValues as IList <double> : GetXValues(); base.CreateEmptyPointSegments(YValues, out yValList, out xValList); } int j = 0; // EmptyPoint calculation if (Segments.Count != yValList.Count) { Segments.Clear(); } ClearUnUsedAdornments(this.DataCount); if (Segment == null || Segments.Count == 0) { for (int i = 0; i < yValList.Count && i < xValList.Count; i++) { if (i < xValList.Count && i < yValList.Count && xValList[i].Count > 0 && yValList[i].Count > 0) { Segment = new FastLineSegment(xValList[i], yValList[i], this); Segments.Add(Segment); } } } else if (xValues != null) { foreach (var segment in Segments) { if (j < xValList.Count && j < yValList.Count && xValList[j].Count > 0 && yValList[j].Count > 0) { segment.SetData(xValList[j], yValList[j]); (segment as FastLineSegment).SetRange(); } j++; } } isAdornmentPending = true; }
private void ApplyChanges(DocumentChangeEventArgs lastChange, ReadOnlyCollection <DocumentSegment> changedSegments) { if (textDocument.TextLength == 0) { Segments.Clear(); return; } if (lastChange == null) { return; } if (textDocument.IsInUpdate) { return; } List <DocumentSegment> affectedSegments = changedSegments.Where(v => v is PlaceholderSegment).ToList(); foreach (var segment in affectedSegments.Where(v => v.Length == 0).ToList()) { Segments.Remove(segment); affectedSegments.Remove(segment); } if (!affectedSegments.Any()) { return; } if (!textDocument.UndoStack.CanUndo) { return; } try { textDocument.UndoStack.Undo(); } catch (Exception) { return; } int offset = lastChange.Offset; int legnth = lastChange.RemovalLength; string text = lastChange.InsertedText.Text; Replace(affectedSegments, ref offset, ref legnth, ref text); }
/// <summary> /// Creates the segments of FunnelSeries. /// </summary> public override void CreateSegments() { Segments.Clear(); Adornments.Clear(); List <double> xValues = GetXValues(); double sumValues = 0d, gapRatio = this.GapRatio; int count = DataCount; int explodedIndex = this.ExplodeIndex; ChartFunnelMode funnelmode = this.FunnelMode; IList <double> toggledYValues = null; if (ToggledLegendIndex.Count > 0) { toggledYValues = GetYValues(); } else { toggledYValues = YValues; } for (int i = 0; i < count; i++) { sumValues += Math.Max(0, Math.Abs(double.IsNaN(toggledYValues[i]) ? 0 : toggledYValues[i])); } if (funnelmode == ChartFunnelMode.ValueIsHeight) { this.CalculateValueIsHeightSegments(toggledYValues, xValues, sumValues, gapRatio, count, explodedIndex); } else { this.CalculateValueIsWidthSegments(toggledYValues, xValues, sumValues, gapRatio, count, explodedIndex); } if (ShowEmptyPoints) { UpdateEmptyPointSegments(xValues, false); } if (ActualArea != null) { ActualArea.IsUpdateLegend = true; } }
/// <summary> /// Creates the segments of FastLineBitmapSeries. /// </summary> public override void CreateSegments() { var isGrouped = ActualXAxis is CategoryAxis && !(ActualXAxis as CategoryAxis).IsIndexed; if (isGrouped) { xValues = GroupedXValuesIndexes; } else { xValues = (ActualXValues is IList <double>) ? ActualXValues as IList <double> : GetXValues(); } if (isGrouped) { Segments.Clear(); Adornments.Clear(); if (Segment == null || Segments.Count == 0) { FastLineBitmapSegment segment = new FastLineBitmapSegment(xValues, GroupedSeriesYValues[0], this); Segment = segment; Segments.Add(segment); } } else { ClearUnUsedAdornments(this.DataCount); if (Segment == null || Segments.Count == 0) { FastLineBitmapSegment segment = new FastLineBitmapSegment(xValues, YValues, this); Segment = segment; Segments.Add(segment); } else if (ActualXValues != null) { Segment.SetData(xValues, YValues); (Segment as FastLineBitmapSegment).SetRange(); Segment.Item = ActualData; } } isAdornmentPending = true; }
/// <summary> /// Called when DataSource property get changed /// </summary> /// <param name="oldValue"></param> /// <param name="newValue"></param> protected override void OnDataSourceChanged(IEnumerable oldValue, IEnumerable newValue) { base.OnDataSourceChanged(oldValue, newValue); if (YValues != null) { YValues.Clear(); } if (Segments != null) { Segments.Clear(); } GeneratePoints(new[] { YBindingPath }, YValues); isPointValidated = false; if (this.Area != null) { this.Area.IsUpdateLegend = true; } UpdateArea(); }
public void LoadFile(string FileName) { try { Segments.Clear(); Logger("Loading file: " + Path.GetFileName(FileName), false); System.Xml.Serialization.XmlSerializer reader = new System.Xml.Serialization.XmlSerializer(typeof(List <SegmentConfig>)); System.IO.StreamReader file = new System.IO.StreamReader(FileName); Segments = (List <SegmentConfig>)reader.Deserialize(file); file.Close(); if (Segments[0].Version == null || Segments[0].Version == "") { SegmentConfig S = Segments[0]; S.Version = "1"; Segments[0] = S; } listSegments.Items.Clear(); for (int s = 0; s < Segments.Count; s++) { var item = new ListViewItem(Segments[s].Name); if (Segments[s].Addresses != null) { item.SubItems.Add(Segments[s].Addresses); } else { item.SubItems.Add(""); } item.Tag = s; listSegments.Items.Add(item); } Logger(" [OK]"); XMLFile = FileName; labelXML.Text = Path.GetFileName(XMLFile); txtVersion.Text = Segments[0].Version; } catch (Exception ex) { Logger(ex.Message); } }
/// <summary> /// Creates the segments of FastScatterBitmapSeries /// </summary> public override void CreateSegments() { bool isGrouping = this.ActualXAxis is CategoryAxis && !(this.ActualXAxis as CategoryAxis).IsIndexed; if (isGrouping) { xValues = GroupedXValuesIndexes; } else { xValues = GetXValues(); } if (isGrouping) { Segments.Clear(); Adornments.Clear(); if (Segments == null || Segments.Count == 0) { Segment = new FastScatterBitmapSegment(xValues, GroupedSeriesYValues[0], this); Segments.Add(Segment); } } else { ClearUnUsedAdornments(this.DataCount); if (Segments == null || Segments.Count == 0) { Segment = new FastScatterBitmapSegment(xValues, YValues, this); Segments.Add(Segment); } else if (ActualXValues != null) { Segment.SetData(xValues, YValues); (Segment as FastScatterBitmapSegment).SetRange(); Segment.Item = ActualData; } } isAdornmentsBending = true; }
protected override void BeforePatchApplied() { Segments.Clear(); Segments.Add(asmPatch); Segments.Add(outerDoorTilePatch); Segments.Add(outerHDoorTilePatch); Segments.Add(innerDoorTilePatch); if (ComboSample) { Segments.Add(standardDoorComboPatch); Segments.Add(hDoorComboPatch); } if (StructureSample) { Segments.Add(standardDoorStructPatch); Segments.Add(hDoorStructPatch); Segments.Add(structPointerTableCorrectionPatch); } }
public override void Build() { if (results == null) { results = _focus.SearchWithNewQuery("").ToArray(); } var seg1 = CreateStandardSegment(InsertPosition.ZeroCursor); seg1.AddInterpretter(TextInput <BlockSearch> .Quick(_focus, M.m <BlockSearch>(x => x.query), "Search query", new ToolTip("Search query"), (x, query) => { if (query != x.query) { if (query.Contains('`')) { deactivate(); return; } results = x.SearchWithNewQuery(query).ToArray(); Segments.Clear(); Build(); } })); var seg2 = CreateStandardSegment(); foreach (var item in results) { var button = SubjectiveButton <BlockSearch> .Quick(_focus, item.ComponentId.Name, item.GetToolTip(), x => { x.SelectItem(item); deactivate(); }); button.Justify = TextAnchor.MiddleLeft; seg2.AddInterpretter(button); } }
public void Init(GameObject head, int segments = 1, GameDirection direction = GameDirection.Right) { Direction = direction; Segments.Clear(); Segments.Add(head); GameObject pseg = head; for (int i = 0; i < segments; i++) { float x, y; switch (direction) { case GameDirection.Up: x = pseg.X; y = pseg.Y + pseg.Height; break; case GameDirection.Down: x = pseg.X; y = pseg.Y - pseg.Height; break; case GameDirection.Left: x = pseg.X + pseg.Width; y = pseg.Y; break; default: x = pseg.X - pseg.Width; y = pseg.Y; break; } GameObject nseg = new GameObject(x, y, pseg.Width, pseg.Height); Segments.Add(nseg); pseg = nseg; } }