public HomeController(IUnitOfWork uow)
     : base(uow)
 {
     PerformanceGoalsViewModel = new EntityViewModel<TBL_PerformanceGoals>();
     PerformanceGoalsViewModel.BaseModel = this.BaseVM;
     PerformanceGoalsViewModel.EntityModel = new TBL_PerformanceGoals();
 }
        public ManagedObjectsViewModel()
        {
            // todo: Move this to an Init method so the constructor isn't so heavy
            dispatcherTimer.Tick += new EventHandler(Refresh);
            dispatcherTimer.Interval = new TimeSpan(0,0,1);
            dispatcherTimer.Start();

            EntitiesForSprites = new EntityViewModel { CategoryName = "Sprites" };
            EntitiesForShapes = new EntityViewModel { CategoryName = "Shapes" };
            EntitiesForTexts = new EntityViewModel { CategoryName = "Texts" };
            CategorizedEntities = new EntityViewModel 
            { 
                CategoryName = "Entities",
                CategorizationType = CategorizationType.Type
            
            };

            ProfilerCommands.Self.AddManagedObjectsCategory("Sprites", EntitiesForSprites.GetStrings);
            ProfilerCommands.Self.AddManagedObjectsCategory("Shapes", EntitiesForShapes.GetStrings);
            ProfilerCommands.Self.AddManagedObjectsCategory("Texts", EntitiesForTexts.GetStrings);
            ProfilerCommands.Self.AddManagedObjectsCategory("Entities", CategorizedEntities.GetStrings);

            ProfilerCommands.Self.AddManagedObjectsCategory("Windows (FlatRedBall)", GetWindowList);
            ProfilerCommands.Self.AddManagedObjectsCategory("Instructions", GetInstructions);

        }
 public CompaniesController(IUnitOfWork uow)
     : base(uow)
 {
     CompanyViewModel = new EntityViewModel<TBL_COMPANIES>();
     CompanyViewModel.BaseModel = this.BaseVM;
     CompanyViewModel.EntityModel = new TBL_COMPANIES();
 }
 public void OnNewItemAdded(object sender, SomeEntityEventArgs e)
 {
     var entityVM = new EntityViewModel(e.Entity);
     Items.Add(entityVM);
     SelectedItem = entityVM;
     _itemAdded = true;
     _service.Add(e.Entity);
 }
示例#5
0
 /// <summary>
 /// Gets the specified evm.
 /// </summary>
 /// <param name="evm">The evm.</param>
 /// <returns></returns>
 public static EntityViewModel Get(EntityViewModel evm)
 {
     if (!Cache.Contains(evm.EntityName))
     {
         return null;
     }
     return (EntityViewModel) Cache.Get(evm.EntityName);
 }
 public QuickStartController(IUnitOfWork uow)
     : base(uow)
 {
     QuickStartViewModel = new EntityViewModel<TBL_OPPORTUNITIES>();
     QuickStartViewModel.BaseModel = this.BaseVM;
     TBL_OPPORTUNITIES opportunity = new TBL_OPPORTUNITIES();
     opportunity.NAME = "test opp";
     QuickStartViewModel.EntityModel = new TBL_OPPORTUNITIES();
 }
	//public int[] HealthHistory = new int[50];
	
	public PlayList(FlatHexPoint savePointLocation, MoveStyle saveMove, ActionStyle saveAction, EntityViewModel saveEnemyVM, EntityView saveEnemyView)
	{
		this.SavePointLocation = savePointLocation;
		this.SaveMove = saveMove;
		this.SaveAction = saveAction;
		this.SaveEnemyVM = saveEnemyVM;
		this.SaveEnemyView = saveEnemyView;
		//this.HealthHistory = healthHistory;
	}
示例#8
0
        /// <summary>
        /// Removes the specified evm.
        /// </summary>
        /// <param name="evm">The evm.</param>
        /// <returns></returns>
        public static bool Remove(EntityViewModel evm)
        {
            if (Cache.Contains(evm.EntityName))
            {
                var objectToRemove = Cache.Remove(evm.EntityName);

                return objectToRemove != null;
            }
            return false;
        }
示例#9
0
        public ActionResult Index(long id, string pageUrl = "")
        {
            var resort = meridian.resortsStore.Get(id);

            if (resort.is_published)
            {
                var model = new EntityViewModel
                {
                    Title = resort.title,
                    FieldSet = resort.GetFieldset(pageUrl),
                    MenuLinks = resort.GetMenuLinks(resort.EntityUri().ToString(), pageUrl),
                    Photos = resort.GetPhotos(),
                    Entity = resort,
                    EntityMap = resort,
                    ListImageUrl = Extensions.Extensions.ToAbsoluteUrl(resort.GetListImage())
                };

                var searchModel = new SearchViewModel
                {
                    ResortId = id,
                    SubTerritoryId = resort.territory_id,
                    RootTerritoryId = resort.GetResortsTerritorie() == null ? 0 : resort.GetResortsTerritorie().parent_id
                };

                long terrId = searchModel.RootTerritoryId;
                long rootId = searchModel.RootTerritoryId;
                long subId = searchModel.SubTerritoryId;

                while (terrId > 0)
                {
                    var terr = meridian.territoriesStore.Get(terrId);
                    if (terr.parent_id > 0)
                    {
                        rootId = terr.parent_id;
                        subId = terr.id;
                    }

                    terrId = terr.parent_id;
                }

                searchModel.RootTerritoryId = rootId;
                searchModel.TerritoryId = subId;

                ViewBag.SearchModel = searchModel;

                LastViewEntities.AddItemToLastViewed(resort.ProtoName, resort.id);

                return View(model);
            }

            throw new HttpException(404, "Отель не найден");
        }
