sc 10 months ago
parent
commit
3a3e2abd34
  1. 24
      ControlUse/Timeline/ChartConstants.cs
  2. 20
      ControlUse/Timeline/Model/BarModel.cs
  3. 10
      ControlUse/Timeline/Model/HeaderModel.cs
  4. 13
      ControlUse/Timeline/Model/ItemModel.cs
  5. 131
      ControlUse/Timeline/Processor/BarChartProcessor.cs
  6. 33
      ControlUse/Timeline/Properties/AssemblyInfo.cs
  7. 38
      ControlUse/Timeline/Timeline.Designer.cs
  8. 314
      ControlUse/Timeline/Timeline.cs
  9. 47
      ControlUse/Timeline/TimelineChart.Designer.cs
  10. 318
      ControlUse/Timeline/TimelineChart.cs
  11. 120
      ControlUse/Timeline/TimelineChart.resx
  12. 60
      ControlUse/Timeline/Timelines.csproj
  13. 10
      SunlightCentralizedControlManagement(SCCM).sln
  14. 78
      SunlightCentralizedControlManagement_SCCM_.csproj
  15. 5
      View/ProductionPlanningView.xaml
  16. 35
      View/ProductionPlanningView.xaml.cs
  17. 2
      ViewModel/MainWindowViewModel.cs
  18. 13
      ViewModel/ProductionPlanningModel.cs

24
ControlUse/Timeline/ChartConstants.cs

@ -1,24 +0,0 @@
using System;
using System.Collections.Generic;
using Timelines.Model;
using System.Windows.Forms;
using System.Drawing;
namespace Timelines
{
public static class ChartConstants
{
public const int BarStartRight = 25;
public const int BarStartLeft = 50;
public const int HeaderTimeStartTop = 30;
public const int BarStartTop = 50;
public const int BarHeight = 40;
public const int BarSpace = 8;
public const int ToolTipTitleHeight = 14;
public const int ToolTipfontHeight = 12;
public const int MinimumIntervalInMinutes = 5;
public static Font RowFont = new Font("Arial", 10, FontStyle.Regular, GraphicsUnit.Point);
public static Font TitleFont = new Font("Arial", 10, FontStyle.Bold, GraphicsUnit.Point);
public static Pen GridColor = Pens.LightBlue;
}
}

20
ControlUse/Timeline/Model/BarModel.cs

@ -1,20 +0,0 @@
using System;
using System.Drawing;
namespace Timelines.Model
{
public class BarModel
{
public DateTime StartValue { get; set; }
public DateTime EndValue { get; set; }
public Color Color { get; set; }
public string Name { get; set; }
public TimeSpan Duration { get; set; }
public int RowIndex { get; set; }
public bool IsClicked { get; set; }
public bool IsMouseOver { get; set; }
public bool Visible { get; set; }
public Rectangle BarRectangle { get; set; }
}
}

10
ControlUse/Timeline/Model/HeaderModel.cs

@ -1,10 +0,0 @@
using System;
namespace Timelines.Model
{
public class HeaderModel
{
public int StartLocation { get; set; }
public DateTime HeaderDateTime { get; set; }
}
}

13
ControlUse/Timeline/Model/ItemModel.cs

@ -1,13 +0,0 @@
using System;
using System.Drawing;
namespace Timelines.Model
{
public class ItemModel
{
public string ItemName { get; set; }
public DateTime StartDate { get; set; }
public Color ItemColor { get; set; }
public TimeSpan Duration { get; set; }
}
}

131
ControlUse/Timeline/Processor/BarChartProcessor.cs

