public static Common.Data.Models.SourceDto GetDtoSourceFromMcSource(McSource McSource)
 {
     return(new Common.Data.Models.SourceDto
     {
         Id = McSource.SourceId,
         Name = McSource.Name,
         HexColor = McSource.Color.ToString(),
         DefaultWidth = McSource.DefaultWidth,
         DefaultHeight = McSource.DefaultHeight
     });
 }
        public static ObservableCollection <McSourceInstance> GetMcSourceInstanceListFromMcSourceListAndDtoSourceInstanceList(IEnumerable <McSource> McSourceList, IEnumerable <Common.Data.Models.SourceInstanceDto> dtoSourceInstanceList)
        {
            ObservableCollection <McSourceInstance> McSourceInstanceList = new ObservableCollection <McSourceInstance>();

            foreach (var dtoSourceInstance in dtoSourceInstanceList)
            {
                McSource appropriateSource = McSourceList.FirstOrDefault(s => s.SourceId == dtoSourceInstance.SourceId);
                if (appropriateSource == null)
                {
                    continue;
                }
                McSourceInstanceList.Add(GetMcSourceInstanceFromMcSourceAndDtoSourceInstance(appropriateSource, dtoSourceInstance));
            }

            return(McSourceInstanceList);
        }
 public static McSourceInstance GetMcSourceInstanceFromMcSourceAndDtoSourceInstance(McSource appropriateSource, Common.Data.Models.SourceInstanceDto dtoSourceInstance)
 {
     return(new McSourceInstance(appropriateSource, dtoSourceInstance.WallId, dtoSourceInstance.X, dtoSourceInstance.Y, dtoSourceInstance.Width, dtoSourceInstance.Height, dtoSourceInstance.Id));
 }
Exemple #4
0
        public async Task <int> AddSource(McSource source)
        {
            int id = await HubProxy.Invoke <int>("AddSource", SourceMapper.GetDtoSourceFromMcSource(source));

            return(id);
        }