示例#10
0
        /// <summary>
        ///   Gets the local grid entities.
        /// </summary>
        /// <param name="myMe"></param>
        /// <param name="myEVE">My eve.</param>
        /// <returns></returns>
        public static IEnumerable<EntityViewModel> GetLocalGridEntities(Character myMe, EVE.ISXEVE.EVE myEVE)
        {
            try
              {
            var entities = myEVE.QueryEntities().Where(entity => entity.IsPC && myMe.CharID != entity.CharID).ToArray();

            var oEntities = new List<EntityViewModel>();

            foreach (var entity in entities)
            {
              var standings = EntityHelper.ComputeStandings(myMe, entity);

              var newEntity = new EntityViewModel {Entity = entity, EntityStandings = standings};

              var cachedEntity = EntityCache.Get(newEntity);

              if (cachedEntity == null)
              {
            EntityCache.Add(newEntity);
              }
              else
              {
            if (cachedEntity.EntityStandings != newEntity.EntityStandings)
            {
              if (newEntity.EntityStandings > cachedEntity.EntityStandings)
              {
                EntityCache.Remove(newEntity);
                EntityCache.Add(newEntity);
              }

              if (newEntity.EntityStandings == 0 && cachedEntity.EntityStandings != 0)
              {
                newEntity.EntityStandings = cachedEntity.EntityStandings;
              }
            }
              }

              oEntities.Add(newEntity);
            }

            return oEntities;
              }
              catch (Exception e)
              {
            InnerSpace.Echo("GET LOCAL GRID ENTITIES ERROR :" + e.Message);

            return new List<EntityViewModel>();
              }
        }
	public override void ChangeBattleState(EntityViewModel viewModel) {
		base.ChangeBattleState(viewModel);
		
		if(viewModel.BattleState == BattleState.CONFUSING)
		{
			Debug.Log(viewModel.Name + "is confusing");
			var DoDamage = Observable.Interval(TimeSpan.FromSeconds(1))
				.Subscribe(_ => 
				{
					viewModel.Health -= 100;
					Debug.Log (viewModel.Name + " is confusing and hit themselves");
				}); 
			Observable.Timer(TimeSpan.FromSeconds(5)).Subscribe(_ => DoDamage.Dispose());
		}
	}
示例#12
0
        public ActionResult Index(long id, string pageUrl = "")
        {
            var region = meridian.regionsStore.Get(id);

            var model = new EntityViewModel
            {
                Title = region.title,
                FieldSet = region.GetFieldset(pageUrl),
                MenuLinks = region.GetMenuLinks(region.EntityUri().ToString(), pageUrl),
                Photos = region.GetPhotos(),
                Entity = region
            };

            return View(model);
        }
        public ActionResult CureProfile(long id, string pageUrl = "")
        {
            var cureProfile = meridian.cure_profilesStore.Get(id);

            var model = new EntityViewModel
            {
                Title = cureProfile.title,
                FieldSet = cureProfile.GetFieldset(pageUrl),
                MenuLinks = cureProfile.GetMenuLinks(cureProfile.EntityUri().ToString(), pageUrl),
                Photos = cureProfile.GetPhotos(),
                Entity = cureProfile
            };

            return View(model);
        }
示例#14
0
        public ActionResult Index(long id, string pageUrl = "")
        {
            var country = meridian.countriesStore.Get(id);

            var model = new EntityViewModel
            {
                Title = country.title,
                FieldSet = country.GetFieldset(pageUrl),
                MenuLinks = country.GetMenuLinks(country.EntityUri().ToString(), pageUrl),
                Photos = country.GetPhotos(),
                Entity = country
            };

            return View(model);
        }
        public ActionResult Desease(long id, string pageUrl = "")
        {
            var desease = meridian.deseasesStore.Get(id);

            var model = new EntityViewModel
            {
                Title = desease.title,
                FieldSet = desease.GetFieldset(pageUrl),
                MenuLinks = desease.GetMenuLinks(desease.EntityUri().ToString(), pageUrl),
                Photos = desease.GetPhotos(),
                Entity = desease
            };

            ViewBag.CureProfileId = desease.CureProfile.id;

            return View(model);
        }
	public override void ChangeHealth(EntityViewModel viewModel) {
		base.ChangeBattleState(viewModel);
		//MainGameVM.GameState = GameState.GameOver;
		
		viewModel.BattleState = BattleState.DEAD;
				
		Debug.Log("I Die la~~~~~~~~~~~~~~~~~~~" + viewModel.BattleState);
		
		if(viewModel is SoldierViewModel)
			MainGameVM.SoldierCount -= 1;
		else
			MainGameVM.EnemyCount -= 1;
			
		if(MainGameVM.EnemyCount == 0 || MainGameVM.SoldierCount == 0)
			MainGameVM.GameState = GameState.GameOver;

	}
        public ActionResult Treatment(long id, string pageUrl = "")
        {
            if (!meridian.treatment_optionsStore.Exists(id))
                return HttpNotFound();

            var treatment = meridian.treatment_optionsStore.Get(id);

            var model = new EntityViewModel
            {
                Title = treatment.title,
                FieldSet = treatment.GetFieldset(pageUrl),
                MenuLinks = treatment.GetMenuLinks(treatment.EntityUri().ToString(), pageUrl),
                Photos = treatment.GetPhotos(),
                Entity = treatment
            };

            return View(model);
        }
        public ActionResult HealthFactor(long id, string pageUrl = "")
        {
            if (!meridian.health_factorsStore.Exists(id))
                return HttpNotFound();

            var healthFactor = meridian.health_factorsStore.Get(id);

            var model = new EntityViewModel
            {
                Title = healthFactor.title,
                FieldSet = healthFactor.GetFieldset(pageUrl),
                MenuLinks = healthFactor.GetMenuLinks(healthFactor.EntityUri().ToString(), pageUrl),
                Photos = healthFactor.GetPhotos(),
                Entity = healthFactor
            };

            return View(model);
        }
示例#19
0
        public PartialViewResult Comments(long id, string protoName)
        {
            var entity = meridian.GetAs<IDatabaseEntity>(protoName, id);
            var model = meridian.commentsStore.GetEntitiesReview(id, protoName).ToList();

            int tPage = Extensions.Extensions.CalculatePagesCount(model.Count);
            int cPage = GetPage();
            var comments = Extensions.Extensions.TakePage(model, cPage);

            var model2 = new EntityViewModel
                             {
                                 Entity = entity,
                                 EntityReviews = comments,
                                 Page = cPage,
                                 PagesCount = tPage
                             };

            return PartialView(model2);
        }
示例#20
0
        async Task <EntityViewModel <Topic, Reply> > GetViewModel(EntityViewModel <Topic, Reply> model)
        {
            if (model.Entity == null)
            {
                if (model.Options.Id <= 0)
                {
                    throw new ArgumentOutOfRangeException(nameof(model.Options.Id));
                }

                var entity = await _entityStore.GetByIdAsync(model.Options.Id);

                if (entity == null)
                {
                    throw new ArgumentNullException();
                }

                model.Entity = entity;
            }

            return(model);
        }