@ -1,131 +0,0 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Runtime.Remoting.Messaging;
using Timelines.Model;
using Timelines;
using System.Threading.Tasks;
namespace Timelines.Processor
{
public class BarChartProcessor
{
private List<string> ItemNameList { get; set; }
public List<BarModel> GetBarList(List<ItemModel> itemList)
{
var barList = new List<BarModel>();
itemList.ForEach(x =>
{
var bar = new BarModel
{
Name = x.ItemName,
StartValue = x.StartDate,
EndValue = x.StartDate + x.Duration,
Duration = x.Duration,
Color = x.ItemColor,
RowIndex = GetRowIndex(x.ItemName)
};
barList.Add(bar);
});
return barList;
}
private int GetRowIndex(string barName)
{
if (ItemNameList == null)
{
ItemNameList = new List<string>();
}
if (!ItemNameList.Contains(barName))
{
ItemNameList.Add(barName);
}
return ItemNameList.FindIndex(x => x == barName);
}
public List<HeaderModel> GetFullHeaderList(DateTime startDate, DateTime endDate, int availableWidth, Font timeFont)
{
var headerList = new List<HeaderModel>();
var timeInterval = endDate - startDate;
var headerSpace = System.Windows.Forms.TextRenderer.MeasureText("12-12-12", timeFont);
var numberOfHeaders = availableWidth / headerSpace.Width;
var timeIncrement = new TimeSpan(timeInterval.Ticks/numberOfHeaders);
var index = 0;
for (var date = startDate; date <= endDate; date = date.Add(timeIncrement), index ++)
{
var header = new HeaderModel
{
HeaderDateTime = date,
StartLocation = ChartConstants.BarStartLeft + (index * headerSpace.Width)
};
headerList.Add(header);
}
return headerList;
}
public bool MouseInsideBar(Point mousePosition, BarModel bar)
{
return mousePosition.X >= bar.BarRectangle.Left
&& mousePosition.X <= bar.BarRectangle.Right
&& mousePosition.Y >= bar.BarRectangle.Top
&& mousePosition.Y <= bar.BarRectangle.Bottom;
}
internal List<BarModel> MouseClickHandler(List<BarModel> list, Point localMousePosition)
{
Parallel.ForEach(list, bar =>
{
if (MouseInsideBar(localMousePosition, bar) && bar.Visible)
{
bar.IsClicked = true;
}
else
{
bar.IsClicked = false;
}
});
return list;
}
internal double GetPixelsPerSecond(List<HeaderModel> headerList)
{
var timeBetweenHeaders = headerList[1].HeaderDateTime - headerList[0].HeaderDateTime;
var widthBetween = headerList[1].StartLocation - headerList[0].StartLocation;
var pixelsPerSecond = widthBetween / timeBetweenHeaders.TotalSeconds;
return pixelsPerSecond;
}
internal BarModel GetBar(BarModel bar, DateTime startDate, double pixelsPerSecond, int scrollPosition, int chartWidth)
{
var availableWidth = chartWidth - ChartConstants.BarStartLeft - ChartConstants.BarStartRight;
bar.Visible = true;
var startTimeSpan = bar.StartValue - startDate;
var startLocation = (int)(pixelsPerSecond * startTimeSpan.TotalSeconds);
var x = ChartConstants.BarStartLeft + startLocation;
var y = ChartConstants.BarStartTop + (ChartConstants.BarHeight * (bar.RowIndex - scrollPosition)) +
(ChartConstants.BarSpace * (bar.RowIndex - scrollPosition)) + 4;
var width = (int)(pixelsPerSecond * bar.Duration.TotalSeconds);
//restrict the width if longer than the right size
if (x + width > (chartWidth - ChartConstants.BarStartRight))
{
width = availableWidth + ChartConstants.BarStartLeft - x;
}
bar.BarRectangle = new Rectangle(x, y, width, ChartConstants.BarHeight);
return bar;
}
}
}

33
ControlUse/Timeline/Properties/AssemblyInfo.cs

@ -1,33 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("Timelines")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Timelines")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("fcaa62db-0f2f-449c-8511-c6f0821688a7")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

38
ControlUse/Timeline/Timeline.Designer.cs

@ -1,38 +0,0 @@
namespace Timelines
{
partial class Timeline
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
}
#endregion
}
}

314
ControlUse/Timeline/Timeline.cs

