using AxiomCore2.Client; using AxiomCore2.ControlProperties; using AxiomCore2.Controls; using AxiomCore2.Data; using AxiomCore2.Events; using AxiomCore2.Legacy; using AxiomCore2.Log; using AxiomCore2.Managers; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Collections; using System.Drawing; //using CanaryWebServiceHelper; //using CanaryWebServiceHelper.HistorianWebService; namespace AxiomScript { public partial class ScreenScript : IDisposable { // NOTE: click help icon in dialog header for API documentation and examples. // NOTE: use EventTimer class when timer is necessary. See API documentation. // axiom references public ControlApplication Application { get; } = ControlApplication.Instance; public ControlFactoryManager ControlFactory { get; } = ControlFactoryManager.Instance; public IDataProvider DataProvider { get; } = DataProviderManager.CreateInstance(); public ILog Log { get; } = ClientLog.UserScript; public NavigationManager Navigation { get; } = NavigationManager.Instance; public ControlScreen Screen => _screen; public void OnScreenVisible() { //Default Date Time Picker value to today (so stop starts are for today by default) DTP_StopCharts.DateTime=System.DateTime.Today; //Change By Day start date based on what day of the week it is if (System.DateTime.Today.DayOfWeek.ToString() =="Monday") ByDay.TimeStart=(System.DateTime.Today.AddDays(-0).ToString()); if (System.DateTime.Today.DayOfWeek.ToString() =="Tuesday") ByDay.TimeStart=(System.DateTime.Today.AddDays(-1).ToString()); if (System.DateTime.Today.DayOfWeek.ToString() =="Wednesday") ByDay.TimeStart=(System.DateTime.Today.AddDays(-2).ToString()); if (System.DateTime.Today.DayOfWeek.ToString() =="Thursday") ByDay.TimeStart=(System.DateTime.Today.AddDays(-3).ToString()); if (System.DateTime.Today.DayOfWeek.ToString() =="Friday") ByDay.TimeStart=(System.DateTime.Today.AddDays(-4).ToString()); if (System.DateTime.Today.DayOfWeek.ToString() =="Saturday") ByDay.TimeStart=(System.DateTime.Today.AddDays(-5).ToString()); if (System.DateTime.Today.DayOfWeek.ToString() =="Sunday") ByDay.TimeStart=(System.DateTime.Today.AddDays(-6).ToString()); //Change By Week start date based on current date //if (System.DateTime.Today>System.DateTime.Today.AddDays(-1)) TestLabel.Text="Worked"; } public void OnScreenInvisible() { } public void Dispose() { } public void DTP_StopCharts_OnDateTimeChange(object sender, DateTime dateTime) { //Update Start Date of stop charts based on date time picker value //Had to use ".Date" otherwise it was returning UTC time (e.g. 4 AM during Daylight Savings instead of 12 AM) ByMachine.TimeStart=DTP_StopCharts.DateTime.Date.ToString(); Calendar.TimeStart=DTP_StopCharts.DateTime.Date.ToString(); Card.TimeStart=DTP_StopCharts.DateTime.Date.ToString(); CardHopper.TimeStart=DTP_StopCharts.DateTime.Date.ToString(); CrossLapper.TimeStart=DTP_StopCharts.DateTime.Date.ToString(); Inspection.TimeStart=DTP_StopCharts.DateTime.Date.ToString(); Loom1.TimeStart=DTP_StopCharts.DateTime.Date.ToString(); Loom2.TimeStart=DTP_StopCharts.DateTime.Date.ToString(); Loom3.TimeStart=DTP_StopCharts.DateTime.Date.ToString(); ScrimFeed.TimeStart=DTP_StopCharts.DateTime.Date.ToString(); WebDrafter.TimeStart=DTP_StopCharts.DateTime.Date.ToString(); Winder.TimeStart=DTP_StopCharts.DateTime.Date.ToString(); } public void TestButton_OnClick(object sender, EventArgs eventArgs) { TestLabel.Text=System.DateTime.Today.DayOfWeek.ToString(); } } }