示例#21
0
        public void EntityEditModel_mirrors_ViewModel()
        {
            // ARRANGE

            var model = new Entity("entity", new Tag("tag1", new Facet("f", new FacetProperty("p1"))));

            model.SetFacetProperty(model.Tags.Single().Facet.Properties.Single(), 1);

            var viewModel = new EntityViewModel(model, model.Tags.Single().ToViewModel());

            // ACT

            var editModel = new EntityEditModel(viewModel, delegate { }, delegate { });

            // ASSERT

            Assert.Equal("entity", editModel.Name);
            Assert.Equal("tag1", editModel.Tags.ElementAt(0).ViewModel.Tag.Name);
            Assert.Equal("p1", editModel.Tags.ElementAt(0).Properties.Single().ViewModel.Property.Name);
            Assert.Equal(1, editModel.Tags.ElementAt(0).Properties.Single().Value);
        }
示例#22
0
        /// <summary>
        ///   Does the tackle and returns the current valid engageable targets
        /// </summary>
        /// <param name="myMe">My me.</param>
        /// <param name="myEve">My eve.</param>
        /// <param name="entities">The entities.</param>
        /// <param name="engageRules">The engage rules.</param>
        public static void Engage(Character myMe, EVE.ISXEVE.EVE myEve,
                                  IEnumerable <EntityViewModel> entities, EngageRules engageRules)
        {
            IEnumerable <EntityViewModel> targettedNeuts = TargetNeuts(entities).ToList();

            //Tackle closest targetted neut
            EntityViewModel closestTargetedNeut = null;

            if (targettedNeuts.Any())
            {
                closestTargetedNeut = EntityHelper.FindClosestEntity(targettedNeuts);
            }

            if (closestTargetedNeut != null)
            {
                if (engageRules.GoBrawl ?? DefaultGoBrawl)
                {
                    closestTargetedNeut.Entity.MakeActiveTarget();
                    closestTargetedNeut.Entity.Orbit(500);
                }


                ActivateModules(myMe, myEve, engageRules);
            }
            else
            {
                var closestNeutNotTargetted = EntityHelper.FindClosestEntity(entities);

                if (closestNeutNotTargetted != null)
                {
                    ActivateModules(myMe, myEve, engageRules);

                    if (engageRules.GoBrawl ?? DefaultGoBrawl)
                    {
                        closestNeutNotTargetted.Entity.Approach();
                        myEve.Execute(ExecuteCommand.CmdAccelerate);
                    }
                }
            }
        }
示例#23
0
        public void RelationshipEditModel_commits_changes_to_ViewModel()
        {
            // ARRANGE

            var entity1   = new EntityViewModel(new Entity());
            var entity2   = new EntityViewModel(new Entity());
            var model     = new Relationship("r", new Entity(), new Entity(), new Tag());
            var viewModel = new RelationshipViewModel(model, new EntityViewModel(model.From), new EntityViewModel(model.To));

            Relationship committed = null;
            var          commitCB  = new Action <Relationship>(r => committed = r);

            Relationship reverted = null;
            var          revertCB = new Action <Relationship>(r => reverted = r);

            var editModel = new RelationshipEditModel(viewModel, commitCB, revertCB);

            editModel.Name = "changed";
            editModel.From = entity1;
            editModel.To   = entity2;

            // ACT

            editModel.CommitCommand.Execute(null);

            // ASSERT

            Assert.Equal(model, committed);
            Assert.Null(reverted);

            Assert.Equal("changed", editModel.Name);
            Assert.Equal("changed", viewModel.Name);
            Assert.Equal("changed", model.Name);

            Assert.Equal(entity1.Model, viewModel.From.Model);
            Assert.Equal(entity1.Model, model.From);
            Assert.Equal(entity2.Model, viewModel.To.Model);
            Assert.Equal(entity2.Model, model.To);
        }
示例#24
0
        public async Task WriteDto_ExistingSolution_CityDTORewrite()
        {
            var msWorkspace = MSBuildWorkspace.Create();
            var solution    = msWorkspace.OpenSolutionAsync(this.TestSolution.FullName).Result;

            solution = solution.GetIsolatedSolution();

            var personClassDoc = solution.Projects
                                 .SelectMany(p => p.Documents)
                                 .Where(p => p.Name == "City.cs")
                                 .FirstOrDefault();

            var vm = await EntityViewModel.CreateRecursive(personClassDoc);

            vm.DtoName = "CityDTO";
            var dtoLocation = solution.GetMostLikelyDtoLocation();

            var modifiedSolution = await solution.WriteDto(dtoLocation, vm.ConvertToMetadata(), true, false);

            Assert.IsNotNull(modifiedSolution);

            var cityDto = modifiedSolution.GetChanges(solution)
                          .GetProjectChanges().Single()
                          .GetChangedDocuments()
                          .Select(p => modifiedSolution.GetProject(p.ProjectId).GetDocument(p))
                          .Where(p => p.Name == "CityDTO.cs")
                          .FirstOrDefault();

            Assert.IsNotNull(cityDto);

            var source = await cityDto.GetTextAsync();

            var sourceCode = source.ToString();

            Assert.AreEqual(3, Regex.Matches(sourceCode, CustomCodeCommentWrapper.CustomCodeCommentBegin).Count);
            Assert.AreEqual(3, Regex.Matches(sourceCode, CustomCodeCommentWrapper.CustomCodeCommentEnd).Count);

            Assert.IsTrue(sourceCode.Contains("CustomProperty = p.Name + p.PostalCode,"));
        }
        public List <InstalledPlugin> LoadInstalledPlugins(EntityViewModel viewModel)
        {
            DirectoryInfo persistenceDir = new DirectoryInfo(Path.Combine(App.ServerPath, viewModel.Entity.Name, "plugins"));

            if (!persistenceDir.Exists)
            {
                persistenceDir.Create();
            }
            List <InstalledPlugin> result = new List <InstalledPlugin>();
            FileInfo pluginsFile          = new FileInfo(Path.Combine(persistenceDir.FullName, "plugins.json"));

            if (!pluginsFile.Exists)
            {
                return(result);
            }

            result = JsonConvert.DeserializeObject <List <InstalledPlugin> >(File.ReadAllText(pluginsFile.FullName));

            //Overwrite json if any changes appeared while deserializing (Unset value set etc.)
            //StoreInstalledPlugins(result);
            return(result);
        }
        public List <FileInfo> ReadPluginJarsFromDirectory(EntityViewModel viewModel)
        {
            DirectoryInfo pluginDir = new DirectoryInfo(Path.Combine(App.ServerPath, viewModel.Entity.Name, "plugins"));

            if (!pluginDir.Exists)
            {
                return(new List <FileInfo>());
            }

            var             files  = pluginDir.GetFiles();
            List <FileInfo> result = new List <FileInfo>(files.Length);

            foreach (FileInfo fileInfo in files)
            {
                if (fileInfo.Extension.Equals(".jar"))
                {
                    result.Add(fileInfo);
                }
            }

            return(result);
        }