@ -1,314 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Timelines.Model;
using Timelines.Processor;
namespace Timelines
{
public partial class Timeline : UserControl
{
#region public properties
public SolidBrush HoverClickSolidBrush { get; set; }
public Font RowFont { get; set; }
public Font DateFont { get; set; }
public Font TimeFont { get; set; }
#endregion
#region private properties
private ToolTip ToolTip { get; set; }
private VScrollBar VScrollBar1 { get; set; }
private int AvailableWidth { get; set; }
private Point OldMousePosition { get; set; }
private int ScrollPosition { get; set; }
private List<string> ToolTipTextList { get; set; }
private string ToolTipTextTitle { get; set; }
private List<BarModel> BarList { get; set; }
private DateTime StartDate { get; set; }
private int DistinctItemCount { get; set; }
private DateTime EndDate { get; set; }
#endregion
public Timeline()
{
InitializeComponent();
}
public void ShowBarChart(DateTime chartStartDate, DateTime chartEndDate, List<ItemModel> items)
{
this.StartDate = chartStartDate;
this.EndDate = chartEndDate;
var proc = new BarChartProcessor();
this.BarList = proc.GetBarList(items);
this.DistinctItemCount = items.Select(i => i.ItemName).Distinct().Count();
this.Refresh();
}
private void ChartMouseMove(Object sender, MouseEventArgs e)
{
var localMousePosition = new Point(e.X, e.Y);
if (BarList == null || BarList.Count == 0)
{
return;
}
if (localMousePosition == this.OldMousePosition)
{
return;
}
var proc = new BarChartProcessor();
var mouseOverObject = false;
var tempText = new List<string>();
var tempTitle = "";
Parallel.ForEach(this.BarList, bar =>
{
if (proc.MouseInsideBar(localMousePosition, bar) && bar.Visible)
{
bar.IsMouseOver = true;
tempTitle = bar.Name;
tempText.Add("Event Start: " + bar.StartValue.ToUniversalTime());
tempText.Add("Event End: " + bar.EndValue.ToUniversalTime());
mouseOverObject = true;
}
else
{
bar.IsMouseOver = false;
}
});
this.ToolTipTextList = tempText;
this.ToolTipTextTitle = tempTitle;
this.ToolTip.SetToolTip(this, this.ToolTipTextList.Count > 0 ? this.ToolTipTextList.ToString() : "");
if (mouseOverObject)
{
this.Refresh();
}
this.OldMousePosition = localMousePosition;
}
private void ChartMouseClick(Object sender, MouseEventArgs e)
{
if (BarList == null || BarList.Count == 0)
{
return;
}
var localMousePosition = new Point(e.X, e.Y);
var proc = new BarChartProcessor();
this.BarList = proc.MouseClickHandler(this.BarList, localMousePosition);
}
private void ChartMouseWheel(object sender, MouseEventArgs e)
{
this.VScrollBar1.Focus();
}
private void Timeline_Load(object sender, EventArgs e)
{
//initialize public properties
RowFont = TimeFont = DateFont = new Font("Segoe UI", 10, FontStyle.Regular, GraphicsUnit.Point);
HoverClickSolidBrush = new SolidBrush(Color.LightBlue);
BackColor = Color.White;
//initialize mouse controls
MouseMove += ChartMouseMove;
MouseWheel += ChartMouseWheel;
MouseClick += ChartMouseClick;
//initialize Tooltip
this.ToolTip = new ToolTip
{
OwnerDraw = true
};
this.ToolTip.Draw += ToolTipText_Draw;
this.ToolTip.Popup += ToolTipText_Popup;
//Flicker free drawing
SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
//ScrollBar
this.VScrollBar1 = new VScrollBar
{
Dock = DockStyle.Right,
Visible = false
};
Controls.Add(this.VScrollBar1);
this.VScrollBar1.Scroll += vScrollBar1_Scroll;
}
private void vScrollBar1_Scroll(object sender, ScrollEventArgs e)
{
this.ScrollPosition = this.VScrollBar1.Value;
this.Refresh();
}
private void ToolTipText_Draw(Object sender, DrawToolTipEventArgs e)
{
if (this.ToolTipTextList.Count == 0)
{
return;
}
e.Graphics.FillRectangle(Brushes.White, e.Bounds);
e.Graphics.DrawString(this.ToolTipTextTitle, ChartConstants.TitleFont, Brushes.Black, 5, 0);
// Draws the lines in the text box
foreach (var item in this.ToolTipTextList)
{
var stringY = (ChartConstants.ToolTipTitleHeight - ChartConstants.ToolTipfontHeight - e.Graphics.MeasureString(item, ChartConstants.RowFont).Height) / 2 +
10 + ((this.ToolTipTextList.IndexOf(item) + 1) * 14);
e.Graphics.DrawString(item, ChartConstants.RowFont, Brushes.Black, 5, stringY);
}
}
private void ToolTipText_Popup(Object sender, PopupEventArgs e)
{
var toolTipHeight = (ChartConstants.ToolTipTitleHeight + 4) + (this.ToolTipTextList.Count * (ChartConstants.ToolTipfontHeight + 3));
e.ToolTipSize = new Size(230, toolTipHeight);
}
private void PaintChart(Graphics graphics)
{
if (BarList == null || BarList.Count == 0)
{
return;
}
var proc = new BarChartProcessor();
var headerList = proc.GetFullHeaderList(this.StartDate, this.EndDate, this.Width, this.TimeFont);
if (headerList.Count == 0 || this.DistinctItemCount == 0)
{
return;
}
var pixelsPerSecond = proc.GetPixelsPerSecond(headerList);
this.AvailableWidth = Width - ChartConstants.BarStartLeft - ChartConstants.BarStartRight;
if (this.DistinctItemCount * (ChartConstants.BarHeight + ChartConstants.BarSpace) > Height)
{
this.VScrollBar1.Visible = true;
this.VScrollBar1.Maximum = this.DistinctItemCount - 3;
}
graphics.Clear(BackColor);
DrawChartHeadersAndNet(graphics, headerList);
DrawBars(graphics, this.BarList, pixelsPerSecond);
}
protected override void OnPaint(PaintEventArgs pe)
{
PaintChart(pe.Graphics);
}
private void DrawBars(Graphics graphics, IEnumerable<BarModel> barList, double pixelsPerSecond)
{
//list of machineNames to add to the left of each row
var rowTitleList = new List<string>();
var proc = new BarChartProcessor();
// Draws each bar
foreach (var bar in barList)
{
var numberOfBarsInControl = (Height - ChartConstants.BarStartTop) / (ChartConstants.BarHeight + ChartConstants.BarSpace);
if ((bar.RowIndex >= this.ScrollPosition &&
bar.RowIndex < numberOfBarsInControl + this.ScrollPosition))
{
var newBar = proc.GetBar(bar, this.StartDate, pixelsPerSecond, ScrollPosition, this.Width);
DrawBarAndRowText(newBar, rowTitleList, graphics);
}
else
{
bar.Visible = false;
}
}
}
private void DrawBarAndRowText(BarModel newBar, ICollection<string> rowTitleList, Graphics graphics)
{
var barBrush = new SolidBrush(newBar.Color);
if (newBar.IsMouseOver || newBar.IsClicked)
{
barBrush = HoverClickSolidBrush;
}
graphics.FillRectangle(barBrush, newBar.BarRectangle);
graphics.DrawRectangle(Pens.Black, newBar.BarRectangle);
// Draws the rowtext, only once for each machine
if (!rowTitleList.Contains(newBar.Name))
{
graphics.DrawString(newBar.Name,
RowFont,
Brushes.Black,
0,
ChartConstants.BarStartTop + (ChartConstants.BarHeight * (newBar.RowIndex - this.ScrollPosition)) +
(ChartConstants.BarSpace * (newBar.RowIndex - this.ScrollPosition)));
rowTitleList.Add(newBar.Name);
}
}
private void DrawChartHeadersAndNet(Graphics graphics, IList<HeaderModel> headerList)
{
var verticalLineLastY = ChartConstants.BarStartTop + (this.DistinctItemCount - this.ScrollPosition) * (ChartConstants.BarHeight + ChartConstants.BarSpace);
//draw headers
foreach (var header in headerList)
{
//draw the date when there is a change of day
var index = headerList.IndexOf(header);
if (headerList.IndexOf(header) == 0
|| header.HeaderDateTime.Day != headerList[index - 1].HeaderDateTime.Day)
{
graphics.DrawString(
header.HeaderDateTime.ToShortDateString(),
DateFont,
Brushes.Black,
header.StartLocation,
0);
}
graphics.DrawString(
header.HeaderDateTime.ToShortTimeString(),
TimeFont,
Brushes.Black,
header.StartLocation,
ChartConstants.HeaderTimeStartTop);
//draw vertical line under header
graphics.DrawLine(
ChartConstants.GridColor,
header.StartLocation,
ChartConstants.HeaderTimeStartTop,
header.StartLocation,
verticalLineLastY);
}
//draw last vertical line
graphics.DrawLine(
ChartConstants.GridColor,
ChartConstants.BarStartLeft + this.AvailableWidth,
ChartConstants.HeaderTimeStartTop,
ChartConstants.BarStartLeft + this.AvailableWidth,
verticalLineLastY);
//draw horizontal net
for (var index = 0; index < this.DistinctItemCount; index++)
{
var y = ChartConstants.BarStartTop + index * (ChartConstants.BarHeight + ChartConstants.BarSpace);
graphics.DrawLine(
ChartConstants.GridColor,
ChartConstants.BarStartLeft,
y,
ChartConstants.BarStartLeft + this.AvailableWidth,
y
);
}
}
}
}

