private void HealthChanged(EntityAttribute attribute) { if (attribute.Value <= 0) { collider.enabled = activeOnDeath; } }
private void UpdateHud() { if (this.character) { if (String.IsNullOrEmpty(this.txtName.text)) this.txtName.text = this.character.name; this.health = UpdateRangedField("hp", this.health, this.txtHP); this.mana = UpdateRangedField("mp", this.mana, this.txtMP); } }
private EntityAttribute UpdateRangedField(string name, EntityAttribute attribute, Text textField) { if (!attribute) { attribute = this.character.GetAttribute(name) as EntityAttribute; } if (attribute) { textField.text = attribute.Value + "/" + attribute.Max; } return attribute; }
protected override void Awake() { base.Awake(); agent.onAttributeInitialized.AddListener( attribute => { if (attribute.Alias.Equals("dmg")) { damage = attribute; } } ); }
public void SetEntityAttribute(EntityAttribute entityAttribute) { if (entityAttribute == null) { throw new ArgumentNullException(nameof(entityAttribute)); } var existingAttribute = EmployeeAttributes.FirstOrDefault(a => a.AttributeType.AttributeTypeCode == entityAttribute.AttributeType.AttributeTypeCode); if (existingAttribute != null) { EmployeeAttributes.Remove(existingAttribute); } EmployeeAttributes.Add(new EntityAttributeViewModel(entityAttribute)); }
public override EntityAttributes GetEntityAttributes() { var attributes = base.GetEntityAttributes(); attributes["minecraft:movement"] = new EntityAttribute { Name = "minecraft:movement", MinValue = 0, MaxValue = float.MaxValue, Value = (float)Speed }; return(attributes); }
public virtual void Hit(Entity entity, float damage) { if (Health.Max == 0) { return; } _lastTimeGettingHit = Game.ElapsedTime; Health -= damage; if (Health == 0) { Die(entity); } }
public virtual void RemoveAttributesByType(ENT_ATTR type) { for (int i = 0; i < attribList.Count; i++) { if (attribList[i].attr.type == type) { EntityAttribute rem = attribList[i].attr; Debug.Log("Removed " + rem.name); attribList.RemoveAt(i); rem.OnRemove(this); i--; } } }
public EntityAttributeViewModel(EntityAttribute entityAttribute) { if (entityAttribute == null) { throw new ArgumentNullException(nameof(entityAttribute)); } AttributeId = entityAttribute.AttributeId; EntityId = entityAttribute.EntityId; AttributeValue = entityAttribute.AttributeValue; AttributeDataType = entityAttribute.AttributeDataType; AttributeDisplayFormat = entityAttribute.AttributeDisplayFormat; EntityType = new EntityTypeViewModel(entityAttribute.EntityType); AttributeType = new AttributeTypeViewModel(entityAttribute.AttributeType); }
private List <EntityAttribute> GetAccountAttributes() { List <AttributeType> atttype_list = _type_service.GetAttributeTypeList(); var acct_atts = atttype_list.Where(item => item.AttributeTypeCategory == "Account").ToList(); var gcnt_atts = atttype_list.Where(item => item.AttributeTypeCategory == "General Contact").ToList(); var acnt_atts = atttype_list.Where(item => item.AttributeTypeCategory == "Account Contact").ToList(); var all_atts = acct_atts.Concat(gcnt_atts.Concat(acnt_atts)); List <EntityAttribute> available_attributes = new List <EntityAttribute>(); foreach (AttributeType attype in all_atts) { EntityAttribute ent_att = new EntityAttribute() { AttributeDataTypeKey = (int)attype.AttributeDataTypeKey, AttributeDisplayFormat = attype.AttributeDefaultFormat, AttributeKey = 0, AttributeType = (QIQOAttributeType)attype.AttributeTypeKey, AttributeValue = "", EntityKey = 0, EntityType = QIQOEntityType.Account, AttributeTypeData = attype, AttributeDataType = attype.AttributeDataTypeKey, EntityTypeData = new EntityType() }; if (ent_att.AttributeType == QIQOAttributeType.Account_ORDNUM & ent_att.AttributeValue == "") { ent_att.AttributeValue = "0"; } if (ent_att.AttributeType == QIQOAttributeType.Account_ORDNUMPAT & ent_att.AttributeValue == "") { ent_att.AttributeValue = ent_att.AttributeDisplayFormat; } if (ent_att.AttributeType == QIQOAttributeType.Account_INVNUM & ent_att.AttributeValue == "") { ent_att.AttributeValue = "0"; } if (ent_att.AttributeType == QIQOAttributeType.Account_INVNUMPAT & ent_att.AttributeValue == "") { ent_att.AttributeValue = ent_att.AttributeDisplayFormat; } available_attributes.Add(ent_att); } return(available_attributes); }
/// <summary> /// /// </summary> /// <param name="udfValue"></param> /// <param name="newValue"></param> /// <returns></returns> public static bool SetUdf(UDFValue udfValue, string newValue) { if (udfValue.TypedValueAttribute is StringAttribute) { logger.Trace("SetUdf: StringAttribute"); ((StringAttribute)udfValue.TypedValueAttribute).Value = newValue; } else if (udfValue.TypedValueAttribute is BoolAttribute) { logger.Trace("SetUdf: BoolAttribute"); BoolAttribute boolValue = (BoolAttribute)udfValue.TypedValueAttribute; if (string.IsNullOrEmpty(newValue) == false) { switch (newValue.ToUpperInvariant()) { case "TRUE": case "1": boolValue.Value = true; break; case "FALSE": case "0": boolValue.Value = false; break; default: logger.Error("SetUdf: Invalid boolean value {0} for UDF {1}.", newValue, udfValue.Field.Description); return(false); } } } else if (udfValue.TypedValueAttribute is EntityAttribute) { logger.Trace("SetUdf: EntityAttribute"); EntityAttribute entityValue = (EntityAttribute)udfValue.TypedValueAttribute; if (entityValue.FromString(newValue) == false) { logger.Error("SetUdf: Invalid lookup value {0} for UDF {1}.", newValue, udfValue.Field.Description); return(false); } } else { logger.Error("SetUdf: Unsupported UDF type {0} for UDF {1}.", udfValue.TypedValueAttribute, udfValue.Field.Description); return(false); } return(true); }
public virtual EntityAttributes GetEntityAttributes() { var attributes = new EntityAttributes(); attributes["minecraft:attack_damage"] = new EntityAttribute { Name = "minecraft:attack_damage", MinValue = 0, MaxValue = 16, Value = AttackDamage }; attributes["minecraft:absorption"] = new EntityAttribute { Name = "minecraft:absorption", MinValue = 0, MaxValue = float.MaxValue, Value = HealthManager.Absorption }; attributes["minecraft:health"] = new EntityAttribute { Name = "minecraft:health", MinValue = 0, MaxValue = HealthManager.MaxHearts, Value = HealthManager.Hearts }; attributes["minecraft:knockback_resistance"] = new EntityAttribute { Name = "minecraft:knockback_resistance", MinValue = 0, MaxValue = 1, Value = 0 }; attributes["minecraft:luck"] = new EntityAttribute { Name = "minecraft:luck", MinValue = -1025, MaxValue = 1024, Value = 0 }; attributes["minecraft:follow_range"] = new EntityAttribute { Name = "minecraft:follow_range", MinValue = 0, MaxValue = 2048, Value = 16 }; return(attributes); }
public int EntityAttributeUpdate(EntityAttribute attribute) { if (attribute == null) { throw new ArgumentNullException(nameof(attribute)); } return(ExecuteFaultHandledOperation(() => { var attrib = _ent_att_es.Map(attribute); attrib.AttributeKey = attribute.AttributeKey; return _attribute_repo.Insert(attrib); })); }
private void deleteAttributeButton_Click(object sender, EventArgs e) { if (attributesBindingSource.Current != null) { EntityAttribute attibue = attributesBindingSource.Current as EntityAttribute; if (attibue != null) { string message = "Do you confirm to delete this attribute?"; if (XtraMessageBox.Show(message, Properties.Resources.Katrin, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { _presenter.DeleteAttribute(attibue.AttributeId); } } } }
public void AddAttribute(int id) { EntityAttribute attribute = new EntityAttribute() { EntityId = id, Name = AttributeName, Value = AttributeValue }; AttributeName = string.Empty; AttributeValue = string.Empty; SQLiteHelper.Insert(attribute); ReadEntityAttributes(id); Status = "Attribute successfully inserted!"; }
public static string GetTableName(this Type tEntity) { string tableName = ""; EntityAttribute tableAttr = tEntity.GetCustomAttribute(typeof(EntityAttribute)) as EntityAttribute; if (tableAttr != null && tableAttr.TableName != null && tableAttr.TableName.Length > 0) { tableName = "[" + tableAttr.TableName + "]"; } else { tableName = "[" + tEntity.Name + "]"; } return(tableName); }
/// <summary> /// Строит структуру "хранилища данных" на основе классов, помеченных атрибутом EntityAttribute /// Для каждого класса, помеченного атрибутом EntityAttribute, создаётся список, в котором будут храниться экземпляры данного класса /// </summary> private void BuildStorage(bool ToContainsCache) { foreach (DBEntity entity in DBEntity.GetEntities()) { this.Storage.Add(entity, new List <DBObject>()); if (ToContainsCache) { EntityAttribute entityAttribute = entity.EntityType.GetAttribute <EntityAttribute>() as EntityAttribute; if (entityAttribute.IsIndependent) { this.Cache.Add(entity, new List <DBObject>()); } } } }
public IQueryable <T> IQueryable <T>(string sql) where T : class, new() { string tablename = EntityAttribute.GetEntityTable <T>(); using (var dbConnection = Connection) { var translateInfo = DatabaseCommon.GetTranslateValue <T>(); if (translateInfo.Count(x => x.Length > 0) > 0) { sql = DatabaseCommon.PottingSql <T>(translateInfo, sql, tablename); } var data = dbConnection.Query <T>(sql); return(data.AsQueryable()); } }
private void SetLookupValueText(object historyValue, AttributeLookupValue lookupValue, EntityAttribute displayAttribute, PropertyInfo originalValuePropertyInfo, object h) { Guid id; if (historyValue != null && Guid.TryParse(historyValue.ToString(), out id)) { var keyAttribute = lookupValue.Entity.Attributes.First(a => a.IsPKAttribute == true); var query = _objectSpace.GetObjectQuery(lookupValue.Entity.PhysicalName, null, null, true); var textQuery = query.Where(keyAttribute.PhysicalName + "=@0", id).Select(displayAttribute.PhysicalName); var displayText = textQuery._First(); originalValuePropertyInfo.SetValue(h, displayText, null); } }
/// <summary> Метод "Get" для свойств, имеющих тип DBObject[], которые содержут объекты, ссылающиеся на данный объект через связь "Многие-ко-многим" </summary> protected T[] GetBindedArrayPropertyValue <T>(DBEntity manyToManyEntity) where T : DBObject { EntityAttribute entityAttribute = manyToManyEntity.EntityType.GetAttribute <EntityAttribute>(); if (!entityAttribute.HasTypes(this.GetType(), typeof(T))) { throw new ArgumentException("Неверно указны обобщенный параметр или manyToManyEntity"); } PropertyInfo thisTypeProperty = manyToManyEntity.EntityType.GetProperty(this.GetType().Name); PropertyInfo otherTypeProperty = manyToManyEntity.EntityType.GetProperty(typeof(T).Name); return(this.DataStorage.GetDBObjects(manyToManyEntity) .Where(x => thisTypeProperty.GetValue(x, null) == this) .Select(x => otherTypeProperty.GetValue(x, null)).Cast <T>().ToArray()); }
/// <summary> /// 实体更新可用状态 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="entity"></param> /// <returns></returns> public void UpdateState <T>(int state, string key_value) { string tableName = EntityAttribute.GetEntityTable <T>(); string columName = DatabaseCommon.GetEnableColumn <T>(); string primaryKey = DatabaseCommon.GetKeyField <T>().ToString(); SqlParameter[] paramsMenber = { new SqlParameter("@TABLE", tableName), new SqlParameter("@COLUMN", columName), new SqlParameter("@STATE", state), new SqlParameter("@PRIMARYKEY", primaryKey), new SqlParameter("@KEY_VALUE", key_value) }; ExecuteByProcReturn("P_UPDATESTATE", paramsMenber); }
public bool EntityAttributeDelete(EntityAttribute attribute) { if (attribute == null) { throw new ArgumentNullException(nameof(attribute)); } return(ExecuteFaultHandledOperation(() => { var attrib = _ent_att_es.Map(attribute); attrib.AttributeKey = attribute.AttributeKey; _attribute_repo.Delete(attrib); return true; })); }
/// <summary> /// 経験値ゲージのゲージとレベルを設定します /// </summary> /// <param name="level"></param> /// <param name="progress"></param> protected void SetXpAndProgress(int?level, float?progress) { if (level != null) { EntityAttribute attribute = this.Attributes.GetAttribute(EntityAttribute.EXPERIENCE_LEVEL.Name); attribute.Value = (float)level; this.Attributes.SetAttribute(attribute); } if (progress != null) { EntityAttribute attribute = this.Attributes.GetAttribute(EntityAttribute.EXPERIENCE.Name); attribute.Value = (float)progress; this.Attributes.SetAttribute(attribute); } this.Attributes.Update(this); }
/// <summary> /// 拼接删除SQL语句 /// </summary> /// <param name="entity">实体类</param> /// <returns></returns> public static StringBuilder DeleteSql <T>(T entity) { Type type = entity.GetType(); PropertyInfo[] props = type.GetProperties(); StringBuilder sb = new StringBuilder("Delete From " + EntityAttribute.GetEntityTable <T>() + " Where 1=1"); foreach (PropertyInfo prop in props) { if (prop.GetValue(entity, null) != null) { sb.Append(" AND " + prop.Name + " = " + DbParameters.CreateDbParmCharacter() + "" + prop.Name + ""); } } return(sb); }
private static List <Guid> GetUserList(NotificationProfile config, Dictionary <string, object> variablesValues, Guid operatorUserId) { DbContext commonContext = DynamicModelBuilder.CreateDataSource(); List <Guid> userList = new List <Guid>(); List <NotificationRecipientAttribute> recipientConfigs = config.NotificationRecipientAttributes.ToList() as List <NotificationRecipientAttribute>; MetadataService client = new MetadataService(); foreach (NotificationRecipientAttribute reipientConfig in recipientConfigs) { FilterCriteriaHelper helper = new FilterCriteriaHelper(reipientConfig.RecipientEntityId ?? Guid.Empty, variablesValues); CriteriaOperator theOperator = helper.GeneratrCriteria(reipientConfig.Criterion); var filterEntiy = MetadataProvider.Instance.EntiyMetadata.Where(c => c.EntityId == reipientConfig.RecipientEntityId).First(); Type filterEntityType = DynamicTypeBuilder.Instance.GetDynamicType(filterEntiy.Name); IQueryable query = commonContext.Set(filterEntityType).AsQueryable(); System.Linq.Expressions.Expression exception = GetExpression(query, theOperator); query = query.Provider.CreateQuery(exception); IEnumerator iter = query.GetEnumerator(); EntityAttribute att = filterEntiy.Attributes.Where(c => c.AttributeId == reipientConfig.AttributeId).First(); while (iter.MoveNext()) { object userIdValue = GetPropertyValue(iter.Current, att.PhysicalName); if (userIdValue is Guid) { Guid userId = (Guid)GetPropertyValue(iter.Current, att.PhysicalName); if (!userList.Contains(userId) && userId != operatorUserId) { userList.Add(userId); } } } } if (config.Subscriptions != null) { foreach (var subscription in config.Subscriptions) { if (subscription.UserId != null && subscription.UserId != operatorUserId) { if (!userList.Contains((Guid)subscription.UserId)) { userList.Add((Guid)subscription.UserId); } } } } return(userList); }
public int Delete <T>(object[] keyValue) where T : class { DynamicParameters dynamicParameters = new global::Dapper.DynamicParameters(); string whereString = string.Empty; string keyString = EntityAttribute.GetEntityKey <T>(); for (int i = 0; i < keyValue.Length; i++) { string ParametersName = string.Format("@primarykey{0}", i); dynamicParameters.Add(ParametersName, keyValue[i]); whereString += string.Format("{0} {1} = {2}", i == 0 ? string.Empty : " OR ", keyString, ParametersName); } string deleteString = "Delete " + EntityAttribute.GetEntityTable <T>() + " where "; ExecuteBySql(string.Format("{0}{1}", deleteString, whereString), dynamicParameters); return(dbTransaction == null?Commit() : 0); }
public IEnumerable <T> FindList <T>(string orderField, bool isAsc, int pageSize, int pageIndex, out int total) where T : class, new() { using (var dbConnection = Connection) { StringBuilder sb = new StringBuilder(); int num = (pageIndex - 1) * pageSize; int num1 = pageIndex * pageSize; sb.Append("Select * From (Select ROW_NUMBER() Over ( order by " + orderField + ")"); sb.Append(" As rowNum, * From " + EntityAttribute.GetEntityTable <T>() + ") As N Where rowNum > " + num + " And rowNum <= " + num1 + ""); var dataQuery = dbConnection.Query <T>(sb.ToString()); total = Convert.ToInt32(new DbHelper(dbConnection).ExecuteScalar(CommandType.Text, "Select Count(1) From " + EntityAttribute.GetEntityTable <T>())); return(dataQuery.ToList()); } }
public T FindEntity <T>(object keyValue) where T : class { using (var dbConnection = Connection) { Type type = typeof(T); string viewName = ""; var viewAttribute = type.GetCustomAttributes(true).OfType <ViewAttribute>(); var descriptionAttributes = viewAttribute as ViewAttribute[] ?? viewAttribute.ToArray(); if (descriptionAttributes.Any()) { viewName = descriptionAttributes.ToList()[0].viewName; } string tableName = string.IsNullOrWhiteSpace(viewName) ? EntityAttribute.GetEntityTable <T>() : viewName; var data = dbConnection.Query <T>("select * from " + tableName + " where " + EntityAttribute.GetEntityKey <T>() + "=@key", new { key = keyValue.ToString() }); return(data.FirstOrDefault()); } }
public void SaveAttribute(EntityAttribute attribute, Relationship relationShip, bool isAdd) { attribute.EntityId = EntityId; attribute.LogicalName = attribute.Name; attribute.PhysicalName = attribute.TableColumnName; if (isAdd) { attribute.AttributeId = Guid.NewGuid(); } if (relationShip != null) { relationShip.RelationshipId = Guid.NewGuid(); relationShip.ReferencingEntityId = attribute.EntityId; relationShip.ReferencingAttributeId = attribute.AttributeId; } metadataServiceClient.SaveEntityAttribute(attribute, relationShip, isAdd); BindList(); }
/// <summary> /// 泛型方法,反射生成UpdateSql语句 /// </summary> /// <param name="entity">实体类</param> /// <returns>int</returns> public static StringBuilder UpdateNullSql <T>(T entity) { string pkName = GetKeyField <T>().ToString(); string[] EditColName = GetEditColArrName <T>(); Type type = entity.GetType(); PropertyInfo[] props = type.GetProperties(); StringBuilder sb = new StringBuilder(); sb.Append("Update "); sb.Append(EntityAttribute.GetEntityTable <T>()); sb.Append(" Set "); bool isFirstValue = true; foreach (PropertyInfo prop in props) { if ((prop.GetValue(entity, null) != null && pkName != prop.Name) || EditColName.Contains(prop.Name)) { string ColValue = Convert.ToString(type.GetProperty(prop.Name).GetValue(entity, null)); if (isFirstValue) { isFirstValue = false; } else { sb.Append(","); } if (string.IsNullOrWhiteSpace(ColValue) && EditColName.Contains(prop.Name)) { sb.Append(prop.Name); sb.Append("=null"); } else { sb.Append(prop.Name); sb.Append("="); sb.Append("'" + ColValue + "'"); } } } sb.Append(" Where ").Append(pkName).Append("=").Append("'" + Convert.ToString(type.GetProperty(pkName).GetValue(entity, null)) + "'"); return(sb); }
public virtual TL GetModel(IDataReader dr) { TL val = new TL(); PropertyInfo[] properties = EntityTypeCache.GetEntityInfo(typeof(TL)).Properties; PropertyInfo[] array = properties; foreach (PropertyInfo propertyInfo in array) { object[] customAttributes = propertyInfo.GetCustomAttributes(typeof(EntityAttribute), inherit: true); EntityAttribute entityAttribute = null; if (customAttributes.Length > 0) { entityAttribute = (EntityAttribute)customAttributes[0]; } if (entityAttribute != null && entityAttribute.CustomMember) { continue; } int ordinal; try { ordinal = dr.GetOrdinal(propertyInfo.Name); } catch (IndexOutOfRangeException) { continue; } object value; if (dr.IsDBNull(ordinal) && EntityHelper.GetDbType(propertyInfo.PropertyType) == DbType.String) { value = string.Empty; } else { if (dr.IsDBNull(ordinal)) { continue; } value = dr.GetValue(ordinal); } propertyInfo.SetValue(val, value, null); } return(val); }
public EntityInfo( AutumnDataSettings dataSettings, Type entityType, EntityAttribute entityAttribute, PropertyInfo keyInfo, PropertyInfo createdDateInfo, PropertyInfo lastModifiedDateInfo, PropertyInfo createdByInfo, PropertyInfo lastModifiedByInfo) { Settings = dataSettings ?? throw new ArgumentNullException(nameof(dataSettings)); EntityType = entityType ?? throw new ArgumentNullException(nameof(entityType)); Name = entityAttribute?.Name ?? entityType.Name; KeyInfo = keyInfo; CreatedDateInfo = createdDateInfo; LastModifiedDateInfo = lastModifiedDateInfo; CreatedByInfo = createdByInfo; LastModifiedByInfo = lastModifiedByInfo; }
public static EntityAttribute ToData(CdmEntityAttributeDefinition instance, ResolveOptions resOpt, CopyOptions options) { EntityAttribute obj = new EntityAttribute { Explanation = instance.Explanation, Name = instance.Name, IsPolymorphicSource = instance.IsPolymorphicSource, Entity = Utils.JsonForm(instance.Entity, resOpt, options), Purpose = Utils.JsonForm(instance.Purpose, resOpt, options), AppliedTraits = CopyDataUtils.ListCopyData(resOpt, instance.AppliedTraits? .Where(trait => trait is CdmTraitGroupReference || !(trait as CdmTraitReference).IsFromProperty), options), ResolutionGuidance = Utils.JsonForm(instance.ResolutionGuidance, resOpt, options), DisplayName = instance.GetProperty("displayName"), Description = instance.GetProperty("description"), Cardinality = Utils.CardinalitySettingsToData(instance.Cardinality) }; return(obj); }
protected override void Awake() { base.Awake(); if (!owner) { owner = GetComponentInParent<Entity>(); if (!owner) throw new System.InvalidOperationException("Attack handler needs an owner!"); } this.str = owner.GetAttribute("str") as EntityAttribute; if (!activeOnDeath) { EntityAttribute health = owner.GetAttribute("hp") as EntityAttribute; if (health) health.onValueChanged.AddListener(HealthChanged); } Ignore(owner.gameObject); onEnter.AddListener(DoCollide); }
public EntityAttributes ReadEntityAttributes() { var attributes = new EntityAttributes(); int count = ReadVarInt(); for (int i = 0; i < count; i++) { EntityAttribute attribute = new EntityAttribute { Name = ReadString(), MinValue = ReadFloat(), Value = ReadFloat(), MaxValue = ReadFloat(), }; attributes[attribute.Name] = attribute; } return(attributes); }
protected Entity(int health, float speed) { Speed = speed; Health = new EntityAttribute(health); Opacity = 0; }
public virtual void CheckHealth(EntityAttribute health) { if (!this.dead && health.Value <= 0) Die(); }
private void UpdateAttributeDisplay(EntityAttribute attribute) { var child = transform.FindChild(attribute.Alias); if (child) child.GetComponentInChildren<Text>().text = attribute.ToString(); }
public frmMain(InfoObject obj, EntityAttribute attr, String job) { this.Font = SystemFonts.MessageBoxFont; InitializeComponent(); this.DefGanttComparer = ucGantt1.gantt1.LayoutLogic.ItemComparer; SetFormFont(); MyJob = job; MyObj = obj; if (attr != null) MyAttr = attr.CollectionElements; ucGantt1.gantt1.Project.Text = (MyObj != null ? MyObj["TaskName"].ToString() : ""); if (MyJob != "Project") { // You want a readonly control ? ucGantt1.gantt1.AllowEdit = false; ucGantt1.ganttDataGrid1.AllowEdit = false; ucGantt1.ganttDataGrid1.SelectionMode = GanttDataGrid.GanttDataGridSelectionModes.Row; } ucGantt1.gantt1.SuspendItemLayout(); ucGantt1.ganttDataGrid1.SelectionMode = GanttDataGrid.GanttDataGridSelectionModes.Cell; ucGantt1.gantt1.ItemsChanged += new EventHandler(gantt1_ItemsChanged); ucGantt1.gantt1.SelectionChanged += new Gantt.SelectionChangedEventHandler(gantt1_SelectionChanged); ucGantt1.ganttDataGrid1.UpdateEditMenu += new EventHandler(ganttDataGrid1_UpdateEditMenu); ucGantt1.gantt1.ViewModeChanged += new EventHandler(gantt1_ViewModeChanged); ucGantt1.gantt1.ItemDoubleClick += new KS.Gantt.Gantt.ItemDoubleClickEventHandler(gantt1_ItemDoubleClick); ucGantt1.gantt1.ItemClick += new KS.Gantt.Gantt.ItemClickEventHandler(gantt1_ItemClick); ucGantt1.gantt1.BeforeDelete += new KS.Gantt.Gantt.BeforeDeleteEventHandler(gantt1_BeforeDelete); // ucGantt1.gantt1.Update += new da(gantt1_Updata); ucGantt1.gantt1.MovingItem += new KS.Gantt.Gantt.MovingItemEventHandler(gantt1_MovingItem); ucGantt1.gantt1.ItemsMoved += new EventHandler(gantt1_ItemsMoved); ucGantt1.gantt1.ItemsResized += new EventHandler(gantt1_ItemsResized); ucGantt1.gantt1.ItemHover += new KS.Gantt.Gantt.ItemHoverEventHandler(gantt1_ItemHover); ucGantt1.gantt1.AfterAddItem2Group += new Gantt.AfterAddItem2GroupEventHandler(gantt1_AfterAddItem2Group); SetGanttDefaults(); #region Настройка команд меню mnuSelectAll.Click += new EventHandler(mnuSelectAll_Click); mnuInverseSelection.Click += new EventHandler(mnuInverseSelection_Click); mnuCollapseGroups.Click += new EventHandler(mnuCollapseGroups_Click); mnuExpandGroups.Click += new EventHandler(mnuExpandGroups_Click); mnuUndo.Click += new EventHandler(mnuUndo_Click); mnuUndo1.Click += new EventHandler(mnuUndo_Click); mnuRedo.Click += new EventHandler(mnuRedo_Click); mnuRedo1.Click += new EventHandler(mnuRedo_Click); mnuCut.Click += new EventHandler(mnuCut_Click); mnuCopy.Click += new EventHandler(mnuCopy_Click); mnuPaste.Click += new EventHandler(mnuPaste_Click); mnuDelete.Click += new EventHandler(mnuDelete_Click); mnuTaskView.Click += new EventHandler(mnuTaskView_Click); mnuResourceView.Click += new EventHandler(mnuResourceView_Click); mnuExit.Click += new EventHandler(mnuExit_Click); mnuZoomToFit.Click += new EventHandler(mnuZoomToFit_Click); mnuCenterNow.Click += new EventHandler(mnuCenterNow_Click); mnuZoomIn.Click += new EventHandler(mnuZoomIn_Click); mnuZoomOut.Click += new EventHandler(mnuZoomOut_Click); mnuAddTask.Click += new EventHandler(mnuAddTask_Click); mnuAddTask1.Click += new EventHandler(mnuAddTask_Click); mnuAddGroup.Click += new EventHandler(mnuAddGroup_Click); mnuAddGroup1.Click += new EventHandler(mnuAddGroup_Click); mnuAddResource.Click += new EventHandler(mnuAddResource_Click); mnuAddResource1.Click += new EventHandler(mnuAddResource_Click); mnuNew1.Click += new EventHandler(mnuNew_Click); mnuNew.Click += new EventHandler(mnuNew_Click); mnuNewInstance.Click += new EventHandler(mnuNewInstance_Click); //mnuOpen1.Click += new EventHandler(mnuOpen_Click); //mnuOpen.Click += new EventHandler(mnuOpen_Click); mnuSave1.Click += new EventHandler(mnuSave_Click); mnuSave.Click += new EventHandler(mnuSave_Click); mnuSaveAs.Click += new EventHandler(mnuSaveAs_Click); mnuExportAsImage.Click += new EventHandler(mnuExportAsImage_Click); mnuExportAsXML.Click += new EventHandler(mnuExportAsXML_Click); mnuImportFromXML.Click += new EventHandler(mnuImportFromXML_Click); mnuPrintPageSetup.Click += new EventHandler(mnuPrintPageSetup_Click); mnuPrintPreview.Click += new EventHandler(mnuPrintPreview_Click); mnuPrint.Click += new EventHandler(mnuPrint_Click); mnuAbout.Click += new EventHandler(mnuAbout_Click); mnuAbout1.Click += new EventHandler(mnuAbout_Click); mnuHelpIndex.Click += new EventHandler(mnuHelpIndex_Click); mnuHelpIndex1.Click += new EventHandler(mnuHelpIndex_Click); mnuKrollSoftwareWebsite.Click += new EventHandler(mnuKrollSoftwareWebsite_Click); mnuProjectSettings.Click += new EventHandler(mnuProjectSettings_Click); mnuProjectSettings1.Click += new EventHandler(mnuProjectSettings_Click); mnuProjectCalendars.Click += new EventHandler(mnuProjectCalendars_Click); mnuProjectCalendars1.Click += new EventHandler(mnuProjectCalendars_Click); mnuProjectCost.Click += new EventHandler(mnuProjectCost_Click); mnuProjectCost1.Click += new EventHandler(mnuProjectCost_Click); mnuASAP.Click += new EventHandler(mnuASAP_Click); mnuASAP1.Click += new EventHandler(mnuASAP_Click); mnuSolve.Click += new EventHandler(mnuSolve_Click); mnuSolve1.Click += new EventHandler(mnuSolve_Click); mnuPathDimming.Click += new EventHandler(mnuPathDimming_Click); ucGantt1.gantt1.PathDimmingChanged += new EventHandler(gantt1_PathDimmingChanged); mnuMaxZoomLevelGranularity.Checked = true; mnuMaxZoomLevelGranularity.Click += new EventHandler(mnuMaxZoomLevelGranularity_Click); mnuMaxZoomLevelMinute.Click += new EventHandler(mnuMaxZoomLevelMinute_Click); ucGantt1.gantt1.MaxZoomLevelChanged += new EventHandler(gantt1_MaxZoomLevelChanged); ucGantt1.gantt1.GranularityChanged += new EventHandler(gantt1_GranularityChanged); mnuFind.Click += new EventHandler(mnuFind_Click); mnuFindMore.Click += new EventHandler(mnuFindMore_Click); mnuFind1.Click += new EventHandler(mnuFind_Click); mnuFindMore1.Click += new EventHandler(mnuFindMore_Click); #endregion ucGantt1.gantt1.ResetModified(); ucGantt1.gantt1.HistoryClear(); ucGantt1.gantt1.ResumeItemLayout(); ucGantt1.gantt1.HistoryChanged += new EventHandler(gantt1_HistoryChanged); ucGantt1.gantt1.ShowStatus += new Gantt.ShowStatusEventHandler(gantt1_ShowStatus); tabMain.SelectedIndexChanged += new EventHandler(tabMain_SelectedIndexChanged); SetUpContextMenu(); SetUpContextMenu4DataGrid(); // Test Topo ucGantt1.gantt1.CustomItemTextDisplay += new Gantt.ItemTextDisplayEventHandler(gantt1_CustomItemTextDisplay); this.KeyDown += new KeyEventHandler(frmMain_KeyDown); // *************** Load ****************** ucGantt1.parent = this; ucTasks1.GanttControl = ucGantt1.gantt1; ucTasks1.parent = this; ucResources1.GanttControl = ucGantt1.gantt1; ucGroups1.GanttControl = ucGantt1.gantt1; ucSkills1.GanttControl = ucGantt1.gantt1; ucSchedule1.GanttControl = ucGantt1.gantt1; ucGantt1.gantt1.UndoRedoCalled += new EventHandler(gantt1_UndoRedoCalled); ResetLanguageMenu(); CheckSelectedLanguageMenu(); // Set some language specific texts ucGantt1.gantt1.NewTaskName = Properties.Resources.NewTaskName; ucGantt1.gantt1.WeekPrefix = Properties.Resources.WeekPrefix; ucGantt1.gantt1.PathDimming = Strings.GetSafeBool(Program.GetMySetting("PathDimming", 1)); bool bMaxZoomLevelMinute = Strings.GetSafeBool(Program.GetMySetting("MaxZoomLevelMinute", 1)); if (bMaxZoomLevelMinute) ucGantt1.gantt1.MaxZoomLevel = Gantt.ZoomLevels.Minute; else ucGantt1.gantt1.MaxZoomLevel = Gantt.ZoomLevels.Granularity; KS.Gantt.Helpers.DialogTitle = Program.DialogTitle; // MRU FileList mruManager = new MRUManager(); mruManager.Initialize( this, // owner form mnuFileMRU, // Recent Files menu item Program.C_RegistrySectionKey); // Registry path to keep MRU list // Optional. Call these functions to change default values: //mruManager.CurrentDir = "....."; // default is current directory mruManager.MaxMRULength = 7; // default is 10 mruManager.MaxDisplayNameLength = 60; // default is 40 #region Some Shortcuts // Setting Shortcut Keys by resource, throws errors in different Visual-Studio language versions. // This is, why we set them by code mnuNew.ShortcutKeys = Keys.N | Keys.Control; mnuNewInstance.ShortcutKeys = Keys.N | Keys.Control | Keys.Alt; mnuOpen.ShortcutKeys = Keys.O | Keys.Control; mnuSave.ShortcutKeys = Keys.S | Keys.Control; mnuSaveAs.ShortcutKeys = Keys.S | Keys.Control | Keys.Alt; mnuPrint.ShortcutKeys = Keys.P | Keys.Control; mnuTaskView.ShortcutKeys = Keys.T | Keys.Control; mnuResourceView.ShortcutKeys = Keys.R | Keys.Control; mnuZoomToFit.ShortcutKeys = Keys.M | Keys.Control; mnuCenterNow.ShortcutKeys = Keys.M | Keys.Alt; mnuSelectAll.ShortcutKeys = Keys.A | Keys.Control; mnuUndo.ShortcutKeys = Keys.Z | Keys.Control; mnuRedo.ShortcutKeys = Keys.Y | Keys.Control; mnuDelete.ShortcutKeys = Keys.Delete; mnuCut.ShortcutKeys = Keys.X | Keys.Control; mnuCopy.ShortcutKeys = Keys.C | Keys.Control; mnuPaste.ShortcutKeys = Keys.V | Keys.Control; mnuFind.ShortcutKeys = Keys.F | Keys.Control; mnuASAP.ShortcutKeys = Keys.L | Keys.Control; mnuExpandGroups.ShortcutKeys = Keys.Oemplus | Keys.Control; mnuCollapseGroups.ShortcutKeys = Keys.OemMinus | Keys.Control; mnuExpandGroups.ShortcutKeyDisplayString = "Ctrl + Plus"; mnuCollapseGroups.ShortcutKeyDisplayString = "Ctrl + Minus"; #endregion InstHelperPLM = new HelperPLM(this.MyObj, ucGantt1.gantt1); }
/// <summary> /// Der Haupteinstiegspunkt für die Anwendung. /// </summary> static public void main(InfoObject obj, EntityAttribute attr, String job) { CursorWait(); // var fontMenu = SystemFonts.MenuFont; // var fontCaption = SystemFonts.CaptionFont; // var fontDialog = SystemFonts.DialogFont; // var fontMessageBox = SystemFonts.MessageBoxFont; // var fontSmallCaptionFont = SystemFonts.SmallCaptionFont; // var fontStatusFont = SystemFonts.StatusFont; // Fonts.SystemFontFamilies StartUpUICulture = System.Threading.Thread.CurrentThread.CurrentUICulture; string strGUILanguage = KS.Common.Strings.GetSafeString(GetMySetting("GUILanguage", "")); switch (strGUILanguage) { case "de": System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("de-DE"); break; case "en": System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US"); break; case "fr": System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("fr-FR"); break; case "it": System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("it-IT"); break; case "es": System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("es-ES"); break; case "ru": System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("ru-RU"); break; case "zh": //System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-CHS"); System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-CN"); break; default: if (System.Threading.Thread.CurrentThread.CurrentUICulture.Name.StartsWith("de")) System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("de-DE"); else if (System.Threading.Thread.CurrentThread.CurrentUICulture.Name.StartsWith("fr")) System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("fr-FR"); else if (System.Threading.Thread.CurrentThread.CurrentUICulture.Name.StartsWith("it")) System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("it-IT"); else if (System.Threading.Thread.CurrentThread.CurrentUICulture.Name.StartsWith("es")) System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("es-ES"); else if (System.Threading.Thread.CurrentThread.CurrentUICulture.Name.StartsWith("ru")) System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("ru-RU"); else if (System.Threading.Thread.CurrentThread.CurrentUICulture.Name.StartsWith("zh")) //System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-CHS"); System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-CN"); else System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US"); break; } fMainForm = new frmMain(obj, attr, job); FilterByResponce.ClearFilter(); fMainForm.ucGantt1.gantt1.StartDate = DateTime.Now.AddMonths(0); // Установка параметров KS.Gantt.Gantt fMainForm.SetGanttProperties(); // Установка параметров PLM fMainForm.SetPlmProperties(); // Подготовка, соддание данных и создания диаграммы Ганта fMainForm.GenerationGanttData(); fMainForm.toolStrip1.Font = fMainForm.ucGantt1.gantt1.Font; fMainForm.Show(); }