示例#27
0
        public EntityViewModel GetData(long ID)
        {  //Used for finding Entity by Id
            EntityViewModel model = new EntityViewModel();

            if (ID != 0)
            {
                try
                {
                    model.entity = _context.Entity.AsNoTracking().Where(e => (e.ID) == ID).FirstOrDefault();

                    if (model.entity.EntityTypeID == 1)
                    {
                        model.entity.EntityTypeName = "Branch";
                        model.branchMapping         = _context.BranchMapping.AsNoTracking().Where(e => (e.EntityID) == ID).FirstOrDefault();
                    }
                    if (model.entity.EntityTypeID == 2)
                    {
                        model.entity.EntityTypeName = "Franchise";
                        model.franchiseMapping      = _context.FranchiseMapping.AsNoTracking().Where(e => (e.EntityID) == ID).FirstOrDefault();
                    }
                    if (model.entity.EntityTypeID == 3)
                    {
                        model.entity.EntityTypeName = "SubBroker";
                        model.subbrokerMapping      = _context.SubbrokerMapping.AsNoTracking().Where(e => (e.EntityID) == ID).FirstOrDefault();
                    }
                    return(model);
                }
                catch (Exception ex)
                {
                    return(null);

                    throw ex;
                }
            }
            else
            {
                return(null);
            }
        }
示例#28
0
        private int CompareEntityViewModel(EntityViewModel x, EntityViewModel y)
        {
            Debug.Assert(x != null, "x != null");
            Debug.Assert(y != null, "y != null");

            if (x.Source.Id == y.Source.Id)
            {
                return(0);
            }

            if (x.Source.Fansubs.Count > 0 && y.Source.Fansubs.Count > 0)
            {
                return(string.CompareOrdinal(x.Source.Fansubs[0], y.Source.Fansubs[0]));
            }

            if (x.Source.Extension != y.Source.Extension)
            {
                return(string.CompareOrdinal(x.Source.Extension, y.Source.Extension));
            }

            return(-1);
        }
        /// <summary>
        /// Populates the EntityViewModel object's properties from the given EntityDetail object's properties.
        /// </summary>
        /// <param name="thisObject">Current entity view model on which the extension method is called</param>
        /// <param name="entityDetails">EntityDetails model from which values to be read</param>
        /// <returns>Values populated EntityViewModel instance</returns>
        public static EntityViewModel SetValuesFrom(this EntityViewModel thisObject, EntityDetails entityDetails)
        {
            if (entityDetails != null)
            {
                if (thisObject == null)
                {
                    thisObject = new EntityViewModel();
                }

                thisObject.Id   = entityDetails.ID;
                thisObject.Name = entityDetails.Name;

                // Parse the category string
                thisObject.Category   = entityDetails.CategoryID.ToEnum <int, CategoryType>(CategoryType.All);
                thisObject.AccessType = (AccessType)entityDetails.AccessTypeID;

                thisObject.ParentId       = entityDetails.ParentID;
                thisObject.ParentName     = entityDetails.ParentName;
                thisObject.ParentType     = entityDetails.ParentType;
                thisObject.UserPermission = entityDetails.UserPermission;

                if (entityDetails.Tags != null)
                {
                    thisObject.Tags = entityDetails.Tags;
                }

                thisObject.Rating      = (double)entityDetails.AverageRating;
                thisObject.RatedPeople = entityDetails.RatedPeople;
                if (entityDetails.Thumbnail != null)
                {
                    thisObject.ThumbnailID = entityDetails.Thumbnail.AzureID;
                }

                thisObject.Producer   = entityDetails.ProducedBy;
                thisObject.ProducerId = entityDetails.CreatedByID;
            }

            return(thisObject);
        }
示例#30
0
        public override string DeleteByParamQuery(EntityViewModel viewModel, bool completeDelete = false)
        {
            var sql = new StringBuilder();

            if (viewModel.Values.Count == 0)
            {
                return(sql.ToString());
            }

            var whereString = GetWhereString(viewModel);

            sql.AppendFormat(
                completeDelete
                    ? "DELETE FROM [{0}].[{1}] WHERE 1=1 {2} "
                    : "UPDATE [{0}].[{1}] SET IsDeleted=1 WHERE 1=1 {2} ", viewModel.TableSchema, viewModel.TableName,
                whereString);

            return(sql.ToString());

            //        sql.AppendFormat("DELETE FROM {0} WHERE [{1}]='{2}'", viewModel.TableName, paramenterName, parameter);
            //        return sql.ToString();
        }
示例#31
0
        /// <summary>
        /// Rebuilds our graph of proxy objects to resemble the one in our scene source
        /// </summary>
        /// <param name="entities"></param>
        private void RebuildScenegraphEntities(IEnumerable <Entity> entities)
        {
            List <ISceneNode> worldNodes  = new List <ISceneNode>();
            List <ISceneNode> staticNodes = new List <ISceneNode>();

            //At the moment we rebuild the graph if it's changed
            Items.Clear();
            foreach (Entity n in entities)
            {
                if (!n.IsStatic)
                {
                    EntityViewModel entityProxy = new EntityViewModel(n, this);
                    worldNodes.Add(entityProxy);
                    PopulateEntityChildren(entityProxy, n);
                }
            }
            //Workaround for now
            WorldNodeViewModel worldNode = new WorldNodeViewModel();

            worldNode.Children.AddRange(worldNodes);

            WorldNode = worldNode;

            TimelineNodeViewModel timeline = new TimelineNodeViewModel();

            timeline.Children.Add(new KeyframeViewModel(37));
            timeline.Children.Add(new KeyframeViewModel(50));
            timeline.Children.Add(new KeyframeViewModel(65));
            timeline.Children.Add(new KeyframeViewModel(68));
            timeline.Children.Add(new KeyframeViewModel(80));
            timeline.Children.Add(new KeyframeViewModel(87));
            timeline.Children.Add(new KeyframeViewModel(89));

            Items.Add(worldNode);
            Items.Add(new StaticNodeViewModel("Grid"));
            Items.Add(new StaticNodeViewModel("Water"));
            Items.Add(new StaticNodeViewModel("Map"));
            Items.Add(timeline);
        }