47
ControlUse/Timeline/TimelineChart.Designer.cs

@ -1,47 +0,0 @@
namespace Timeline
{
partial class TimelineChart
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// Timeline
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.MinimumSize = new System.Drawing.Size(100, 100);
this.Name = "Timeline";
this.Size = new System.Drawing.Size(157, 136);
this.Load += new System.EventHandler(this.Timeline_Load);
this.ResumeLayout(false);
}
#endregion
}
}

318
ControlUse/Timeline/TimelineChart.cs

@ -1,318 +0,0 @@
/// <summary>
/// Adds a timeline or Gantt user control.
/// See Timeline Test for usage.
/// Created by Maxime Jacques - 2014
/// Parts of code and inspiration from VBGanttChart v0.55
/// by Adrian "Adagio" Grau http://www.codeproject.com/Articles/20731/Gantt-Chart
/// </summary>
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using Timeline.Model;
using Timeline.Processor;
namespace Timeline
{
public partial class TimelineChart : UserControl
{
#region public properties
public SolidBrush HoverClickSolidBrush { get; set; }
public Font RowFont { get; set; }
public Font DateFont { get; set; }
public Font TimeFont { get; set; }
#endregion
#region private properties
private ToolTip ToolTip { get; set; }
private VScrollBar VScrollBar1 { get; set; }
private int AvailableWidth { get; set; }
private Point OldMousePosition { get; set; }
private int ScrollPosition { get; set; }
private List<string> ToolTipTextList { get; set; }
private string ToolTipTextTitle { get; set; }
private List<BarModel> BarList { get; set; }
private DateTime StartDate { get; set; }
private int DistinctItemCount { get; set; }
private DateTime EndDate { get; set; }
#endregion
public TimelineChart()
{
InitializeComponent();
}
public void ShowBarChart(DateTime chartStartDate, DateTime chartEndDate, List<ItemModel> items)
{
this.StartDate = chartStartDate;
this.EndDate = chartEndDate;
var proc = new BarChartProcessor();
this.BarList = proc.GetBarList(items);
this.DistinctItemCount = items.Select(i => i.ItemName).Distinct().Count();
this.Refresh();
}
private void ChartMouseMove(Object sender, MouseEventArgs e)
{
var localMousePosition = new Point(e.X, e.Y);
if (BarList == null || BarList.Count == 0)
{
return;
}
if (localMousePosition == this.OldMousePosition)
{
return;
}
var proc = new BarChartProcessor();
var mouseOverObject = false;
var tempText = new List<string>();
var tempTitle = "";
Parallel.ForEach(this.BarList, bar =>
{
if (proc.MouseInsideBar(localMousePosition, bar) && bar.Visible)
{
bar.IsMouseOver = true;
tempTitle = bar.Name;
tempText.Add("Event Start: " + bar.StartValue.ToUniversalTime());
tempText.Add("Event End: " + bar.EndValue.ToUniversalTime());
mouseOverObject = true;
}
else
{
bar.IsMouseOver = false;
}
});
this.ToolTipTextList = tempText;
this.ToolTipTextTitle = tempTitle;
this.ToolTip.SetToolTip(this, this.ToolTipTextList.Count > 0 ? this.ToolTipTextList.ToString() : "");
if (mouseOverObject)
{
this.Refresh();
}
this.OldMousePosition = localMousePosition;
}
private void ChartMouseClick(Object sender, MouseEventArgs e)
{
if (BarList == null || BarList.Count == 0)
{
return;
}
var localMousePosition = new Point(e.X, e.Y);
var proc = new BarChartProcessor();
this.BarList = proc.MouseClickHandler(this.BarList, localMousePosition);
}
private void ChartMouseWheel(object sender, MouseEventArgs e)
{
this.VScrollBar1.Focus();
}
private void Timeline_Load(object sender, EventArgs e)
{
//initialize public properties
RowFont = TimeFont = DateFont = new Font("Segoe UI", 10, FontStyle.Regular, GraphicsUnit.Point);
HoverClickSolidBrush = new SolidBrush(Color.LightBlue);
BackColor = Color.White;
//initialize mouse controls
MouseMove += ChartMouseMove;
MouseWheel += ChartMouseWheel;
MouseClick += ChartMouseClick;
//initialize Tooltip
this.ToolTip = new ToolTip
{
OwnerDraw = true
};
this.ToolTip.Draw += ToolTipText_Draw;
this.ToolTip.Popup += ToolTipText_Popup;
//Flicker free drawing
SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
//ScrollBar
this.VScrollBar1 = new VScrollBar
{ Dock = DockStyle.Right,
Visible = false
};
Controls.Add(this.VScrollBar1);
this.VScrollBar1.Scroll += vScrollBar1_Scroll;
}
private void vScrollBar1_Scroll(object sender, ScrollEventArgs e)
{
this.ScrollPosition = this.VScrollBar1.Value;
this.Refresh();
}
private void ToolTipText_Draw(Object sender, DrawToolTipEventArgs e)
{
if (this.ToolTipTextList.Count == 0)
{
return;
}
e.Graphics.FillRectangle(Brushes.White, e.Bounds);
e.Graphics.DrawString(this.ToolTipTextTitle, ChartConstants.TitleFont, Brushes.Black, 5, 0);
// Draws the lines in the text box
foreach (var item in this.ToolTipTextList)
{
var stringY = (ChartConstants.ToolTipTitleHeight - ChartConstants.ToolTipfontHeight - e.Graphics.MeasureString(item, ChartConstants.RowFont).Height) / 2 +
10 + ((this.ToolTipTextList.IndexOf(item) + 1) * 14);
e.Graphics.DrawString(item, ChartConstants.RowFont, Brushes.Black, 5, stringY);
}
}
private void ToolTipText_Popup(Object sender, PopupEventArgs e)
{
var toolTipHeight = (ChartConstants.ToolTipTitleHeight + 4) + (this.ToolTipTextList.Count * (ChartConstants.ToolTipfontHeight + 3));
e.ToolTipSize = new Size(230, toolTipHeight);
}
private void PaintChart(Graphics graphics)
{
if (BarList == null || BarList.Count == 0)
{
return;
}
var proc = new BarChartProcessor();
var headerList = proc.GetFullHeaderList(this.StartDate, this.EndDate, this.Width, this.TimeFont);
if (headerList.Count == 0 || this.DistinctItemCount == 0)
{
return;
}
var pixelsPerSecond = proc.GetPixelsPerSecond(headerList);
this.AvailableWidth = Width - ChartConstants.BarStartLeft - ChartConstants.BarStartRight;
if (this.DistinctItemCount * (ChartConstants.BarHeight + ChartConstants.BarSpace) > Height)
{
this.VScrollBar1.Visible = true;
this.VScrollBar1.Maximum = this.DistinctItemCount - 3;
}
graphics.Clear(BackColor);
DrawChartHeadersAndNet(graphics, headerList);
DrawBars(graphics, this.BarList, pixelsPerSecond);
}
protected override void OnPaint(PaintEventArgs pe)
{
PaintChart(pe.Graphics);
}
private void DrawBars(Graphics graphics, IEnumerable<BarModel> barList, double pixelsPerSecond)
{
//list of machineNames to add to the left of each row
var rowTitleList = new List<string>();
var proc = new BarChartProcessor();
// Draws each bar
foreach (var bar in barList)
{
var numberOfBarsInControl = (Height - ChartConstants.BarStartTop)/(ChartConstants.BarHeight + ChartConstants.BarSpace);
if ((bar.RowIndex >= this.ScrollPosition &&
bar.RowIndex < numberOfBarsInControl + this.ScrollPosition))
{
var newBar = proc.GetBar(bar, this.StartDate, pixelsPerSecond, ScrollPosition, this.Width);
DrawBarAndRowText(newBar, rowTitleList, graphics);
}
else
{
bar.Visible = false;
}
}
}
private void DrawBarAndRowText(BarModel newBar, ICollection<string> rowTitleList, Graphics graphics)
{
var barBrush = new SolidBrush(newBar.Color);
if (newBar.IsMouseOver || newBar.IsClicked)
{
barBrush = HoverClickSolidBrush;
}
graphics.FillRectangle(barBrush, newBar.BarRectangle);
graphics.DrawRectangle(Pens.Black, newBar.BarRectangle);
// Draws the rowtext, only once for each machine
if (!rowTitleList.Contains(newBar.Name))
{
graphics.DrawString(newBar.Name,
RowFont,
Brushes.Black,
0,
ChartConstants.BarStartTop + (ChartConstants.BarHeight * (newBar.RowIndex - this.ScrollPosition)) +
(ChartConstants.BarSpace * (newBar.RowIndex - this.ScrollPosition)));
rowTitleList.Add(newBar.Name);
}
}
private void DrawChartHeadersAndNet(Graphics graphics, IList<HeaderModel> headerList)
{
var verticalLineLastY = ChartConstants.BarStartTop + (this.DistinctItemCount - this.ScrollPosition) * (ChartConstants.BarHeight + ChartConstants.BarSpace);
//draw headers
foreach (var header in headerList)
{
//draw the date when there is a change of day
var index = headerList.IndexOf(header);
if (headerList.IndexOf(header) == 0
|| header.HeaderDateTime.Day != headerList[index - 1].HeaderDateTime.Day)
{
graphics.DrawString(
header.HeaderDateTime.ToShortDateString(),
DateFont,
Brushes.Black,
header.StartLocation,
0);
}
graphics.DrawString(
header.HeaderDateTime.ToShortTimeString(),
TimeFont,
Brushes.Black,
header.StartLocation,
ChartConstants.HeaderTimeStartTop);
//draw vertical line under header
graphics.DrawLine(
ChartConstants.GridColor,
header.StartLocation,
ChartConstants.HeaderTimeStartTop,
header.StartLocation,
verticalLineLastY);
}
//draw last vertical line
graphics.DrawLine(
ChartConstants.GridColor,
ChartConstants.BarStartLeft + this.AvailableWidth,
ChartConstants.HeaderTimeStartTop,
ChartConstants.BarStartLeft + this.AvailableWidth,
verticalLineLastY);
//draw horizontal net
for (var index = 0; index < this.DistinctItemCount; index++)
{
var y = ChartConstants.BarStartTop + index * (ChartConstants.BarHeight + ChartConstants.BarSpace);
graphics.DrawLine(
ChartConstants.GridColor,
ChartConstants.BarStartLeft,
y,
ChartConstants.BarStartLeft + this.AvailableWidth,
y
);
}
}
}
}

