Beispiel #1
0
        protected void DoRun()
        {
            Preconditions.CheckArgumentRange(NumFolds >= 2 && NumFolds < Dataset.Count);
            Preconditions.CheckArgument(Models.Any());
            Preconditions.CheckNotNull(Dataset);

            DoBegin();

            if (IsStratified)
            {
                Dataset.GroupLabels(IsShuffle, ShuffleRandom);
            }
            else if (IsShuffle)
            {
                Dataset.Shuffle(ShuffleRandom);
            }

            if (PerfData == null)
            {
                PerfData = new PerfData <LblT>();
            }
            else
            {
                Preconditions.CheckArgument(PerfData.GetDataKeys().All(t => t.Item1 != ExpName),
                                            "PerfData object already contains data for '{0}' experiment", ExpName);
            }
            mFoldModelTimes.Clear();
            for (int i = 0; i < NumFolds; i++)
            {
                DoRunFold(i + 1);
            }

            DoFinish();
        }
Beispiel #2
0
        SdfFile(XmlNode node)
        {
            List <Model> models = new List <Model>();
            List <World> worlds = new List <World>();
            List <Light> lights = new List <Light>();

            Models = models.AsReadOnly();
            Lights = lights.AsReadOnly();
            Worlds = worlds.AsReadOnly();

            foreach (XmlNode child in node.ChildNodes)
            {
                switch (child.Name)
                {
                case "world":
                    worlds.Add(new World(child));
                    break;

                case "model":
                    models.Add(new Model(child));
                    break;

                case "light":
                    lights.Add(new Light(child));
                    break;
                }
            }

            HasIncludes = Worlds.Any(world => world.HasIncludes) || Models.Any(model => model.HasIncludes);
        }
        private async void OnDelete()
        {
            var dialogSettings = new MetroDialogSettings()
            {
                AffirmativeButtonText = "确定",
                NegativeButtonText    = "取消",
                AnimateShow           = true,
                AnimateHide           = false
            };
            var dialogResult = await MvvmUtility.ShowMessageAsync("确定要删除吗?", "删除", MessageBoxButton.YesNo, MessageBoxImage.Question, dialogSettings, MessageDialogStyle.AffirmativeAndNegative);

            if (dialogResult != MessageDialogResult.Affirmative)
            {
                return;
            }

            Models.ForEach(model =>
            {
                if (model.IsSelected)
                {
                    Service.Delete(model.Id);
                }
            });

            while (Models.Any(brand => brand.IsSelected))
            {
                var selectedModel = Models.Where(model => model.IsSelected).FirstOrDefault();
                PerformActionOnUIThread(() => { Models.Remove(selectedModel); });
            }
        }
Beispiel #4
0
 public override void Add(IRace model)
 {
     if (Models.Any(x => x.Name == model.Name))
     {
         throw new InvalidOperationException(string.Format(ExceptionMessages.RaceExists, model.Name));
     }
     base.Add(model);
 }
Beispiel #5
0
 public override void Add(IMotorcycle model)
 {
     if (Models.Any(x => x.Model == model.Model))
     {
         throw new ArgumentException(string.Format(ExceptionMessages.MotorcycleExists, model.Model));
     }
     base.Add(model);
 }
Beispiel #6
0
 private async void OnFilesSamplesDropDownButtonClicked(object sender, RoutedEventArgs e)
 {
     if (Models.Any())
     {
         FlyoutBase.ShowAttachedFlyout((FrameworkElement)sender);
     }
     else
     {
         await ShowMessage("No enrolled voices", "You have no enrolled voices. Please enroll a new voice.");
     }
 }