示例#32
0
        private void RenderEntity(EntityViewModel entity)
        {
            foreach (EntityViewModel child in entity.Children)
            {
                RenderEntity(child);
            }
            DebugUtil.LogWithLocation($"Rendering entity: {entity.Name}");
            LibTransform  transformBehaviour = entity.GetEntityComponent <LibTransform>();
            MeshBehaviour renderBehaviour    = entity.GetEntityComponent <MeshBehaviour>();

            if (renderBehaviour != null)
            {
                renderBehaviours.Add(renderBehaviour);
                renderBehaviour.MeshChanged += RenderBehaviour_MeshChanged;
                if (renderBehaviour?.Mesh?.Data != null)
                {
                    RenderMeshBehaviour(renderBehaviour, transformBehaviour);
                }
                else
                {
                    SceneActor actor = new SceneActor(null, transformBehaviour);
                    for (int i = 0, l = viewports.Count; i < l; i++)
                    {
                        viewports[i].RenderActor(actor);
                    }
                }
            }
            else
            {
                DebugUtil.LogWithLocation($"No meshdata present for:{entity.Name} ");
                //No meshdata, lets show a dummy
                SceneActor actor = new SceneActor(null, transformBehaviour);
                for (int i = 0, l = viewports.Count; i < l; i++)
                {
                    viewports[i].RenderActor(actor);
                }
            }
        }
示例#33
0
        ///--------------------------------------------------------------------------------
        /// <summary>This method is used to copy/paste a new item.</summary>
        ///
        /// <param name="copyItem">The item to copy/paste.</param>
        /// <param name="savePaste">Flag to determine whether to save the results of the paste.</param>
        ///--------------------------------------------------------------------------------
        public FeatureViewModel PasteFeature(FeatureViewModel copyItem, bool savePaste = true)
        {
            Feature newItem = new Feature();

            newItem.ReverseInstance = new Feature();
            newItem.TransformDataFromObject(copyItem.Feature, null, false);
            newItem.FeatureID     = Guid.NewGuid();
            newItem.IsAutoUpdated = false;

            newItem.Solution = Solution;
            newItem.Solution = Solution;
            FeatureViewModel newView = new FeatureViewModel(newItem, Solution);

            newView.ResetModified(true);
            AddFeature(newView);

            // paste children
            List <EntityViewModel> entityViews = new List <EntityViewModel>();
            NameObjectCollection   copyViews   = new NameObjectCollection();

            foreach (EntityViewModel childView in copyItem.Entities)
            {
                EntityViewModel entityView = newView.PasteEntityBasicData(childView, savePaste);
                entityViews.Add(entityView);
                copyViews[entityView.WorkspaceID.ToString()] = childView;
            }
            foreach (EntityViewModel childView in entityViews)
            {
                newView.PasteEntityExtendedData(childView, copyViews[childView.WorkspaceID.ToString()] as EntityViewModel, savePaste);
            }
            if (savePaste == true)
            {
                Solution.FeatureList.Add(newItem);
                newView.OnUpdated(this, null);
                Solution.ResetModified(true);
            }
            return(newView);
        }
示例#34
0
        public async Task WriteDto_ExistingSolution_DataContract()
        {
            var msWorkspace = MSBuildWorkspace.Create();
            var solution    = msWorkspace.OpenSolutionAsync(this.TestSolution.FullName).Result;

            solution = solution.GetIsolatedSolution();

            var personClassDoc = solution.Projects
                                 .SelectMany(p => p.Documents)
                                 .Where(p => p.Name == "City.cs")
                                 .FirstOrDefault();

            var vm = await EntityViewModel.CreateRecursive(personClassDoc);

            vm.DtoName = "CityDTO";
            var dtoLocation = solution.GetMostLikelyDtoLocation();

            var modifiedSolution = await solution.WriteDto(dtoLocation, vm.ConvertToMetadata(), false, true);

            Assert.IsNotNull(modifiedSolution);

            var cityDto = modifiedSolution.GetChanges(solution)
                          .GetProjectChanges().Single()
                          .GetChangedDocuments()
                          .Select(p => modifiedSolution.GetProject(p.ProjectId).GetDocument(p))
                          .Where(p => p.Name == "CityDTO.cs")
                          .FirstOrDefault();

            Assert.IsNotNull(cityDto);

            var source = await cityDto.GetTextAsync();

            var sourceCode = source.ToString();

            Assert.IsTrue(sourceCode.Contains("[DataContract]"));
            Assert.IsTrue(sourceCode.Contains("[DataMember]"));
            Assert.IsTrue(sourceCode.Contains("using System.Runtime.Serialization;"));
        }
示例#35
0
        public void EntityEditModel_commits_changes_to_ViewModel()
        {
            // ARRANGE

            var model = new Entity("entity", new Tag("tag1", new Facet("f", new FacetProperty("p1"))));

            model.SetFacetProperty(model.Tags.Single().Facet.Properties.Single(), 1);

            var viewModel = new EntityViewModel(model, model.Tags.Single().ToViewModel());

            Entity committed = null;
            var    commitCB  = new Action <Entity>(e => committed = e);

            Entity reverted = null;
            var    revertCB = new Action <Entity>(e => reverted = e);

            var editModel = new EntityEditModel(viewModel, commitCB, revertCB);

            editModel.Name = "changed";
            editModel.Tags.Single().Properties.Single().Value = "changed";

            // ACT

            editModel.CommitCommand.Execute(null);

            // ASSERT

            Assert.Equal(model, committed);
            Assert.Null(reverted);

            Assert.Equal("changed", editModel.Name);
            Assert.Equal("changed", viewModel.Name);
            Assert.Equal("changed", model.Name);

            Assert.Equal("changed", editModel.Tags.Single().Properties.Single().Value);
            Assert.Equal("changed", viewModel.Tags.Single().Properties.Single().Value);
            Assert.Equal("changed", model.Values[model.Tags.Single().Facet.Properties.Single().Id.ToString()]);
        }
