private async Task ExecuteRefreshCommand()
        {
            try
            {
                SimpleCommandViewModel sc = SelectedContent;
                var scmds = await _warehouse.DBService.GetSimpleCommands(null, SimpleCommand.EnumStatus.Finished, DateFrom.TimeStamp, DateTo.TimeStamp);

                SimpleCommandList.Clear();
                foreach (var s in scmds)
                {
                    if (s is SimpleCraneCommand)
                    {
                        SimpleCommandList.Add((SimpleCommandViewModel) new SimpleCommandCraneViewModel {
                            Command = s
                        });
                    }
                    else if (s is SimpleSegmentCommand)
                    {
                        SimpleCommandList.Add((SimpleCommandViewModel) new SimpleCommandSegmentViewModel {
                            Command = s
                        });
                    }
                    else
                    {
                        SimpleCommandList.Add((SimpleCommandViewModel) new SimpleCommandConveyorViewModel {
                            Command = s
                        });
                    }
                }

                foreach (SimpleCommandViewModel scvm in SimpleCommandList)
                {
                    scvm.Initialize(_warehouse);
                }
                Records = SimpleCommandList.Count();
                if (sc != null)
                {
                    SelectedContent = SimpleCommandList.FirstOrDefault(p => p.ID == sc.ID);
                }
            }
            catch (Exception e)
            {
                _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception,
                                    string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message));
            }
        }
Ejemplo n.º 2
0
        public async Task ExecuteRefreshSimpleCommands(IList items)
        {
            try
            {
                NumberOfSelectedItems = items == null ? 0 : items.Count;

                SimpleCommandList.Clear();
                if (SelectedContent != null)
                {
                    List <SimpleCommand> l = await _warehouse.DBService.GetSimpleCommands(SelectedContent.Command.ID, SimpleCommand.EnumStatus.Finished, null, null);

                    foreach (var cmd in l)
                    {
                        if (cmd is SimpleCraneCommand)
                        {
                            SimpleCommandList.Add((SimpleCommandViewModel) new SimpleCommandCraneViewModel {
                                Command = cmd
                            });
                        }
                        else if (cmd is SimpleSegmentCommand)
                        {
                            SimpleCommandList.Add((SimpleCommandViewModel) new SimpleCommandSegmentViewModel {
                                Command = cmd
                            });
                        }
                        else
                        {
                            SimpleCommandList.Add((SimpleCommandViewModel) new SimpleCommandConveyorViewModel {
                                Command = cmd
                            });
                        }
                    }
                }
            }
            catch (Exception e)
            {
                _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception,
                                    string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message));
            }
        }