Beispiel #7
0
 private async void StartRecognitionButtonClicked(object sender, RoutedEventArgs e)
 {
     if (Models.Any())
     {
         await RecognizeFromSourceAsync(SourceType.FromMicrophone);
     }
     else
     {
         await ShowMessage("No enrolled voices", "You have no enrolled voices. Please enroll a new voice.");
     }
 }
 public PresetsViewModel(PresetService presetService)
     : base(presetService)
 {
     ImportInstalledFilesCommand = new RelayCommand(ImportInstalledFiles, CanAdd);
     SyncEnabledPresetsCommand   = new RelayCommand(SyncEnabledPresets, () => Models.Any(preset => preset.IsEnabled));
     ChangeImageCommand          = new RelayCommand <Preset>(ChangeImage);
     ClearImageCommand           = new RelayCommand <Preset>(ClearImage);
     AddGlobalEnbLocalCommand    = new RelayCommand(() => _dialogService.ShowDialog(DialogName.GlobalEnbLocal), CanAdd);
     SwitchGlobalENBLocalCommand = new RelayCommand <Preset>(SwitchGlobalENBLocal);
     OpenAddENBoostPresetCommand = new RelayCommand(() => _dialogService.ShowDialog(DialogName.AddENBoostPreset));
 }
        public SprintDtoCollectionBuilder Add(int id, TimeSpan sprintRange, SprintState sprintState = SprintState.CLOSED)
        {
            DateTime endDate = DateTime.UtcNow;

            if (Models.Any())
            {
                endDate = Models.Last().StartDate;
            }

            return(Add(id, endDate.Subtract(sprintRange), endDate, sprintState));
        }
        private SkinningInfo ConsolidateSkinningInfo()
        {
            SkinningInfo skin = new SkinningInfo();

            foreach (Model model in Models)
            {
                skin.HasSkinningInfo      = Models.Any(a => a.SkinningInfo.HasSkinningInfo == true);
                skin.HasBoneMapDatastream = Models.Any(a => a.SkinningInfo.HasBoneMapDatastream == true);
                if (model.SkinningInfo.IntFaces != null)
                {
                    skin.IntFaces = model.SkinningInfo.IntFaces;
                }
                if (model.SkinningInfo.IntVertices != null)
                {
                    skin.IntVertices = model.SkinningInfo.IntVertices;
                }
                if (model.SkinningInfo.LookDirectionBlends != null)
                {
                    skin.LookDirectionBlends = model.SkinningInfo.LookDirectionBlends;
                }
                if (model.SkinningInfo.MorphTargets != null)
                {
                    skin.MorphTargets = model.SkinningInfo.MorphTargets;
                }
                if (model.SkinningInfo.PhysicalBoneMeshes != null)
                {
                    skin.PhysicalBoneMeshes = model.SkinningInfo.PhysicalBoneMeshes;
                }
                if (model.SkinningInfo.BoneEntities != null)
                {
                    skin.BoneEntities = model.SkinningInfo.BoneEntities;
                }
                if (model.SkinningInfo.BoneMapping != null)
                {
                    skin.BoneMapping = model.SkinningInfo.BoneMapping;
                }
                if (model.SkinningInfo.Collisions != null)
                {
                    skin.Collisions = model.SkinningInfo.Collisions;
                }
                if (model.SkinningInfo.CompiledBones != null)
                {
                    skin.CompiledBones = model.SkinningInfo.CompiledBones;
                }
                if (model.SkinningInfo.Ext2IntMap != null)
                {
                    skin.Ext2IntMap = model.SkinningInfo.Ext2IntMap;
                }
            }
            return(skin);
        }
        private Expression <Func <VehicleToDriveTypeDocument, bool> > AddModelsFilter(Expression <Func <VehicleToDriveTypeDocument, bool> > filterEx)
        {
            if (Models == null || !Models.Any())
            {
                return(filterEx);
            }

            Expression <Func <VehicleToDriveTypeDocument, bool> > modelFilterEx = null;

            foreach (var model in Models)
            {
                modelFilterEx = modelFilterEx.OrElse(x => x.ModelName == model);
            }

            return(filterEx.AndAlso(modelFilterEx));
        }
Beispiel #12
0
        private void GetModels()
        {
            using (var unitOfWork = new UnitOfWork())
            {
                if (!Models.Any())
                {
                    Models.Clear();
                    Models.Add(new Model()
                    {
                        model_name = ""
                    });
                    Models.AddRange(unitOfWork.ModelRepository.GetAll());
                }

                modelBindingSource.DataSource = Models;
            }
        }