示例#36
0
 private void SetRawEntityAsSelectedItem(Entity entity)
 {
     //look through view models
     foreach (ISceneNode node in Items)
     {
         EntityViewModel entityVM = node as EntityViewModel;
         if (entityVM != null)
         {
             if (entityVM.EntitySource == entity)
             {
                 SelectedItem = entityVM;
                 break;
             }
             else
             {
                 if (LookForChildrenEntityVM(entityVM, entity))
                 {
                     break;
                 }
             }
         }
     }
 }
示例#37
0
        public void EntityViewModel_changes_Model()
        {
            // ARRANGE

            var tag1  = new Tag("tag1", new Facet("f", new FacetProperty("p1")));
            var tag2  = new Tag("tag2", new Facet("f", new FacetProperty("p2")));
            var model = new Entity("entity", tag1);

            model.SetFacetProperty(tag1.Facet.Properties.Single(), 1);

            var viewModel = new EntityViewModel(model, model.Tags.Single().ToViewModel());

            // ACT

            viewModel.Name = "changed";
            viewModel.Tags.Single().Properties.Single().Value = "changed";

            // ASSERT

            Assert.Equal("changed", viewModel.Name);
            Assert.Equal("changed", model.Name);
            Assert.Equal("changed", model.Values[tag1.Facet.Properties.Single().Id.ToString()]);
        }
示例#38
0
        public async Task EntityViewModel_GetRelatedEntity_FromTestSolution()
        {
            var msWorkspace = MSBuildWorkspace.Create();
            var solution    = msWorkspace.OpenSolutionAsync(this.TestSolution.FullName).Result;

            var personClassDoc = solution.Projects
                                 .SelectMany(p => p.Documents)
                                 .Where(p => p.Name == "Person.cs")
                                 .FirstOrDefault();

            var vm = await EntityViewModel.CreateRecursive(personClassDoc);

            var relatedEntity = vm.Properties
                                .Where(p => p.Name == "City")
                                .Select(p => p.RelatedEntity)
                                .Single();

            Assert.IsNotNull(relatedEntity);
            Assert.AreEqual("City", relatedEntity.EntityName);
            Assert.IsTrue(relatedEntity.Properties.Any(p => p.Name == "UniqueId"));

            msWorkspace.Dispose();
        }
        // [TypeFilter(typeof(AuthorizeAction), Arguments = new object[] { "Write" })]
        public IActionResult Update(long ID)
        {  // returns Update view
            EntityViewModel model = new EntityViewModel();

            InitAccessModel(model);
            model = _interface.GetData(ID);
            if (model != null)
            {
                // InitAccessModel(model);

                model.Country    = _interface.GetCountryList();
                model.State      = _interface.GetStateList(model.entity.CountryID);
                model.City       = _interface.GetCityList(model.entity.StateID);
                model.EntityType = _interface.GetEntityTypeList();
                model.Manager    = _interface.GetManagerList();
                return(View("Index", model));
            }
            else
            {
                resp.Message = "";
                return(Json(resp));
            }
        }
        ///--------------------------------------------------------------------------------
        /// <summary>This method creates an entity and adds to the view model.</summary>
        ///
        /// <param name="entity">The entity to add.</param>
        /// <param name="position">The desired position to place the entity.</param>
        ///--------------------------------------------------------------------------------
        public DiagramEntityViewModel CreateEntity(EntityViewModel entity, Point position)
        {
            // create diagram entity and add to solution diagram
            DiagramEntity dropDiagram = new DiagramEntity();

            dropDiagram.DiagramEntityID = Guid.NewGuid();
            DiagramEntityViewModel diagramEntity = new DiagramEntityViewModel(dropDiagram, entity, this);

            diagramEntity.X      = Math.Max(0, position.X);
            diagramEntity.Y      = Math.Max(0, position.Y);
            diagramEntity.Width  = Double.NaN;
            diagramEntity.Height = Double.NaN;
            DiagramEntities.Add(diagramEntity);
            Items.Add(diagramEntity);
            ClearSelectedItems();
            diagramEntity.IsSelected = true;
            diagramEntity.ZIndex     = ++ZIndex;

            // add to diagram entites to add list
            ItemsToAdd.Add(diagramEntity);
            Refresh(false);
            return(diagramEntity);
        }
示例#41
0
        private void myMap_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            e.Handled = true;
            // Creates a location for a single polygon point and adds it to
            // the polygon's point location list.
            Point mousePosition = e.GetPosition(myMap);

            //Convert the mouse coordinates to a location on the map
            Location location = myMap.ViewportPointToLocation(mousePosition);

            Image image = e.OriginalSource as Image;

            if (image != null)
            {
                string id;
                if (guids.TryGetValue(image, out id))
                {
                    EntityViewModel selected =
                        this.ViewModel.Entities.FirstOrDefault(s => s.Id == id);
                    this.ViewModel.SelectedItem = selected;
                }
            }
        }
