public LoginViewModel(IDialogService ids, ISalesDatabase isd, ISalesLineDatabase isld, ICustomerDatabase icd, IItemDatabase iid) { this.dialog = ids; salesDb = isd; salesLineDb = isld; customerDb = icd; itemDb = iid; }
public static IEnumerable <LogRowKey> FindClosestTriggerKeys(this IItemDatabase db, long sourceUniqueId, long sourceCycleIndex, IEnumerable <string> triggerIds) { var triggerWithUniqueIds = triggerIds.Select(p => new { ItemId = p, UniqueIds = db.GetLogRowUniqueID(p) }); foreach (var triggerWithUniqueId in triggerWithUniqueIds) { yield return(db.FindClosestRowKey(sourceUniqueId, sourceCycleIndex, triggerWithUniqueId.ItemId, triggerWithUniqueId.UniqueIds)); } }
public void Initialize(IItemDatabase database) { m_Database = database; m_Sorter = new ListViewColumnSorter(new NumericSorter()); m_Sorter.SortColumn = 1; m_Sorter.Order = SortOrder.Descending; UpdateList(); }
/// <summary> /// Get the time from the build start time until bottom temperature reached 100 degrees /// </summary> /// <param name="db"></param> /// <param name="startTime"></param> /// <param name="endTime">Time when build is stopped</param> /// <returns></returns> public static TimeSpan?GetTotalBuildTime(IItemDatabase db, DateTime startTime, DateTime endTime) { LogRowDataPoint dataPoint = db.GetFirstItemDP("OPC.Temperature.BottomTemperature", p => (p.TimeStamp >= endTime && p.Value <= 110d)); if (dataPoint == null) { dataPoint = db.GetLastItemDP("OPC.Temperature.BottomTemperature"); } return(dataPoint.TimeStamp - startTime); }
private static Change ParseChange(IItemDatabase database, LogRowKey key, int depth, int maxDepth) { if (depth == maxDepth) { return(null); } (IEnumerable <LogRowKey>, ExpressionParser.ParseResult)triggers = ParseExpression(database, key); return(new Change(key, triggers.Item2, triggers.Item1.Where(p => p != null).Select(p => ParseChange(database, p, depth + 1, maxDepth)))); }
/// <summary> /// Get the time from the build starts to the heating ends /// </summary> /// <param name="db"></param> /// <param name="startTime">Time when build is started</param> /// <returns></returns> public static TimeSpan?GetHeatTime(IItemDatabase db, DateTime startTime) { LogRowDataPoint dataPoint = db.GetAllDP("Process.ProcessManager.HeatStartPlateDone").FirstOrDefault(p => (p.TimeStamp >= startTime && p.Value > 0.5)); if (dataPoint == null) { return(null); } return(dataPoint.TimeStamp - startTime); }
/// <summary> /// Get the time from the build end time until bottom temperature reached 100 degrees /// </summary> /// <param name="db"></param> /// <param name="endTime">Time when build is stopped</param> /// <returns></returns> public static TimeSpan?GetCoolingDownTime(IItemDatabase db, DateTime endTime) { LogRowDataPoint dataPoint = db.GetAllDP("OPC.Temperature.BottomTemperature").FirstOrDefault(p => (p.TimeStamp >= endTime && p.Value <= 110d)); if (dataPoint == null) { return(null); } return(dataPoint.TimeStamp - endTime); }
public SalesAddItemViewModel(IDialogService ids, IItemDatabase iid) { dialog = ids; itemDb = iid; loadItemCatalogue(); IsTextboxesEnabled = false; IsDiscPercent = false; IsDiscAmount = false; RaisePropertyChanged(() => IsTextboxesEnabled); RaisePropertyChanged(() => IsDiscAmount); RaisePropertyChanged(() => IsDiscPercent); }
public ShipmentViewModel(IDialogService ids, ISalesDatabase isd, ICustomerDatabase icd, ISalesLineDatabase isld, IItemDatabase iid) { dialog = ids; salesDb = isd; customerDb = icd; salesLineDb = isld; itemDb = iid; //Load sales list Task.Run(async() => { SalesList = await salesDb.GetAllSales(); RaisePropertyChanged(() => SalesList); LoadAutoCompleteList(); }); }
public ItemFactory( GUIDManager guidManager, IItemDatabase itemDatabase, ILiveItemHandler itemHandler, IObjectIconHandler objectIconHandler, IDerivedValueHandler derivedValueHandler, GameObjectPool <JoyObjectNode> itemPool, RNG roller = null) { this.GuidManager = guidManager; this.ItemDatabase = itemDatabase; this.ItemHandler = itemHandler; this.ObjectIcons = objectIconHandler; this.DerivedValueHandler = derivedValueHandler; this.ItemPool = itemPool; this.Roller = roller is null ? new RNG() : roller; }
public ItemInformationForm(IItemDatabase database, string itemID) { m_Database = database; m_ItemID = itemID; InitializeComponent(); m_Database.GetItemRange(m_ItemID, out DateTime from, out DateTime to); m_FromTime.Text = $"{from:d} {from:T}"; //must be careful about truncating to = to.AddSeconds(1); m_ToTime.Text = $"{to:d} {to:T}"; m_FromLabel.Text = "From:"; // string.Format("From: ({0:g})", from); m_ToLabel.Text = "To:"; // string.Format("To: ({0:g})", to); }
/// <summary> /// Get start time of build. /// </summary> /// <param name="database"></param> /// <returns></returns> /// <remarks> /// Returns the first occurance of one of the following: /// 1. Play is pressed /// 2. ProcessManagerState is Running /// 3. InternalProcessManagerState is Running /// 4. Temperature has a logged value above 600 deg. /// </remarks> public static DateTime GetBuildStart(IItemDatabase database) { LogRowData startProcess = database.GetFirstItem("Process.ProcessManager.StartProcess", x => x.Value == "True"); LogRowData processmanagerState = database.GetFirstItem("Process.ProcessManager.ProcessManagerState", x => x.Value == "Running"); LogRowData internalProcessmanagerState = database.GetFirstItem("Process.ProcessManager.InternalProcessManagerState", x => x.Value == "Running"); if (startProcess == null && processmanagerState == null && internalProcessmanagerState == null) { throw new ApplicationException("Start of process not found."); } List <LogRowData> data = new List <LogRowData>() { startProcess, processmanagerState, internalProcessmanagerState }; DateTime result = data.Where(t => t != null).Min(p => p.TimeStamp); return(result); }
public static LogRowKey FindClosestRowKey(this IItemDatabase db, long sourceUniqueId, long sourceCycleIndex, string itemId, long[] uniqueIds) { for (int i = uniqueIds.Length - 1; i >= 0; i--) { if (uniqueIds[i] >= sourceUniqueId) { continue; } LogRowData row = db.GetItemRow(itemId, uniqueIds[i]); if (row.CycleIndex == sourceCycleIndex && row.HasExpression()) { continue; } return(new LogRowKey(uniqueIds[i], db.GetItemRow(itemId, uniqueIds[i]))); } return(null); }
public CycleViewer(IItemDatabase database, long uniqueID, IDictionary <string, Color> colorMap) { InitializeComponent(); m_Database = database; m_ColorMap = colorMap; m_List.VirtualListSize = m_Database.Count; int index = database.GetRowIndex(uniqueID); if (index >= 0) { var item = m_List.Items[index]; m_List.TopItem = item; m_List.FocusedItem = item; m_List.EnsureVisible(index); } m_StartTime = ((LogRowData)m_List.TopItem.Tag).OaTimeStamp; }
/// <summary> /// Get the time from the first layer until Internal Process State not running /// </summary> /// <param name="db"></param> /// <param name="startTime"></param> /// <param name="endTime"></param> /// <returns></returns> public static TimeSpan?GetMeltTime(IItemDatabase db, DateTime startTime, DateTime endTime) { LogRowDataPoint processStopped = db.GetLastItemDP("Process.ProcessManager.InternalProcessStop", p => p.TimeStamp > startTime && p.Value >= 0.5); if (processStopped == null) { return(null); } LogRowDataPoint firstLayer = db.GetFirstItemDP("Beam.LayerThickness", p => p.TimeStamp >= startTime && p.TimeStamp <= endTime && p.Value > 0); if (firstLayer == null) { return(null); } //throw new ApplicationException("Did not find the time of the first layer in the log file."); return(processStopped.TimeStamp - firstLayer.TimeStamp); }
public SalesUpdateAddItemViewModel(IDialogService ids, IItemDatabase iid) { dialog = ids; itemDb = iid; if (GlobalVars.selectedSalesItem == null) { loadItemCatalogue(); IsTextboxesEnabled = false; IsDiscPercent = false; IsDiscAmount = false; RaisePropertyChanged(() => IsTextboxesEnabled); RaisePropertyChanged(() => IsDiscAmount); RaisePropertyChanged(() => IsDiscPercent); } else { Task.Run(async() => { var itemDetail = await itemDb.GetItemDetail(GlobalVars.selectedSalesItem.ItemId); ItemCatalogue = new ObservableCollection <SalesItemSelection>(); var itemTemp = new SalesItemSelection(GlobalVars.selectedSalesItem.ItemId, GlobalVars.selectedSalesItem.ItemName, GlobalVars.selectedSalesItem.ActualPrice, GlobalVars.selectedSalesItem.UnitMeasurement, itemDetail.Barcode); ItemCatalogue.Add(itemTemp); SelectedItem = itemTemp; Quantity = GlobalVars.selectedSalesItem.Quantity; DiscAmount = GlobalVars.selectedSalesItem.DiscountAmount.ToString(); DiscPercent = GlobalVars.selectedSalesItem.DiscountPercentage.ToString(); IsTextboxesEnabled = true; IsDiscAmount = true; RaisePropertyChanged(() => Quantity); RaisePropertyChanged(() => DiscAmount); RaisePropertyChanged(() => DiscPercent); RaisePropertyChanged(() => IsDiscAmount); RaisePropertyChanged(() => IsTextboxesEnabled); refreshTotal(); }); } }
/// <summary> /// Get the end time of the build. /// </summary> /// <param name="db"></param> /// <param name="buildEnd"></param> /// <param name="completed"></param> /// <remarks> /// Will return the timestamp of the following in prioritized order: /// 1. Build is done, completed is set to true /// 2. Build is crashed. /// 3. Time of the last action in the log file. /// 4. Time of the last task. /// </remarks> public static void GetBuildEnd(IItemDatabase db, out DateTime buildEnd, out bool completed) { LogRowDataPoint buildDone = db.GetLastItemDP("Process.ProcessManager.BuildDone", x => x.Value == 1); LogRowDataPoint buildCrashed = db.GetLastItemDP("Process.ProcessManager.BuildCrashed", x => x.Value == 1); LogRowDataPoint stopProcess = db.GetLastItemDP("Process.ProcessManager.StopProcess", x => x.Value == 1); LogRowDataPoint lastTask = db.GetLastItemDP("Process.ProcessManager.Task"); LogRowDataPoint lastMeltAction = db.GetLastItemDP("Process.ProcessManager.Action"); completed = false; if (buildDone != null && buildDone.Value == 1) { buildEnd = buildDone.TimeStamp; completed = true; } else if (buildCrashed != null && buildCrashed.Value == 1) { buildEnd = buildCrashed.TimeStamp; } else if (lastMeltAction != null) { buildEnd = lastMeltAction.TimeStamp; } else if (stopProcess != null) { buildEnd = stopProcess.TimeStamp; } else if (lastTask != null) { buildEnd = lastTask.TimeStamp; } else { throw new ApplicationException("End of build not found."); } }
public static Change CreateFrom(IItemDatabase database, LogRowKey key, int maxDepth) { Change result = ParseChange(database, key, 0, maxDepth); return(result); }
public BeamCurrentCompensationForm(IItemDatabase database) { InitializeComponent(); m_Database = database; InitializeBeamCurrentCompensation(); }
public FullnameEnumerator(string openArrayFullname, IItemDatabase database) { m_OpenArrayFullname = openArrayFullname; Database = database; }
private static (IEnumerable <LogRowKey>, ExpressionParser.ParseResult) ParseExpression(IItemDatabase database, LogRowKey source) { ExpressionParser.ParseResult parseResult = ExpressionParser.ParseExpression(source.Data.User); if (parseResult != null) { IEnumerable <string> triggerItems = ExpressionParser.FindItems(parseResult, database.Exists).Distinct(); return(database.FindClosestTriggerKeys(source.UniqueId, source.Data.CycleIndex, triggerItems), parseResult); } return(new LogRowKey[0], parseResult); }
public DialogResult ShowDialog(IItemDatabase database, string[] selectedItems) { m_Tree.ItemDatabase = database; return(ShowDialog()); }
public void Dispose() { Database = null; Clear(); }