Пример #1
0
 public void FillResolutionListWithDefaultResolutions()
 {
     ResolutionList.Add("10 x 10");
     ResolutionList.Add("16 x 16");
     ResolutionList.Add("20 x 20");
     ResolutionList.Add("24 x 24");
     ResolutionList.Add("50 x 50");
     IsDrawingGrid = true;
     ChangeGrid("20 x 20");
 }
Пример #2
0
 public bool AddAndSelectResolution()
 {
     if (NewGridWidth <= 0 || NewGridHeight <= 0)
     {
         return(true);
     }
     SelectedResolution = NewGridWidth + " x " + NewGridHeight;
     if (ResolutionList.Contains(NewGridWidth + " x " + NewGridHeight))
     {
         return(false);
     }
     RemoveOldestResolutionIfMoreThenTen();
     ResolutionList.Add(NewGridWidth + " x " + NewGridHeight);
     return(false);
 }
Пример #3
0
        internal static ResolutionList ParseRecognizer(this List <ModelResult> value)
        {
            var result = new ResolutionList();

            foreach (var modelResult in value)
            {
                var resolution = modelResult.Resolution;
                if (resolution["values"] is List <Dictionary <string, string> > resolutionValues)
                {
                    foreach (Dictionary <string, string> possibleTime in resolutionValues)
                    {
                        if (possibleTime.ContainsKey("type") && possibleTime["type"] == "time")
                        {
                            result.Add(new Resolution()
                            {
                                ResolutionType = Resolution.ResolutionTypes.Time, Time1 = TimeSpan.Parse(possibleTime["value"])
                            });
                        }
                        else if (possibleTime.ContainsKey("type") && possibleTime["type"] == "datetime")
                        {
                            var date1 = DateTime.Parse(possibleTime["value"]);
                            if (date1 > DateTime.Now)
                            {
                                result.Add(new Resolution()
                                {
                                    ResolutionType = Resolution.ResolutionTypes.DateTime, Date1 = date1
                                });
                            }
                        }
                        else if (possibleTime.ContainsKey("type") && possibleTime["type"] == "date")
                        {
                            var date1 = DateTime.Parse(possibleTime["value"]);
                            if (date1 > DateTime.Now)
                            {
                                result.Add(new Resolution()
                                {
                                    ResolutionType = Resolution.ResolutionTypes.DateTime, Date1 = date1
                                });
                            }
                        }
                        else if (possibleTime.ContainsKey("type") && possibleTime["type"] == "datetimerange")
                        {
                            var date1 = DateTime.Parse(possibleTime["start"]);
                            var date2 = DateTime.Parse(possibleTime["end"]);

                            if (date1 > DateTime.Now && date2 > DateTime.Now)
                            {
                                result.Add(new Resolution()
                                {
                                    ResolutionType = Resolution.ResolutionTypes.DateTimeRange, Date1 = DateTime.Parse(possibleTime["start"]), Date2 = DateTime.Parse(possibleTime["end"])
                                });
                            }
                        }
                        else if (possibleTime.ContainsKey("type") && possibleTime["type"] == "timerange")
                        {
                            result.Add(new Resolution()
                            {
                                ResolutionType = Resolution.ResolutionTypes.TimeRange, Time1 = TimeSpan.Parse(possibleTime["start"]), Time2 = TimeSpan.Parse(possibleTime["end"])
                            });
                        }
                        else
                        {
                        }
                    }
                }
            }

            return(result);
        }