示例#42
0
        public override string GetByColumnParameterQuery(EntityViewModel viewModel)
        {
            var sql        = new StringBuilder();
            var fieldsData = new StringBuilder();

            var fields =
                viewModel.Fields.Where(x => x.Type != "Single" && x.Type != "Multiple" && x.Type != "EntityName")
                .ToList();

            var last = fields.Last();

            foreach (var item in fields)
            {
                fieldsData.AppendFormat(item.Equals(last) ? "\"{0}\" " : "\"{0}\", ", item.ColumnName);
            }

            var whereString = GetWhereString(viewModel);

            //                paramsData.AppendFormat("AND {0} = @{0} ", param.Value);
            sql.AppendFormat("SELECT \"{0}\" FROM \"{1}\".\"{2}\" WHERE 1=1 {3}", fieldsData, viewModel.TableSchema,
                             viewModel.TableName, whereString);
            return(sql.ToString());
        }
        ///--------------------------------------------------------------------------------
        /// <summary>This method adds an entity to the view model.</summary>
        ///
        /// <param name="entity">The entity to add.</param>
        /// <param name="position">The desired position to place the entity.</param>
        ///--------------------------------------------------------------------------------
        public DiagramEntityViewModel AddEntity(EntityViewModel entity, Point position, bool isNewEntity = false)
        {
            DiagramEntity dropDiagram = new DiagramEntity();

            dropDiagram.DiagramID       = DiagramID;
            dropDiagram.DiagramEntityID = Guid.NewGuid();
            EntityViewModel        entityView    = entity;
            DiagramEntityViewModel diagramEntity = new DiagramEntityViewModel(dropDiagram, entityView, this);

            diagramEntity.X        = Math.Max(0, position.X);
            diagramEntity.Y        = Math.Max(0, position.Y);
            diagramEntity.Width    = Double.NaN;
            diagramEntity.Height   = Double.NaN;
            diagramEntity.Updated += new EventHandler(Children_Updated);
            diagramEntity.DiagramEntity.Entity = diagramEntity.EntityViewModel.Entity;
            diagramEntity.ResetModified(false);
            diagramEntity.EditDiagramEntity.ResetModified(false);
            if (isNewEntity == true)
            {
                AddDiagramEntity(diagramEntity);
            }
            else
            {
                DiagramEntities.Add(diagramEntity);
                Items.Add(diagramEntity);
            }
            ClearSelectedItems();
            diagramEntity.IsSelected = true;
            diagramEntity.ZIndex     = ++ZIndex;
            Entities.Remove(entity);
            EntitiesRemoved.Add(entity);
            diagramEntity.PositionChanged += new EventHandler(diagramEntity_PositionChanged);

            AddRelationships(diagramEntity);

            return(diagramEntity);
        }
示例#44
0
        ///--------------------------------------------------------------------------------
        /// <summary>This method updates an item of Entity.</summary>
        ///
        /// <param name="entity">The Entity to update.</param>
        ///--------------------------------------------------------------------------------
        public void UpdateEditEntity(Entity entity)
        {
            bool isItemMatch = false;

            foreach (EntityViewModel item in Entities)
            {
                if (item.Entity.EntityID == entity.EntityID)
                {
                    isItemMatch = true;
                    item.Entity.TransformDataFromObject(entity, null, false);
                    if (!item.Entity.BaseEntityID.IsNullOrEmpty())
                    {
                        item.Entity.BaseEntity = Solution.EntityList.FindByID((Guid)item.Entity.BaseEntityID);
                    }
                    item.OnUpdated(item, null);
                    item.ShowInTreeView();
                    break;
                }
            }
            if (isItemMatch == false)
            {
                // add new Entity
                entity.Feature = Feature;
                EntityViewModel newItem = new EntityViewModel(entity, Solution);
                if (!newItem.Entity.BaseEntityID.IsNullOrEmpty())
                {
                    newItem.Entity.BaseEntity = Solution.EntityList.FindByID((Guid)newItem.Entity.BaseEntityID);
                }
                newItem.Updated += new EventHandler(Children_Updated);
                Entities.Add(newItem);
                Feature.EntityList.Add(entity);
                Solution.EntityList.Add(newItem.Entity);
                Items.Add(newItem);
                OnUpdated(this, null);
                newItem.ShowInTreeView();
            }
        }
示例#45
0
        public IActionResult Edit(int?id)
        {
            var userID = User.FindFirstValue(ClaimTypes.NameIdentifier);

            if (id == null)
            {
                return(BadRequest());
            }

            //Make sure user owns vendor.
            if (!_vendorRepository.UserOwnsVendor((int)id, userID))
            {
                return(NotFound());
            }

            //Get the vendor data
            Vendor vendor = _vendorRepository.Get((int)id, userID);

            //Don't allow users to edit default vendors.
            if (!vendor.IsDefault)
            {
                //Convert DBVendor to VMVendor
                EntityViewModel vm = new EntityViewModel();
                vm.EntityOfInterest = new EntityViewModel.Entity
                {
                    EntityID    = vendor.VendorID,
                    Name        = vendor.Name,
                    IsDisplayed = vendor.IsDisplayed
                };

                return(View(vm));
            }

            TempData["BadMessage"] = "Adjustment of default vendor is not allow.";

            return(RedirectToAction("Index"));
        }
        public IActionResult Edit(int?id)
        {
            var userID = User.FindFirstValue(ClaimTypes.NameIdentifier);

            if (id == null)
            {
                return(BadRequest());
            }

            //Confirm the user owns the category
            if (!_categoryRepository.UserOwnsCategory((int)id, userID))
            {
                return(NotFound());
            }

            //Get the category data.
            Category category = _categoryRepository.Get((int)id, userID);

            //Don't allow users to edit a default category. Should be prevented by the UI, but confirming here.
            if (!category.IsDefault)
            {
                //Convert the DBCategory to VMCategory
                EntityViewModel vm = new EntityViewModel();
                vm.EntityOfInterest = new EntityViewModel.Entity
                {
                    EntityID    = category.CategoryID,
                    Name        = category.Name,
                    IsDisplayed = category.IsDisplayed
                };

                return(View(vm));
            }

            TempData["BadMessage"] = "Adjustment of default categories is not allowed.";

            return(RedirectToAction("Index"));
        }
示例#47
0
        public void UpdateNode(EntityViewModel node)
        {
            var drawingNode = this.Graph.FindNode(node.Model.Id.ToString());

            if (drawingNode is null)
            {
                return;
            }

            // update the underlying label
            drawingNode.Label.Text = node.Name;

            // remasure the node
            var tb = new TextBlock {
                Text = node.Name
            };

            tb.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));

            drawingNode.GeometryNode.BoundingBox = new GeometryRectangle(0, 0, tb.DesiredSize.Width, tb.DesiredSize.Height)
            {
                Center = drawingNode.GeometryNode.BoundingBox.Center
            };
        }