Beispiel #13
0
        internal World(XmlNode node)
        {
            Name = node.Attributes?["name"]?.Value;

            List <Include> includes = new List <Include>();
            List <Model>   models   = new List <Model>();
            List <Frame>   frames   = new List <Frame>();
            List <Light>   lights   = new List <Light>();

            Includes = includes.AsReadOnly();
            Models   = models.AsReadOnly();
            Frames   = frames.AsReadOnly();
            Lights   = lights.AsReadOnly();

            foreach (XmlNode child in node.ChildNodes)
            {
                switch (child.Name)
                {
                case "wind":
                    Wind = new Wind(child);
                    break;

                case "gravity":
                    Gravity = new Vector3d(child);
                    break;

                case "include":
                    includes.Add(new Include(child));
                    break;

                case "model":
                    models.Add(new Model(child));
                    break;

                case "frame":
                    frames.Add(new Frame(child));
                    break;

                case "light":
                    lights.Add(new Light(child));
                    break;
                }
            }

            HasIncludes = Includes.Count != 0 || Models.Any(model => model.HasIncludes);
        }
        private Expression <Func <VehicleToBodyStyleConfigDocument, bool> > AddFilter()
        {
            Expression <Func <VehicleToBodyStyleConfigDocument, bool> > filterEx = null;

            if (Makes != null && Makes.Any())
            {
                Expression <Func <VehicleToBodyStyleConfigDocument, bool> > makeFilterEx =
                    Makes.Aggregate <string, Expression <Func <VehicleToBodyStyleConfigDocument, bool> > >(null,
                                                                                                           (current, make) => current.OrElse(x => x.MakeName == make));
                filterEx = filterEx.AndAlso(makeFilterEx);
            }

            if (Models != null && Models.Any())
            {
                Expression <Func <VehicleToBodyStyleConfigDocument, bool> > modelFilterEx =
                    Models.Aggregate <string, Expression <Func <VehicleToBodyStyleConfigDocument, bool> > >(null,
                                                                                                            (current, model) => current.OrElse(x => x.ModelName == model));
                filterEx = filterEx.AndAlso(modelFilterEx);
            }

            if (SubModels != null && SubModels.Any())
            {
                Expression <Func <VehicleToBodyStyleConfigDocument, bool> > subModelsFilterEx =
                    SubModels.Aggregate <string, Expression <Func <VehicleToBodyStyleConfigDocument, bool> > >(null,
                                                                                                               (current, subModel) => current.OrElse(x => x.SubModelName == subModel));
                filterEx = filterEx.AndAlso(subModelsFilterEx);
            }

            if (StartYear != 0)
            {
                filterEx = filterEx.AndAlso(x => x.YearId >= StartYear);
            }

            if (EndYear != 0)
            {
                filterEx = filterEx.AndAlso(x => x.YearId <= EndYear);
            }

            if (Regions != null && Regions.Any())
            {
                Expression <Func <VehicleToBodyStyleConfigDocument, bool> > regionsFilterEx =
                    Regions.Aggregate <string, Expression <Func <VehicleToBodyStyleConfigDocument, bool> > >(null,
                                                                                                             (current, region) => current.OrElse(x => x.RegionName == region));
                filterEx = filterEx.AndAlso(regionsFilterEx);
            }

            if (VehicleTypes != null && VehicleTypes.Any())
            {
                Expression <Func <VehicleToBodyStyleConfigDocument, bool> > vehicleTypeFilterEx =
                    VehicleTypes.Aggregate <string, Expression <Func <VehicleToBodyStyleConfigDocument, bool> > >(null,
                                                                                                                  (current, vehicleType) => current.OrElse(x => x.VehicleTypeName == vehicleType));
                filterEx = filterEx.AndAlso(vehicleTypeFilterEx);
            }

            if (VehicleTypeGroups != null && VehicleTypeGroups.Any())
            {
                Expression <Func <VehicleToBodyStyleConfigDocument, bool> > vehicleTypeGroupFilterEx =
                    VehicleTypeGroups.Aggregate <string, Expression <Func <VehicleToBodyStyleConfigDocument, bool> > >(null,
                                                                                                                       (current, vehicleTypeGroup) => current.OrElse(x => x.VehicleTypeGroupName == vehicleTypeGroup));
                filterEx = filterEx.AndAlso(vehicleTypeGroupFilterEx);
            }

            // body
            if (BodyNumDoors != null && BodyNumDoors.Any())
            {
                Expression <Func <VehicleToBodyStyleConfigDocument, bool> > bodyNumDoorsFilterEx =
                    BodyNumDoors.Aggregate <string, Expression <Func <VehicleToBodyStyleConfigDocument, bool> > >(null,
                                                                                                                  (current, bodyNumDoor) => current.OrElse(x => x.BodyNumDoors == bodyNumDoor));
                filterEx = filterEx.AndAlso(bodyNumDoorsFilterEx);
            }

            if (BodyTypes != null && BodyTypes.Any())
            {
                Expression <Func <VehicleToBodyStyleConfigDocument, bool> > bodyTypesFilterEx =
                    BodyTypes.Aggregate <string, Expression <Func <VehicleToBodyStyleConfigDocument, bool> > >(null,
                                                                                                               (current, bodyType) => current.OrElse(x => x.BodyTypeName == bodyType));
                filterEx = filterEx.AndAlso(bodyTypesFilterEx);
            }

            // others
            if (VehicleIds != null && VehicleIds.Any())
            {
                Expression <Func <VehicleToBodyStyleConfigDocument, bool> > vehicleIdFilterEx =
                    VehicleIds.Aggregate <int, Expression <Func <VehicleToBodyStyleConfigDocument, bool> > >(null,
                                                                                                             (current, vehicleId) => current.OrElse(x => x.VehicleId == vehicleId));
                filterEx = filterEx.AndAlso(vehicleIdFilterEx);
            }

            if (BodyStyleConfigId != 0)
            {
                filterEx = filterEx.AndAlso(x => x.BodyStyleConfigId == BodyStyleConfigId);
            }

            return(filterEx);
        }
