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));
            }
        }
Beispiel #2
0
        private void ExecuteSegmentCommand()
        {
            try
            {
                IsEnabledField   = true;
                IsEnabledCC      = true;
                _selectedCommand = CommandType.Add;
                _manageContent   = new SimpleCommandSegmentViewModel {
                    Command = new SimpleSegmentCommand()
                };
                _manageContent.Initialize(_warehouse);

                DetailedContent      = _manageContent;
                DetailedContent.Task = EnumSimpleCommandTask.Info;
                DetailedContent.ValidationEnabled = true;
            }
            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));
            }
        }