示例#48
0
        public override bool CanAddChildren(IReadOnlyCollection <object> children, AddChildModifiers modifiers, out string message)
        {
            EntityViewModel entity      = null;
            bool            singleChild = true;

            foreach (var child in children)
            {
                if (!singleChild)
                {
                    message = "Multiple entities selected";
                    return(false);
                }
                entity = child as EntityViewModel;
                if (entity == null)
                {
                    message = "The selection is not an entity";
                    return(false);
                }

                bool isCompatible = entity.AssetSideEntity.Components.Any(x => TargetNode.Type.IsInstanceOfType(x));
                if (!isCompatible)
                {
                    message = "The selected entity does not have the required component";
                    return(false);
                }

                singleChild = false;
            }
            if (entity == null)
            {
                message = "The selection is not an entity";
                return(false);
            }
            message = $"Reference {entity.Name}";
            return(true);
        }
示例#49
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);


            RequestWindowFeature(WindowFeatures.NoTitle);
            SetContentView(Resource.Layout.Main);
            EntityModel = new EntityViewModel();

            navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);
            toolbar        = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            Drawer         = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            RecyclerNav    = FindViewById <RecyclerView>(Resource.Id.recyclerNav);
            RecyclerNav.SetAdapter(new NavBarAdapter(SetNavList(), this));
            RecyclerNav.SetLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.Vertical, false));

            navigationView.NavigationItemSelected += NavigationView_NavigationItemSelected;


            SetSupportActionBar(toolbar);
            if (SupportActionBar != null)
            {
                SupportActionBar.SetDisplayHomeAsUpEnabled(true);
                SupportActionBar.SetDisplayShowTitleEnabled(false);
                SupportActionBar.SetHomeButtonEnabled(true);
                SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_action_menu);
            }
            // Set our view from the "main" layout resource

            if (FindViewById <FrameLayout>(Resource.Id.fragmentContainer).ChildCount <= 0)
            {
                FragmentTransaction transaction = FragmentManager.BeginTransaction();
                transaction.Replace(Resource.Id.fragmentContainer, FragmentHome.Get());
                transaction.Commit();
            }
        }
示例#50
0
        public ActionResult Index(long id, string pageUrl = "")
        {
            if (!meridian.hotelsStore.Exists(id))
                return HttpNotFound(HotelNotFoundMessage);

            var hotel = meridian.hotelsStore.Get(id);
            if (!hotel.is_published)
                return HttpNotFound(HotelNotFoundMessage);

            var model = new EntityViewModel
            {
                Title = hotel.title,
                FieldSet = hotel.GetFieldset(pageUrl),
                MenuLinks = hotel.GetMenuLinks(hotel.EntityUri().ToString(), pageUrl),
                Photos = hotel.GetPhotos(),
                Entity = hotel,
                EntityMap = hotel,
                ListImageUrl = Extensions.Extensions.ToAbsoluteUrl(hotel.GetListImage())
            };

            LastViewEntities.AddItemToLastViewed(hotel.ProtoName, hotel.id);

            return View(model);
        }
    public override void InitializeEntity(EntityViewModel viewModel) {
        base.InitializeEntity(viewModel);
		MainGameVM = uFrameKernel.Container.Resolve<MainGameRootViewModel>("MainGameRoot");
		//Debug.Log (MainGameVM== null ? "MainGameVM is null" : MainGameVM.Identifier);
	}
示例#52
0
        private int CompareEntityViewModel(EntityViewModel x, EntityViewModel y)
        {
            Debug.Assert(x != null, "x != null");
            Debug.Assert(y != null, "y != null");

            if (x.Source.Id == y.Source.Id) return 0;

            if (x.Source.Fansubs.Count > 0 && y.Source.Fansubs.Count > 0)
                return string.CompareOrdinal(x.Source.Fansubs[0], y.Source.Fansubs[0]);

            if (x.Source.Extension != y.Source.Extension)
                return string.CompareOrdinal(x.Source.Extension, y.Source.Extension);

            return -1;
        }
 //
 // GET: /CRM/HomeOfficeReports/
 public HomeOfficeReportsController(IUnitOfWork uow)
     : base(uow)
 {
     HomeOfficeReportsViewModel = new EntityViewModel<TBL_FRANCHISEE>();
     HomeOfficeReportsViewModel.BaseModel = this.BaseVM;
 }
示例#54
0
 public TreeViewModel(IPlatformEntity entity, bool showFiles)
 {
     var view = new EntityViewModel(null, entity, showFiles, true);
     entity.Tag = view;
     RootNodes = new ObservableCollection<IEntityViewModel> { view };
 }
示例#55
0
        public ActionResult SendOrderRequest(EntityViewModel entityViewModel)
        {
            var model = new OrderRequestViewModel
            {
                Id = entityViewModel.Entity.id,
                ProtoName = entityViewModel.Entity.ProtoName,
                FromDate = DateTime.Now.Date,
                ToDate = DateTime.Now.Date
            };

            return PartialView(model);
        }
示例#56
0
 void entity_OnEntityRemoved(object sender, EntityEventArgs e)
 {
     RemovedEVM = SubEntities.First((en) => en.Entity == e.Entity);
      SubEntities.Remove(RemovedEVM);
 }
 public virtual void ChangeBattleState(EntityViewModel viewModel) {
 }
 public virtual void InitializeEntity(EntityViewModel viewModel) {
     // This is called when a EntityViewModel is created
     viewModel.ChangeBattleState.Action = this.ChangeBattleStateHandler;
     viewModel.ChangeHealth.Action = this.ChangeHealthHandler;
     EntityViewModelManager.Add(viewModel);
 }
 public virtual void ChangeHealth(EntityViewModel viewModel) {
 }
示例#60
0
 public ActionResult Orders(string status, int? serviceType, int page = 1)
 {
     var orders = AdminService.GetAllOrders(serviceType, status);
     if (orders != null)
     {
         ViewBag.ServiceTypes = AdminService.GetAllServiceTypes();
         int pageSize = 10;
         PageInfo pageInfo = new PageInfo
         {
             PageNumber = page,
             TotalItems = orders.Count(),
             PageSize = pageSize,
         };
         var model = new EntityViewModel<OrderForAllList>
         {
             Items = orders.Skip((page - 1) * pageSize).Take(pageSize),
             PageInfo = pageInfo
         };
         if (Request.IsAjaxRequest())
         {
             ViewBag.ServiceType = serviceType;
             ViewBag.Status = status;
             return PartialView("PartialOrders", model);
         }
         else
         {
             return View(model);
         }
     }
     return View("Error");
 }