120
ControlUse/Timeline/TimelineChart.resx

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

60
ControlUse/Timeline/Timelines.csproj

@ -1,60 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{FCAA62DB-0F2F-449C-8511-C6F0821688A7}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>Timelines</RootNamespace>
<AssemblyName>Timelines</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ChartConstants.cs" />
<Compile Include="Model\BarModel.cs" />
<Compile Include="Model\HeaderModel.cs" />
<Compile Include="Model\ItemModel.cs" />
<Compile Include="Processor\BarChartProcessor.cs" />
<Compile Include="Timeline.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Timeline.Designer.cs">
<DependentUpon>Timeline.cs</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Service Include="{94E38DFF-614B-4cbd-B67C-F211BB35CE8B}" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

10
SunlightCentralizedControlManagement(SCCM).sln

@ -5,7 +5,7 @@ VisualStudioVersion = 17.11.35312.102
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SunlightCentralizedControlManagement_SCCM_", "SunlightCentralizedControlManagement_SCCM_.csproj", "{2CFE8A79-C7DC-47AC-8D0C-2E03010E2458}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Timelines", "..\Timelines\Timelines.csproj", "{FCAA62DB-0F2F-449C-8511-C6F0821688A7}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nGantt", "..\nGantt\nGantt.csproj", "{CCC54F28-5D20-4AB3-A1A8-C62CD2DA3AE7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -17,10 +17,10 @@ Global
{2CFE8A79-C7DC-47AC-8D0C-2E03010E2458}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2CFE8A79-C7DC-47AC-8D0C-2E03010E2458}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2CFE8A79-C7DC-47AC-8D0C-2E03010E2458}.Release|Any CPU.Build.0 = Release|Any CPU
{FCAA62DB-0F2F-449C-8511-C6F0821688A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FCAA62DB-0F2F-449C-8511-C6F0821688A7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FCAA62DB-0F2F-449C-8511-C6F0821688A7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FCAA62DB-0F2F-449C-8511-C6F0821688A7}.Release|Any CPU.Build.0 = Release|Any CPU
{CCC54F28-5D20-4AB3-A1A8-C62CD2DA3AE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CCC54F28-5D20-4AB3-A1A8-C62CD2DA3AE7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CCC54F28-5D20-4AB3-A1A8-C62CD2DA3AE7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CCC54F28-5D20-4AB3-A1A8-C62CD2DA3AE7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

78
SunlightCentralizedControlManagement_SCCM_.csproj

@ -100,32 +100,6 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="ControlUse\Timeline\ChartConstants.cs" />
<Compile Include="ControlUse\Timeline\Model\BarModel.cs" />
<Compile Include="ControlUse\Timeline\Model\HeaderModel.cs" />
<Compile Include="ControlUse\Timeline\Model\ItemModel.cs" />
<Compile Include="ControlUse\Timeline\obj\Debug\.NETFramework,Version=v4.5.AssemblyAttributes.cs" />
<Compile Include="ControlUse\Timeline\obj\Debug\.NETFramework,Version=v4.7.2.AssemblyAttributes.cs" />
<Compile Include="ControlUse\Timeline\obj\Debug\.NETFramework,Version=v4.8.AssemblyAttributes.cs" />
<Compile Include="ControlUse\Timeline\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs" />
<Compile Include="ControlUse\Timeline\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs" />
<Compile Include="ControlUse\Timeline\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs" />
<Compile Include="ControlUse\Timeline\obj\Release\.NETFramework,Version=v4.7.2.AssemblyAttributes.cs" />
<Compile Include="ControlUse\Timeline\obj\x64\Debug\.NETFramework,Version=v4.7.2.AssemblyAttributes.cs" />
<Compile Include="ControlUse\Timeline\Processor\BarChartProcessor.cs" />
<Compile Include="ControlUse\Timeline\Properties\AssemblyInfo.cs" />
<Compile Include="ControlUse\Timeline\Timeline.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="ControlUse\Timeline\Timeline.Designer.cs">
<DependentUpon>Timeline.cs</DependentUpon>
</Compile>
<Compile Include="ControlUse\Timeline\TimelineChart.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="ControlUse\Timeline\TimelineChart.Designer.cs">
<DependentUpon>TimelineChart.cs</DependentUpon>
</Compile>
<Compile Include="ConvertMoels\BoolRBConvert.cs" />
<Compile Include="UserClass\AsyncTcpClient.cs" />
<Compile Include="UserClass\ClsLock.cs" />
@ -303,12 +277,6 @@
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="ControlUse\Timeline\obj\Debug\Timeline.TimelineChart.resources" />
<EmbeddedResource Include="ControlUse\Timeline\obj\Release\Timeline.TimelineChart.resources" />
<EmbeddedResource Include="ControlUse\Timeline\obj\x64\Debug\Timeline.TimelineChart.resources" />
<EmbeddedResource Include="ControlUse\Timeline\TimelineChart.resx">
<DependentUpon>TimelineChart.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.en-US.resx" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
@ -317,24 +285,6 @@
<EmbeddedResource Include="Properties\Resources.zh-CN.resx" />
<EmbeddedResource Include="Properties\Resources.zh-TW.resx" />
<Resource Include="Fonts\FontAwesome.otf" />
<None Include="ControlUse\Timeline\obj\Debug\DesignTimeResolveAssemblyReferences.cache" />
<None Include="ControlUse\Timeline\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache" />
<None Include="ControlUse\Timeline\obj\Debug\Timeline.csproj.AssemblyReference.cache" />
<None Include="ControlUse\Timeline\obj\Debug\Timeline.csproj.CoreCompileInputs.cache" />
<None Include="ControlUse\Timeline\obj\Debug\Timeline.csproj.GenerateResource.cache" />
<None Include="ControlUse\Timeline\obj\Debug\Timeline.csprojResolveAssemblyReference.cache" />
<None Include="ControlUse\Timeline\obj\Debug\Timelines.csproj.AssemblyReference.cache" />
<None Include="ControlUse\Timeline\obj\Debug\Timelines.csproj.CoreCompileInputs.cache" />
<None Include="ControlUse\Timeline\obj\Debug\Timelines.csproj.GenerateResource.cache" />
<None Include="ControlUse\Timeline\obj\Release\DesignTimeResolveAssemblyReferencesInput.cache" />
<None Include="ControlUse\Timeline\obj\Release\Timelines.csproj.AssemblyReference.cache" />
<None Include="ControlUse\Timeline\obj\Release\Timelines.csproj.CoreCompileInputs.cache" />
<None Include="ControlUse\Timeline\obj\Release\Timelines.csproj.GenerateResource.cache" />
<None Include="ControlUse\Timeline\obj\x64\Debug\DesignTimeResolveAssemblyReferencesInput.cache" />
<None Include="ControlUse\Timeline\obj\x64\Debug\Timelines.csproj.AssemblyReference.cache" />
<None Include="ControlUse\Timeline\obj\x64\Debug\Timelines.csproj.CoreCompileInputs.cache" />
<None Include="ControlUse\Timeline\obj\x64\Debug\Timelines.csproj.GenerateResource.cache" />
<None Include="ControlUse\Timeline\Timelines.csproj" />
<None Include="Fonts\font-awesome-4.7.0.zip" />
<None Include="Fonts\font-awesome-4.7.0\fonts\fontawesome-webfont.eot" />
<Resource Include="Fonts\font-awesome-4.7.0\fonts\fontawesome-webfont.ttf" />
@ -416,29 +366,9 @@
</PackageReference>
</ItemGroup>
<ItemGroup>
<Folder Include="ControlUse\Timeline\bin\x64\Release\" />
<Folder Include="ControlUse\Timeline\obj\Debug\TempPE\" />
<Folder Include="ControlUse\Timeline\obj\Release\TempPE\" />
<Folder Include="ControlUse\Timeline\obj\x64\Debug\TempPE\" />
<Folder Include="ControlUse\" />
</ItemGroup>
<ItemGroup>
<Content Include="ControlUse\Timeline\bin\Debug\Timelines.dll" />
<Content Include="ControlUse\Timeline\bin\Debug\Timelines.pdb" />
<Content Include="ControlUse\Timeline\bin\Release\Timeline.dll" />
<Content Include="ControlUse\Timeline\bin\Release\Timeline.pdb" />
<Content Include="ControlUse\Timeline\bin\x64\Debug\Timeline.dll" />
<Content Include="ControlUse\Timeline\bin\x64\Debug\Timeline.pdb" />
<Resource Include="ControlUse\Timeline\obj\Debug\Timeline.csproj.FileListAbsolute.txt" />
<Resource Include="ControlUse\Timeline\obj\Debug\Timelines.csproj.FileListAbsolute.txt" />
<Content Include="ControlUse\Timeline\obj\Debug\Timelines.dll" />
<Content Include="ControlUse\Timeline\obj\Debug\Timelines.pdb" />
<Content Include="ControlUse\Timeline\obj\Release\Timeline.dll" />
<Content Include="ControlUse\Timeline\obj\Release\Timeline.pdb" />
<Resource Include="ControlUse\Timeline\obj\Release\Timelines.csproj.FileListAbsolute.txt" />
<Content Include="ControlUse\Timeline\obj\x64\Debug\Timeline.dll" />
<Content Include="ControlUse\Timeline\obj\x64\Debug\Timeline.pdb" />
<Resource Include="ControlUse\Timeline\obj\x64\Debug\Timelines.csproj.FileListAbsolute.txt" />
<Content Include="ControlUse\Timeline\Timelines.csproj.user" />
<Content Include="Fonts\font-awesome-4.7.0\css\font-awesome.css" />
<Content Include="Fonts\font-awesome-4.7.0\css\font-awesome.min.css" />
<Content Include="Fonts\font-awesome-4.7.0\fonts\fontawesome-webfont.svg" />
@ -477,12 +407,6 @@
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Timelines\Timelines.csproj">
<Project>{fcaa62db-0f2f-449c-8511-c6f0821688a7}</Project>
<Name>Timelines</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="AfterResolveReferences">
<ItemGroup>

5
View/ProductionPlanningView.xaml

@ -10,7 +10,7 @@
xmlns:lvc="clr-namespace:LiveChartsCore.SkiaSharpView.WPF;assembly=LiveChartsCore.SkiaSharpView.WPF"
xmlns:viewmodel="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ViewModel"
xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
xmlns:UserTimeline="clr-namespace:Timelines;assembly=Timelines"
xmlns:wfi ="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
d:DataContext="{d:DesignInstance Type=viewmodel:ProductionPlanningModel}"
mc:Ignorable="d" Loaded="UserControl_Loaded"
@ -25,8 +25,7 @@
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<!-- <lvc:CartesianChart x:Name="ch" XAxes="{Binding XAxes}" YAxes="{Binding YAxes}" Series="{Binding Series}" />-->
<wfi:WindowsFormsHost>
<UserTimeline:Timeline x:Name="qwe"/>
<wfi:WindowsFormsHost >
</wfi:WindowsFormsHost>
</Grid>
<StackPanel x:Name="scr" Grid.Row="1" Height="60" Background="#FF00204E" Orientation="Horizontal">

35
View/ProductionPlanningView.xaml.cs

@ -33,8 +33,7 @@ using static System.Windows.Forms.VisualStyles.VisualStyleElement;
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
using LiveChartsCore.SkiaSharpView.WPF;
using System.Data.Entity.Core.Common.CommandTrees.ExpressionBuilder;
using Timelines.Model;
using Timelines;
namespace SunlightCentralizedControlManagement_SCCM_.View
{
@ -55,38 +54,16 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
private void UserControl_Loaded(object sender, RoutedEventArgs e)//打开页面时的操作
{
List<string> qw = MainWindowViewModel.Machines.AsEnumerable().Select(row => row.Field<string>("name")).ToList();//转换列名为机台
int asd = qw.Count();
var randomVar = new Random();
var testList = new List<ItemModel>();
var startDate = new DateTime(2024, 12, 30, 10, 9, 0);
var endDate = new DateTime(2024, 12, 30, 22, 29, 0);
for (var i = 0; i < 10; i++)
{
for (var d = startDate; d < endDate; d = d.AddSeconds(randomVar.Next(13000, 14000)))
{
var item1 = new ItemModel
{
ItemName = "Item" + "" + i,
Duration = TimeSpan.FromSeconds(randomVar.Next(8, 15000)),
StartDate = d,
ItemColor = System.Drawing.Color.PowderBlue
};
testList.Add(item1);
}
}
qwe.ShowBarChart(startDate,endDate,testList);
// var dfg = new TimelineChart();
// qwe.Child = dfg.ShowBarChart(startDate, endDate, testList);
// timeline1.ShowBarChart(startDate, endDate, testList);
}
private void ListViewItem_Quit(object sender, System.Windows.Input.MouseButtonEventArgs e)//退出事件
{
}
private void ListViewItem_edit(object sender, System.Windows.Input.MouseButtonEventArgs e)//编辑事件

2
ViewModel/MainWindowViewModel.cs

@ -191,7 +191,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
}
public static TcpClient[] MachiensTcpClient = new TcpClient[999];
public DataRow[] machinesdata = new DataRow[999];
public static DataRow[] machinesdata = new DataRow[999];
public int Machinesdata_Count;
public void TcpClientNEW()
{

13
ViewModel/ProductionPlanningModel.cs

@ -37,8 +37,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
{
public partial class ProductionPlanningModel : ObservableObject//ViewModelBase
{
//x轴时间格式
/* public Axis[] XAxes { get; set; } =
//x轴时间格式
public Axis[] XAxes { get; set; } =
{
new DateTimeAxis(TimeSpan.FromSeconds(5) , date => date.ToString("yyyy-MM-dd HH:mm"))
{
@ -46,8 +46,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
CrosshairLabelsPaint = new SolidColorPaint(SKColors.DarkSlateBlue, 1),
CrosshairPaint = new SolidColorPaint(SKColors.DarkSlateGray, 1),
},
};
};
public Axis[] YAxes { get; set; } =
{
new Axis
@ -55,8 +54,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
MinLimit = 0,
// TextSize = 20,
LabelsDensity = 1,
Labels = MainWindowViewModel.Machines.AsEnumerable().Select(row=> row.Field<string>("name")).ToList(),//转换列名为机台
Labels = MainWindowViewModel.Machines.AsEnumerable().Select(row=> row.Field<string>("name")).ToList(),//转换列名为机台
}
};
@ -91,7 +90,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
};
}
public ISeries[] Series { get; set; } */
public ISeries[] Series { get; set; }
}
}

Loading…
Cancel
Save