Beispiel #15
0
        internal Model(XmlNode node)
        {
            Name          = node.Attributes?["name"]?.Value;
            CanonicalLink = node.Attributes?["canonical_link"]?.Value;

            List <Include> includes = new List <Include>();
            List <Model>   models   = new List <Model>();
            List <Frame>   frames   = new List <Frame>();
            List <Link>    links    = new List <Link>();

            Includes = includes.AsReadOnly();
            Models   = models.AsReadOnly();
            Frames   = frames.AsReadOnly();
            Links    = links.AsReadOnly();

            foreach (XmlNode child in node.ChildNodes)
            {
                switch (child.Name)
                {
                case "static":
                    Static = BoolElement.ValueOf(child);
                    break;

                case "self_collide":
                    SelfCollide = BoolElement.ValueOf(child);
                    break;

                case "allow_auto_disable":
                    AllowAutoDisable = BoolElement.ValueOf(child);
                    break;

                case "include":
                    includes.Add(new Include(child));
                    break;

                case "model":
                    models.Add(new Model(child));
                    break;

                case "enable_wind":
                    EnableWind = BoolElement.ValueOf(child);
                    break;

                case "frame":
                    frames.Add(new Frame(child));
                    break;

                case "pose":
                    Pose = new Pose(child);
                    break;

                case "link":
                    links.Add(new Link(child));
                    break;
                }
            }

            HasIncludes =
                Includes.Count != 0 ||
                Models.Any(model => model.HasIncludes) ||
                Links.Any(link => link.HasUri);
        }
 private bool FastScanCommandCanExecute(object o)
 {
     return(Models != null && Models.Any());
 }
 private bool CanDisableAll()
 {
     return(Models.Any(m => m.IsEnabled));
 }