/// <summary>
        /// Called when the service is started.
        /// </summary>
        protected void OnStart(string[] args)
        {
            try
            {
                Thread serviceThread = new Thread(new ParameterizedThreadStart(StartAsync));

                ManualResetEvent serviceStarting = new ManualResetEvent(false);
                serviceThread.Start(serviceStarting);
                serviceStarting.WaitOne();
                serviceStarting.Close();

                foreach (ScheduleBase schedule in ScheduleManager.GetSchedules())
                {
                    schedule.Settings.LastElapsed = new DateTime(0);

                    ObjectHelper wrapper = new ObjectHelper(schedule);

                    if (wrapper.HasProperty("TimeOfDay"))
                    {
                        wrapper.SetValue("TimeOfDay", DateTime.Now.TimeOfDay);
                    }

                    if (wrapper.HasProperty("DayOfMonth"))
                    {
                        wrapper.SetValue("DayOfMonth", DayOfMonth.AllDays);
                    }
                }

            }
            catch (ThreadAbortException)
            {
                // do nothing.
            }
        }
Exemple #2
0
	void OnEnable() {
		root = null;
		//Get path
#if UNITY_3_0 || UNITY_3_0_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5
		//Unity 3 path stuff?
#else
		string scriptPath = AssetDatabase.GetAssetPath(MonoScript.FromScriptableObject(this));
		UniMergeConfig.DEFAULT_PATH = scriptPath.Substring(0, scriptPath.IndexOf("Editor") - 1);
#endif

		//Component filters
#if UNITY_3_0 || UNITY_3_0_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5
		assemblies = System.AppDomain.CurrentDomain.GetAssemblies();
		//NB: For some reason, after a compile, filters starts out as "", though the field retains the value.  Then when it's modified the string is set... as a result sometime you see filter text with nothing being filtered
		ParseFilters();
#else
		var subclasses =
		from assembly in System.AppDomain.CurrentDomain.GetAssemblies()
		from type in assembly.GetTypes()
		where type.IsSubclassOf(typeof(Component))
		select type;
		List<List<string>> compTypeStrs = new List<List<string>> {new List<string>()};
		List<List<System.Type>> compTypes = new List<List<System.Type>> {new List<System.Type>()};
		int setCount = 0;
		foreach(System.Type t in subclasses) {
			if(compTypes[setCount].Count == 31) {
				setCount++;
				compTypeStrs.Add(new List<string>());
				compTypes.Add(new List<System.Type>());
			}
			compTypeStrs[setCount].Add(t.Name);
			compTypes[setCount].Add(t);
		}
		componentTypes = new System.Type[setCount + 1][];
		componentTypeStrings = new string[setCount + 1][];
		typeMask = new int[setCount + 1];
		for(int i = 0; i < setCount + 1; i++) {
			typeMask[i] = -1;
			componentTypes[i] = compTypes[i].ToArray();
			componentTypeStrings[i] = compTypeStrs[i].ToArray();
		}
#endif
#if DEV
		mine = GameObject.Find(mineDemoName);
		theirs = GameObject.Find(theirsDemoName);
#endif
		SkinSetUp = false;
	}
Exemple #3
0
 public static List <ContactInfo> GetBC03(DateTime from, DateTime to)
 {
     return(ObjectHelper.FillCollection <ContactInfo>(DataProvider.Instance().Contacts_GetBC03(from, to)));
 }
Exemple #4
0
 public static List <ReportBC47Info> GetBC47(string name, string phone, string email, string userids, string listedprice, int sourcetype, DateTime?datewanttolearn, DateTime?handoverfromadvisor, DateTime?handovertoadvisor)
 {
     return(ObjectHelper.FillCollection <ReportBC47Info>(DataProvider.Instance().Contacts_GetBC47(name, phone, email, userids, listedprice, sourcetype, datewanttolearn, handoverfromadvisor, handovertoadvisor)));
 }
Exemple #5
0
 public static List <ContactInfo> GetBC45(DateTime?handoverFromDate, DateTime?handoverToDate, DateTime?registerFromDate, DateTime?registerToDate, int channelId, int templateAdsId)
 {
     return(ObjectHelper.FillCollection <ContactInfo>(DataProvider.Instance().Contacts_GetBC45(handoverFromDate, handoverToDate, registerFromDate, registerToDate, channelId, templateAdsId)));
 }
Exemple #6
0
 public static List <ContactInfo> GetBC44(int statusId, int branchId, string userIds, int statusMapId, int statusCareId, string levels, DateTime?handoverFromDate, DateTime?handoverToDate, DateTime?callFromDate, DateTime?callToDate, int qualityId, int productSellId, int sourceType, EmployeeType employeeType)
 {
     return(ObjectHelper.FillCollection <ContactInfo>(DataProvider.Instance().Contacts_GetBC44(statusId, branchId, userIds, statusMapId, statusCareId, levels, handoverFromDate, handoverToDate, callFromDate, callToDate, qualityId, productSellId, sourceType, employeeType)));
 }
Exemple #7
0
 public static List <ContactInfo> GetAll_ForRedis()
 {
     return(ObjectHelper.FillCollection <ContactInfo>(DataProvider.Instance().Contacts_GetAll_ForRedis()));
 }
Exemple #8
0
 public override void Init(ObjectData data)
 {
     byte[] artfile = ObjectHelper.OpenArtFile("../artnem/Rings.bin", CompressionType.Nemesis);
     img = ObjectHelper.MapASMToBmp(artfile, data.CustomProperties.GetValueOrDefault("revision", "0") == "1" ? "../_maps/Rings (JP1).asm" : "../_maps/Rings.asm", 0, 1);
 }
 public static List <EducationLevelInfo> GetAll()
 {
     return(ObjectHelper.FillCollection <EducationLevelInfo>(DataProvider.Instance().EducationLevels_GetAll()));
 }
 public static EducationLevelInfo GetInfo(int educationLevelId)
 {
     return(ObjectHelper.FillObject <EducationLevelInfo>(DataProvider.Instance().EducationLevels_GetInfo(educationLevelId)));
 }
Exemple #11
0
        /// <summary>
        /// Indexes the catalog entry dto.
        /// </summary>
        /// <param name="indexer">The indexer.</param>
        /// <param name="entryRow">The entry row.</param>
        /// <param name="defaultCurrency">The default currency.</param>
        /// <param name="languages">The languages.</param>
        /// <returns></returns>
        private int IndexCatalogEntryDto(IndexBuilder indexer, CatalogEntryDto.CatalogEntryRow entryRow, string defaultCurrency, string[] languages)
        {
            int indexCounter = 0;

            CatalogContext.MetaDataContext.UseCurrentUICulture = false;

            // Import categories
            CatalogRelationDto relationDto = CatalogContext.Current.GetCatalogRelationDto(0, 0, entryRow.CatalogEntryId, "", new CatalogRelationResponseGroup(CatalogRelationResponseGroup.ResponseGroup.NodeEntry));

            foreach (string language in languages)
            {
                Document doc = new Document();

                // Add constant fields
                doc.Add(new Field("_id", entryRow.CatalogEntryId.ToString(), Field.Store.YES, Field.Index.UN_TOKENIZED));
                doc.Add(new Field("Code", entryRow.Code, Field.Store.YES, Field.Index.UN_TOKENIZED));
                doc.Add(new Field("_content", entryRow.Code, Field.Store.NO, Field.Index.TOKENIZED));
                doc.Add(new Field("Name", entryRow.Name, Field.Store.YES, Field.Index.TOKENIZED));
                doc.Add(new Field("_content", entryRow.Name, Field.Store.NO, Field.Index.TOKENIZED));
                doc.Add(new Field("_lang", language, Field.Store.YES, Field.Index.UN_TOKENIZED));
                doc.Add(new Field("StartDate", entryRow.StartDate.ToString("s"), Field.Store.YES, Field.Index.UN_TOKENIZED));
                doc.Add(new Field("EndDate", entryRow.EndDate.ToString("s"), Field.Store.YES, Field.Index.UN_TOKENIZED));
                doc.Add(new Field("_classtype", entryRow.ClassTypeId, Field.Store.YES, Field.Index.UN_TOKENIZED));
                AddPriceFields(doc, entryRow, defaultCurrency);

                bool sortOrderAdded = false;
                foreach (CatalogRelationDto.NodeEntryRelationRow relation in relationDto.NodeEntryRelation)
                {
                    CatalogDto catalogDto  = CatalogContext.Current.GetCatalogDto(relation.CatalogId);
                    string     catalogName = String.Empty;
                    if (catalogDto != null && catalogDto.Catalog != null && catalogDto.Catalog.Count > 0)
                    {
                        catalogName = catalogDto.Catalog[0].Name;
                    }
                    else
                    {
                        continue;
                    }

                    CatalogNodeDto catalogNodeDto  = CatalogContext.Current.GetCatalogNodeDto(relation.CatalogNodeId);
                    string         catalogNodeCode = String.Empty;
                    if (catalogNodeDto != null && catalogNodeDto.CatalogNode != null && catalogNodeDto.CatalogNode.Count > 0)
                    {
                        catalogNodeCode = catalogNodeDto.CatalogNode[0].Code;
                    }
                    else
                    {
                        continue;
                    }

                    BuildPath(doc, catalogDto, catalogNodeDto, 0);

                    /*
                     * BuildPath(doc, entryRow.CatalogId, relation.CatalogNodeId);
                     * string path = BuildPath(entryRow.CatalogId, relation.CatalogNodeId);
                     * doc.Add(new Field(String.Format("_outline"), path, Field.Store.YES, Field.Index.UN_TOKENIZED));
                     * */
                    doc.Add(new Field(String.Format("_sortorder-{0}-{1}", catalogName, catalogNodeCode), relation.SortOrder.ToString(), Field.Store.YES, Field.Index.UN_TOKENIZED));
                    if (!sortOrderAdded && entryRow.CatalogId == relation.CatalogId) // add default sort order, which will be the first node added in the default catalog
                    {
                        doc.Add(new Field(String.Format("_sortorder"), relation.SortOrder.ToString(), Field.Store.YES, Field.Index.UN_TOKENIZED));
                        sortOrderAdded = true;
                    }
                }

                CatalogContext.MetaDataContext.Language = language;

                if (entryRow.MetaClassId != 0)
                {
                    // load list of MetaFields for MetaClass
                    MetaClass metaClass = MetaHelper.LoadMetaClassCached(CatalogContext.MetaDataContext, entryRow.MetaClassId);

                    if (metaClass != null)
                    {
                        MetaFieldCollection mfs = metaClass.MetaFields;
                        if (mfs != null)
                        {
                            //MetaObject metaObj = null;
                            //metaObj = MetaObject.Load(CatalogContext.MetaDataContext, entryRow.CatalogEntryId, entryRow.MetaClassId);

                            Hashtable hash = ObjectHelper.GetMetaFieldValues(entryRow);

                            if (hash != null)
                            {
                                foreach (MetaField field in mfs)
                                {
                                    AddField(doc, field, hash);
                                }
                            }
                        }
                    }

                    doc.Add(new Field("_metaclass", metaClass.Name, Field.Store.YES, Field.Index.UN_TOKENIZED));
                }
                indexer.AddDocument(doc);

                indexCounter++;
            }

            CatalogContext.MetaDataContext.UseCurrentUICulture = true;
            return(indexCounter);
        }
Exemple #12
0
 public override void Init(ObjectData data)
 {
     byte[] artfile = ObjectHelper.OpenArtFile("../art/nemesis/EHZ bridge.nem", CompressionType.Nemesis);
     byte[] mapfile = System.IO.File.ReadAllBytes("../mappings/sprite/obj11_b.bin");
     img = ObjectHelper.MapToBmp(artfile, mapfile, 0, 2);
 }
Exemple #13
0
        /// <summary>
        /// Sets the property value.
        /// </summary>
        /// <param name="propertyName">Name of the property.</param>
        /// <param name="value">The value.</param>
        /// <exception cref="ArgumentException">The <paramref name="propertyName" /> is <c>null</c> or whitespace.</exception>
        public void SetPropertyValue(string propertyName, object value)
        {
            Argument.IsNotNullOrWhitespace("propertyName", propertyName);

            var raisePropertyChanged = false;

            lock (_lockObject)
            {
                if (!_properties.TryGetValue(propertyName, out var propertyValue) || !ObjectHelper.AreEqualReferences(propertyValue, value))
                {
                    _properties[propertyName] = value;
                    raisePropertyChanged      = true;
                }
            }

            if (raisePropertyChanged)
            {
                RaisePropertyChanged(propertyName);
            }
        }
Exemple #14
0
        public override bool Submit()
        {
            WorkflowStep firstWorkflowStepItem = GetFirstWorkflowStep();

            if (firstWorkflowStepItem == null)
            {
                throw new Exception(StringMessages.TheFirstStepOfWorkflowIsNotExisted);
            }

            LookupItem nextStepLookupItem = firstWorkflowStepItem.NextStep;

            if (nextStepLookupItem != null)
            {
                WorkflowStep nextFirstWorkflowStepItem = FindNextWorkflowStepItemByCurrentStep(nextStepLookupItem);

                if (nextFirstWorkflowStepItem == null)
                {
                    throw new Exception(StringMessages.TheNextStepOfWorkflowIsNotExisted);
                }

                // Set Creator
                this.CurrentItem[ApprovalFields.Creator] = this.CurrentEmployee.ID;
                // Set CurrentStep
                CurrentItem[ApprovalFields.CurrentStep] = nextStepLookupItem.LookupId;
                #region Set NextStep
                //if (nextFirstWorkflowStepItem.NextStep != null)
                //{
                //    currentItem[ApprovalFields.NextStep] = nextFirstWorkflowStepItem.NextStep.LookupId;
                //}
                #endregion
                #region Set Approvers
                List <EmployeeInfo>          employeeInfos = GetListOfEmployeesByPosition(nextStepLookupItem);
                SPFieldLookupValueCollection employees     = ConvertToSPFieldLookupValueCollection(employeeInfos);
                CurrentItem[ApprovalFields.PendingAt] = employees;
                #endregion
                // Set Status
                CurrentItem[ApprovalFields.Status] = Status.Submitted;
                // Set WFStatus
                CurrentItem[ApprovalFields.WFStatus] = StringConstant.ApprovalStatus.InProgress;
                // Set Location
                CurrentItem[ApprovalFields.CommonLocation] = this.CurrentLocation;
                // Set Department
                CurrentItem[ApprovalFields.CommonDepartment] = this.CurrentDepartment;
                //// Set additional step for current item
                //SetAdditionalStepForCurrentItem();
                // Save current item
                CurrentItem.Update();

                #region Prepareration for sending email

                // Add approvers into list of email To.
                ListOfEmployeesEmailTo.AddRange(employeeInfos);

                // Get list of delegated employee
                var delegatedEmployees = GetListOfDelegatedEmployees(employeeInfos);
                if (delegatedEmployees != null && delegatedEmployees.Count > 0)
                {
                    ListOfEmployeesEmailTo.AddRange(delegatedEmployees);
                }

                SetListOfEmployeesToSendEmailToAndCc(firstWorkflowStepItem);

                #endregion
            }
            else // Truong hop Truong Phong submit neu khong len BOD thi chuyen cho Truong Phong Thuc Hien
            {
                // Set Creator
                this.CurrentItem[ApprovalFields.Creator] = this.CurrentEmployee.ID;
                // Set Location
                CurrentItem[ApprovalFields.CommonLocation] = this.CurrentLocation;
                // Set Department
                CurrentItem[ApprovalFields.CommonDepartment] = this.CurrentDepartment;
                int currentLocationId = 0;
                int additionalApprovalDepartmentId       = 0;
                int additionalApprovalPositionId         = GetDEHPositionId(); // DEH;
                SPFieldLookupValue receivedByLookupValue = ObjectHelper.GetSPFieldLookupValue(this.CurrentItem[StringConstant.RequestsList.ReceviedByField]);
                SPFieldLookupValue locationLookupValue   = ObjectHelper.GetSPFieldLookupValue(this.CurrentItem[ApprovalFields.CommonLocation]);
                if (locationLookupValue != null)
                {
                    currentLocationId = locationLookupValue.LookupId;
                }
                this.CurrentItem[ApprovalFields.IsAdditionalStep]       = true;
                this.CurrentItem[ApprovalFields.AdditionalPreviousStep] = this.CurrentItem[ApprovalFields.CurrentStep];
                this.CurrentItem[ApprovalFields.AdditionalStep]         = additionalApprovalPositionId; // DEH
                if (receivedByLookupValue != null)
                {
                    additionalApprovalDepartmentId = receivedByLookupValue.LookupId;
                    this.CurrentItem[ApprovalFields.AdditionalDepartment] = additionalApprovalDepartmentId;
                }

                List <EmployeeInfo> listOfEmployees = GetListOfEmployees(currentLocationId, additionalApprovalDepartmentId, additionalApprovalPositionId);
                if (listOfEmployees != null && listOfEmployees.Count > 0)
                {
                    this.PendingAtEmployees = listOfEmployees.ToSPFieldLookupValueCollection();
                    this.ListOfEmployeesEmailTo.AddRange(listOfEmployees);
                }
                // Set PendingAt
                this.CurrentItem[ApprovalFields.PendingAt] = this.PendingAtEmployees;

                // Set Status
                this.CurrentItem[ApprovalFields.Status] = string.Format("{0} {1}", this.CurrentEmployee.EmployeePosition.LookupValue, Status.Approved);

                // Set WFStauts
                this.CurrentItem[ApprovalFields.WFStatus] = StringConstant.ApprovalStatus.InProgress;
                this.IsWorkflowCompleted = false;

                this.CurrentItem.Update();
            }

            return(true);
        }
Exemple #15
0
        /// <summary>
        /// Approve
        /// </summary>
        /// <returns></returns>
        public override bool Approve()
        {
            bool res = false;

            try
            {
                #region DEL 2017.07.25.14.25
                //SPFieldLookupValue currentStep = ObjectHelper.GetSPFieldLookupValue(this.CurrentItem[ApprovalFields.CurrentStep]);
                //SPFieldLookupValue additionalPreviousStep = ObjectHelper.GetSPFieldLookupValue(this.CurrentItem[ApprovalFields.AdditionalPrevisousStep]);

                //if (currentStep != null && additionalPreviousStep != null)
                //{
                //    // CurrentStep == AdditionalPrevisousStep
                //    if (currentStep.LookupId == additionalPreviousStep.LookupId)
                //    {
                //        SPFieldLookupValue additionalStep = ObjectHelper.GetSPFieldLookupValue(this.CurrentItem[ApprovalFields.AdditionalStep]);
                //        if (additionalStep != null)
                //        {
                //            this.CurrentItem[ApprovalFields.IsAdditionalStep] = true;
                //            this.CurrentItem[ApprovalFields.NextStep] = additionalStep;
                //        }
                //        else
                //        {
                //            throw new Exception(StringMessages.TheAdditionalStepWasNotFound);
                //        }
                //    }
                //}
                #endregion

                #region M 2017.08.14. Fix bug workflow.

                #region DEL 2017.08.14
                //// Trưởng phòng thực hiện duyệt sau bước BOD
                //// SPFieldLookupValue currentStep = ObjectHelper.GetSPFieldLookupValue(this.CurrentItem[ApprovalFields.CurrentStep]);
                //SPFieldLookupValue nextStep = ObjectHelper.GetSPFieldLookupValue(this.CurrentItem[ApprovalFields.NextStep]);
                //SPFieldLookupValue additionalPreviousStep = ObjectHelper.GetSPFieldLookupValue(this.CurrentItem[ApprovalFields.AdditionalPreviousStep]);
                //SPFieldLookupValue additionalStep = ObjectHelper.GetSPFieldLookupValue(this.CurrentItem[ApprovalFields.AdditionalStep]);
                //SPFieldLookupValue additionalDepartment = ObjectHelper.GetSPFieldLookupValue(this.CurrentItem[ApprovalFields.AdditionalDepartment]);
                ////if ((string.Compare(currentStep.LookupValue, EmployeePosition_BOD_CODE, true) == 0) && (nextStep == null))
                //// Neu ket thuc qui trinh thi chuyen cho Truong Bo Phan xu ly buoc ke tiep. (Neu next step bang NULL va Khong co
                //if (nextStep == null && additionalPreviousStep == null && additionalStep == null && additionalDepartment == null)
                //{
                //    this.CurrentItem[ApprovalFields.IsAdditionalStep] = true;
                //    this.CurrentItem[ApprovalFields.AdditionalPreviousStep] = this.CurrentItem[ApprovalFields.CurrentStep];
                //    this.CurrentItem[ApprovalFields.AdditionalStep] = GetDEHPositionId(); // DEH
                //    this.CurrentItem[ApprovalFields.NextStep] = this.CurrentItem[ApprovalFields.AdditionalStep];
                //    this.CurrentItem[ApprovalFields.AdditionalDepartment] = this.CurrentItem[StringConstant.RequestsList.ReceviedByField];
                //}

                //res = base.Approve();
                #endregion

                #region A 2017.08.14

                res = base.Approve();

                // Trưởng phòng thực hiện duyệt sau bước BOD
                // SPFieldLookupValue currentStep = ObjectHelper.GetSPFieldLookupValue(this.CurrentItem[ApprovalFields.CurrentStep]);
                // SPFieldLookupValue nextStep = ObjectHelper.GetSPFieldLookupValue(this.CurrentItem[ApprovalFields.NextStep]);
                SPFieldLookupValue additionalPreviousStep = ObjectHelper.GetSPFieldLookupValue(this.CurrentItem[ApprovalFields.AdditionalPreviousStep]);
                SPFieldLookupValue additionalStep         = ObjectHelper.GetSPFieldLookupValue(this.CurrentItem[ApprovalFields.AdditionalStep]);
                SPFieldLookupValue additionalDepartment   = ObjectHelper.GetSPFieldLookupValue(this.CurrentItem[ApprovalFields.AdditionalDepartment]);
                //if ((string.Compare(currentStep.LookupValue, EmployeePosition_BOD_CODE, true) == 0) && (nextStep == null))
                // Neu ket thuc qui trinh thi chuyen cho Truong Bo Phan xu ly buoc ke tiep. (Neu next step bang NULL va Khong co
                //if (nextStep == null && additionalPreviousStep == null && additionalStep == null && additionalDepartment == null)
                if (((this.PendingAtEmployees == null) || (this.PendingAtEmployees != null && this.PendingAtEmployees.Count == 0)) &&
                    (additionalPreviousStep == null) && (additionalStep == null) && (additionalDepartment == null))
                {
                    int currentLocationId = 0;
                    int additionalApprovalDepartmentId       = 0;
                    int additionalApprovalPositionId         = GetDEHPositionId(); // DEH;
                    SPFieldLookupValue receivedByLookupValue = ObjectHelper.GetSPFieldLookupValue(this.CurrentItem[StringConstant.RequestsList.ReceviedByField]);
                    SPFieldLookupValue locationLookupValue   = ObjectHelper.GetSPFieldLookupValue(this.CurrentItem[ApprovalFields.CommonLocation]);
                    if (locationLookupValue != null)
                    {
                        currentLocationId = locationLookupValue.LookupId;
                    }
                    this.CurrentItem[ApprovalFields.IsAdditionalStep]       = true;
                    this.CurrentItem[ApprovalFields.AdditionalPreviousStep] = this.CurrentItem[ApprovalFields.CurrentStep];
                    this.CurrentItem[ApprovalFields.AdditionalStep]         = additionalApprovalPositionId; // DEH
                    //this.CurrentItem[ApprovalFields.NextStep] = this.CurrentItem[ApprovalFields.AdditionalStep];
                    if (receivedByLookupValue != null)
                    {
                        additionalApprovalDepartmentId = receivedByLookupValue.LookupId;
                        this.CurrentItem[ApprovalFields.AdditionalDepartment] = additionalApprovalDepartmentId;
                    }

                    List <EmployeeInfo> listOfEmployees = GetListOfEmployees(currentLocationId, additionalApprovalDepartmentId, additionalApprovalPositionId);
                    if (listOfEmployees != null && listOfEmployees.Count > 0)
                    {
                        this.PendingAtEmployees = listOfEmployees.ToSPFieldLookupValueCollection();
                        this.ListOfEmployeesEmailTo.AddRange(listOfEmployees);
                    }
                    // Set PendingAt
                    this.CurrentItem[ApprovalFields.PendingAt] = this.PendingAtEmployees;

                    // Set Status
                    this.CurrentItem[ApprovalFields.Status] = string.Format("{0} {1}", this.CurrentEmployee.EmployeePosition.LookupValue, Status.Approved);

                    // Set WFStauts
                    this.CurrentItem[ApprovalFields.WFStatus] = StringConstant.ApprovalStatus.InProgress;
                    this.IsWorkflowCompleted = false;

                    this.CurrentItem.Update();
                }

                #endregion

                #endregion

                #region Duc.VoTan.ADD.2017.10.12. TFS#1597. After department head of received by approve, update status of request to requester continue final step.
                string status = ObjectHelper.GetString(this.CurrentItem[ApprovalFields.Status]);
                if (string.Compare(status, Status.Completed, true) == 0)
                {
                    // Add To Email Requester
                    this.ListOfEmployeesEmailTo.Add(this.Creator);
                    // Change status: Completed -> Approved
                    this.CurrentItem[ApprovalFields.Status] = Status.Approved;
                    // khi “Trưởng phòng thực hiện
                    // (bên tiếp nhận)” duyệt đơn thì phiếu đề nghị đó sẽ có trạng thái là “Đang thực hiện”
                    // để bên đề nghị hoặc BOD nhìn vào sẽ biết được là đơn này đã được tiếp nhận và
                    // đang trong quá trình thực hiện yêu cầu
                    this.CurrentItem[ApprovalFields.WFStatus] = StringConstant.ApprovalStatus.InProcess;
                    // Update Request item
                    this.CurrentItem.Update();
                }
                #endregion
            }
            catch (Exception ex)
            {
                res = false;
                ULSLogging.LogError(ex);
            }

            return(res);
        }
Exemple #16
0
        public BOAContextData WithObjectHelper(ObjectHelper value)
        {
            objectHelper = value;

            return(this);
        }
	void OnGUI() {
		if(!SkinSetUp)
			SetUpSkin(GUI.skin);
		//Ctrl + w to close
		if(Event.current.Equals(Event.KeyboardEvent("^w"))) {
			Close();
			GUIUtility.ExitGUI();
		}
		if (Event.current.type == EventType.ScrollWheel) {
			if (Event.current.delta.y > 0) {
				ObjectDrawOffset++;
			} else {
				ObjectDrawOffset--;
			}
			Repaint();
			return;
		}
		/*
		 * SETUP
		 */
#if UNITY_3_0 || UNITY_3_0_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5
		EditorGUIUtility.LookLikeControls();
#endif
		alt = false;
		//Adjust colWidth as the window resizes
		colWidth = (position.width - UniMergeConfig.midWidth * 2 - UniMergeConfig.margin) / 2;

		winHeight = position.height;
		if (lastWinHeight != winHeight) {
			ObjectDrawWindow = 500;
		}
		lastWinHeight = winHeight;
		if(root == null)
			root = new ObjectHelper();
		/*
		 * BEGIN GUI
		 */
		GUILayout.BeginHorizontal();
		{
			/*
			 * Options
			 */
			GUILayout.BeginVertical();
			deepCopy = EditorGUILayout.Toggle(new GUIContent("Deep Copy", "When enabled, copying GameObjects or Components will search for references to them and try to set them.  Disable if you do not want this behavior or if the window locks up on copy (too many objects)"), deepCopy);
			log = EditorGUILayout.Toggle(new GUIContent("Log", "When enabled, non-obvious events (like deep copy reference setting) will be logged"), log);
			compareAttrs = EditorGUILayout.Toggle(new GUIContent("Compare Attributes", "When disabled, attributes will not be included in comparison algorithm.  To choose which components are included, use the drop-downs to the right."), compareAttrs);
			if(GUILayout.Button("Expand Differences"))
				root.ExpandDiffs();
			//GUILayout.BeginHorizontal();
			//if (GUILayout.Button("Prev Difference")) {
			//	PrevDifference();
			//}
			//if (GUILayout.Button("Next Difference")) {
			//	NextDifference();
			//}
			//GUILayout.EndHorizontal();
			if (GUILayout.Button("Refresh"))
				root.BubbleRefresh();
			DrawRowHeight();

			GUILayout.Space(10);						//Padding between controls and merge space
			GUILayout.EndVertical();

			/*
			 * Comparison Filters
			 */
			GUILayout.BeginVertical();
			GUILayout.BeginHorizontal();
			GUILayout.FlexibleSpace();
#if UNITY_3_0 || UNITY_3_0_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5			
			//TODO: Better masking for U3
			GUILayout.BeginVertical();
			GUILayout.Label("Enter a list of component types to exclude, separated by commas");
			filters = EditorGUILayout.TextField("Filters", filters);
			if(filters != lastFilters){
				ParseFilters();
			}
			lastFilters = filters;
			string filt = "Filtering: ";
			if(filterTypes.Count > 0){
				foreach(System.Type bad in filterTypes)
					filt += bad.Name + ", ";
				GUILayout.Label(filt.Substring(0, filt.Length - 2));
			}
			string err = "Sorry, the following types are invalid: ";
			if(badTypes.Count > 0){
				foreach(string bad in badTypes)
					err += bad + ", ";
				GUILayout.Label(err.Substring(0, err.Length - 2));
			}
			string cerr = "Sorry, the following types aren't components: ";
			if(notComponents.Count > 0){
				foreach(string bad in notComponents)
					cerr += bad + ", ";
				GUILayout.Label(cerr.Substring(0, cerr.Length - 2));
			}
			GUILayout.EndVertical();
#else
			GUILayout.Label(new GUIContent("Comparison Filters", "Select which components should be included in the comparison.  This is a little bugged right now so its disabled.  You can't filter more than 31 things :("));
			if(componentTypeStrings != null) {
				for(int i = 0; i < componentTypeStrings.Length; i++) {
					typeMask[i] = EditorGUILayout.MaskField(typeMask[i], componentTypeStrings[i], GUILayout.Width(75));
					if(i % 3 == 2) {
						GUILayout.EndHorizontal();
						GUILayout.BeginHorizontal();
						GUILayout.FlexibleSpace();
					}
				}
			}
#endif
			GUILayout.EndHorizontal();
			GUILayout.EndVertical();
		}
		GUILayout.EndHorizontal();
		GUILayout.BeginHorizontal();
		{
			GUILayout.BeginVertical(GUILayout.Width(colWidth));
			{
#if !(UNITY_3_0 || UNITY_3_0_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2)
				GUILayout.BeginHorizontal();
				mineName = GUILayout.TextField(mineName, GUILayout.Width(EditorGUIUtility.labelWidth));
	#if UNITY_3_0 || UNITY_3_0_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5
				mine = root.mine = (GameObject)EditorGUILayout.ObjectField(mine, typeof(GameObject));
	#else
				mine = root.mine = (GameObject)EditorGUILayout.ObjectField(mine, typeof(GameObject), true);
#endif
				GUILayout.EndHorizontal();
#else
	#if UNITY_3_0 || UNITY_3_0_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5
				mine = root.mine = (GameObject)EditorGUILayout.ObjectField("Mine", mine, typeof(GameObject));
	#else
				mine = root.mine = (GameObject)EditorGUILayout.ObjectField("Mine", mine, typeof(GameObject), true);
	#endif
#endif
			}
			GUILayout.EndVertical();
			GUILayout.Space(UniMergeConfig.midWidth * 2);
			GUILayout.BeginVertical(GUILayout.Width(colWidth));
			{
#if !(UNITY_3_0 || UNITY_3_0_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2)
				GUILayout.BeginHorizontal();
				theirName = GUILayout.TextField(theirName, GUILayout.Width(EditorGUIUtility.labelWidth));
	#if UNITY_3_0 || UNITY_3_0_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5
				theirs = root.theirs = (GameObject)EditorGUILayout.ObjectField(theirs, typeof(GameObject));
	#else
				theirs = root.theirs = (GameObject)EditorGUILayout.ObjectField(theirs, typeof(GameObject), true);
	#endif
				GUILayout.EndHorizontal();
#else
	#if UNITY_3_0 || UNITY_3_0_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5
				theirs = root.theirs = (GameObject)EditorGUILayout.ObjectField("Theirs", theirs, typeof(GameObject));
	#else
				theirs = root.theirs = (GameObject)EditorGUILayout.ObjectField("Theirs", theirs, typeof(GameObject), true);
	#endif
#endif
			}
			GUILayout.EndVertical();
		}
		GUILayout.EndHorizontal();
		if(lastRoot == null) {
			lastRoot = new ObjectHelper();
		}
		if(root.mine && root.theirs
			&& (root.mine != lastRoot.mine || root.theirs != lastRoot.theirs)) {
			//This is where we initiate the merge for the first time
#if UNITY_3_0 || UNITY_3_0_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5
				refresh = root.DoRefresh();
#else
			//Check if the objects are prefabs
			switch (PrefabUtility.GetPrefabType(root.mine)) {
				case PrefabType.ModelPrefab:
				case PrefabType.Prefab:
					switch(PrefabUtility.GetPrefabType(root.theirs)) {
						case PrefabType.ModelPrefab:
						case PrefabType.Prefab:
							if(EditorUtility.DisplayDialog(
								"Instantiate prefabs?",
								"In order to merge prefabs, you must instantiate them and merge the instances. Then you must apply the changes.",
								"Instantiate", "Cancel")){
									GameObject mine = PrefabUtility.InstantiatePrefab(root.mine) as GameObject;
									GameObject theirs = PrefabUtility.InstantiatePrefab(root.theirs) as GameObject;
									ObjectMerge.mine = mine;
									ObjectMerge.theirs = theirs;
							} else {
								ObjectMerge.mine = null;
								ObjectMerge.theirs = null;
							}
							break;
						default:
							Debug.LogWarning("Sorry, you must compare a prefab with a prefab");
							break;
					}
					break;
				case PrefabType.DisconnectedPrefabInstance:
				case PrefabType.PrefabInstance:
				case PrefabType.ModelPrefabInstance:
				case PrefabType.None:
					switch (PrefabUtility.GetPrefabType(root.theirs)) {
						case PrefabType.DisconnectedPrefabInstance:
						case PrefabType.PrefabInstance:
						case PrefabType.ModelPrefabInstance:
						case PrefabType.None:
							refresh = root.DoRefresh();	
							break;
						default:
							Debug.LogWarning("Sorry, this prefab type is not supported");
							break;
					}
					break;
				default:
					Debug.LogWarning("Sorry, this prefab type is not supported");
					break;
			}
#endif
		}
		lastRoot.mine = root.mine;
		lastRoot.theirs = root.theirs;

#if !(UNITY_3_0 || UNITY_3_0_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2)
		EditorGUIUtility.labelWidth = 75;			//Make labels just a bit tighter for compactness 
#endif
		if(root.mine && root.theirs) {
			//scroll = GUILayout.BeginScrollView(scroll);
			//Rect box = GUILayoutUtility.GetRect(new GUIContent("asdf"), GUIStyle.none, GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true));
			//ObjectDrawWindow = (int)(position.height - 120) / (rowPadding * 2 + 37);
			ObjectDrawCursor = 0;
			ObjectDrawCount = root.GetDrawCount();
			int lessCount = ObjectDrawCount - ObjectDrawWindow;
			if (lessCount < 0)
				lessCount = 0;
			if (ObjectDrawOffset > lessCount) {
				ObjectDrawOffset = lessCount;
			}
			startingWidth = -1;
			if (lessCount > 0) {
				GUI.SetNextControlName("UM_Slider");
				ObjectDrawOffset = EditorGUILayout.IntSlider("Row Offset: ", ObjectDrawOffset, 0, lessCount);
			}
			root.Draw();
		}
		if(refresh != null) {
			Rect pbar = GUILayoutUtility.GetRect(position.width, PROGRESS_BAR_HEIGHT);
			EditorGUI.ProgressBar(pbar, (float)refreshCount / totalRefreshNum, refreshCount + "/" + totalRefreshNum);
			if(GUILayout.Button("Cancel")) {
				cancelRefresh = true;
				GUIUtility.ExitGUI();
			}
		}
	}
Exemple #18
0
 public override void Init(ObjectData data, string name)
 {
     model   = ObjectHelper.LoadModel("stg01_beach/common/models/seaobj_parasol03.nja.sa1mdl");
     meshes  = ObjectHelper.GetMeshes(model);
     meshes2 = ObjectHelper.GetMeshes(model.Sibling);
 }
Exemple #19
0
 public override void Init(ObjectData data, string name, Device dev)
 {
     model  = ObjectHelper.LoadModel("Objects/Levels/Windy Valley/O_UKISIM.sa1mdl");
     meshes = ObjectHelper.GetMeshes(model, dev);
 }
Exemple #20
0
        public override List <RenderInfo> Render(SETItem item, Device dev, EditorCamera camera, MatrixStack transform)
        {
            List <RenderInfo> result = new List <RenderInfo>();

            for (int i = 0; i < Math.Min(item.Scale.X + 1, 8); i++)
            {
                transform.Push();
                if (item.Scale.Z == 1)                 // circle
                {
                    double  v4 = i * 360.0;
                    Vector3 v7 = new Vector3(
                        ObjectHelper.NJSin((int)(v4 / item.Scale.X * 65536.0 * 0.002777777777777778)) * item.Scale.Y,
                        0,
                        ObjectHelper.NJCos((int)(v4 / item.Scale.X * 65536.0 * 0.002777777777777778)) * item.Scale.Y);
                    transform.Push();
                    transform.NJTranslate(item.Position);
                    transform.NJRotateObject(item.Rotation);
                    Vector3 pos = Vector3.TransformCoordinate(v7, transform.Top);
                    transform.Pop();
                    transform.NJTranslate(pos);
                    result.AddRange(model.DrawModelTree(dev.GetRenderState <FillMode>(RenderState.FillMode), transform, ObjectHelper.GetTextures("OBJ_REGULAR"), meshes));
                    if (item.Selected)
                    {
                        result.AddRange(model.DrawModelTreeInvert(transform, meshes));
                    }
                }
                else                 // line
                {
                    transform.Push();
                    transform.NJTranslate(item.Position);
                    transform.NJRotateObject(item.Rotation);
                    double v5;
                    if (i % 2 == 1)
                    {
                        v5 = i * item.Scale.Y * -0.5;
                    }
                    else
                    {
                        v5 = Math.Ceiling(i * 0.5) * item.Scale.Y;
                    }
                    Vector3 pos = Vector3.TransformCoordinate(new Vector3(0, 0, (float)v5), transform.Top);
                    transform.Pop();
                    transform.NJTranslate(pos);
                    result.AddRange(model.DrawModelTree(dev.GetRenderState <FillMode>(RenderState.FillMode), transform, ObjectHelper.GetTextures("OBJ_REGULAR"), meshes));
                    if (item.Selected)
                    {
                        result.AddRange(model.DrawModelTreeInvert(transform, meshes));
                    }
                }
                transform.Pop();
            }
            return(result);
        }
Exemple #21
0
 public static ContactInfo GetInfo_OldDatabase(int id)
 {
     return(ObjectHelper.FillObject <ContactInfo>(DataProvider.Instance().Contacts_GetInfo_OldDatabase(id)));
 }
Exemple #22
0
 public override void Init(ObjectData data, string name, Device dev)
 {
     model  = ObjectHelper.LoadModel("Objects/Levels/Emerald Coast/O MKUSA.sa1mdl");
     meshes = ObjectHelper.GetMeshes(model, dev);
 }
Exemple #23
0
 public static List <ContactInfo> SearchDuplicateMo(int branchId, DateTime?importDate, int importId)
 {
     //return FillContactCollection(DataProvider.Instance().Contacts_SearchDuplicateMo(branchId, importDate, importId));
     return(ObjectHelper.FillCollection <ContactInfo>(DataProvider.Instance().Contacts_SearchDuplicateMo(branchId, importDate, importId)));
 }
Exemple #24
0
 /// <summary>
 /// Handles the <see cref="INotifyPropertyChanged.PropertyChanged"/> of the active tasks being monitored.
 /// </summary>
 /// <remarks>
 /// This adjusts the command availability based on the active task's status.
 /// </remarks>
 /// <param name="sender">The object that raised the event.</param>
 /// <param name="e">A <see cref="PropertyChangedEventArgs"/> describing the event arguments.</param>
 private void ActiveTasks_PropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     if (e.PropertyName == ObjectHelper.GetPropertyName <AddModTask>(x => x.Status))
     {
     }
 }
Exemple #25
0
 public static List <ContactAppointmentInfo> ContactReportAppointment(int userId, int branchId, DateTime fromDate, DateTime toDate)
 {
     return(ObjectHelper.FillCollection <ContactAppointmentInfo>(DataProvider.Instance().Contacts_Report_Appointment(userId, branchId, fromDate, toDate)));
 }
 public override void Init(ObjectData data, string name)
 {
     model  = ObjectHelper.LoadModel("Objects/Levels/Windy Valley/Prope1.sa1mdl");
     meshes = ObjectHelper.GetMeshes(model);
 }
Exemple #27
0
 public static List <ReportBC46Info> GetBC46(DateTime?handoverFromDate, DateTime?handoverToDate, DateTime?registerFromDate, DateTime?registerToDate, int channelId, int statuscontact)
 {
     return(ObjectHelper.FillCollection <ReportBC46Info>(DataProvider.Instance().Contacts_GetBC46(handoverFromDate, handoverToDate, registerFromDate, registerToDate, channelId, statuscontact)));
 }
Exemple #28
0
        public override List <RenderInfo> Render(SETItem item, Device dev, EditorCamera camera, MatrixStack transform)
        {
            List <RenderInfo> result = new List <RenderInfo>();

            transform.Push();
            transform.NJTranslate(item.Position);
            transform.NJRotateObject(item.Rotation);
            result.AddRange(model.DrawModelTree(dev.GetRenderState <FillMode>(RenderState.FillMode), transform, ObjectHelper.GetTextures("OBJ_WINDY"), meshes));
            if (item.Selected)
            {
                result.AddRange(model.DrawModelTreeInvert(transform, meshes));
            }
            transform.Pop();
            return(result);
        }
Exemple #29
0
 public static List <ContactInfo> GetBC20(DateTime handoverDate)
 {
     return(ObjectHelper.FillCollection <ContactInfo>(DataProvider.Instance().Contacts_GetBC20(handoverDate)));
 }
Exemple #30
0
 public override void Init(ObjectData data, string name)
 {
     model  = ObjectHelper.LoadModel("stg02_windy/common/models/wvobj_flower_b.nja.sa1mdl");
     meshes = ObjectHelper.GetMeshes(model);
 }
Exemple #31
0
 public static List <ContactInfo> GetListContactsId(string strPhones)
 {
     return(ObjectHelper.FillCollection <ContactInfo>(DataProvider.Instance().Contacst_GetContactsId(strPhones)));
 }
Exemple #32
0
 public override void Init(ObjectData data, string name)
 {
     model  = ObjectHelper.LoadModel("object/dushring_cyl6_1.nja.sa1mdl");
     meshes = ObjectHelper.GetMeshes(model);
 }
	public ComponentHelper(ObjectHelper parent, Component mine, Component theirs) {
		this.parent = parent;
		this.mine = mine;
		this.theirs = theirs;
		if(mine != null)
			type = mine.GetType();
		else if(theirs != null)
			type = theirs.GetType();
	}
Exemple #34
0
        public override List <RenderInfo> Render(SETItem item, Device dev, EditorCamera camera, MatrixStack transform)
        {
            List <RenderInfo> result = new List <RenderInfo>();

            transform.Push();
            transform.NJTranslate(item.Position);
            int x = item.Rotation.X;
            int y = item.Rotation.Y;

            if (!item.Scale.IsEmpty)
            {
                (item.Position - item.Scale).GetRotation(out x, out y);
            }
            transform.NJRotateX(x);
            transform.NJRotateY(y);
            transform.NJRotateZ(item.Rotation.Z);
            result.AddRange(model.DrawModelTree(dev.GetRenderState <FillMode>(RenderState.FillMode), transform, ObjectHelper.GetTextures("OBJ_REGULAR"), meshes, EditorOptions.IgnoreMaterialColors, EditorOptions.OverrideLighting));
            if (item.Selected)
            {
                result.AddRange(model.DrawModelTreeInvert(transform, meshes));
            }
            transform.Pop();
            if (item.Selected)
            {
                FVF_PositionColored[] verts = new FVF_PositionColored[2];
                verts[0]         = new FVF_PositionColored(item.Position.ToVector3(), System.Drawing.Color.Yellow);
                verts[1]         = new FVF_PositionColored(item.Scale.ToVector3(), System.Drawing.Color.Yellow);
                dev.VertexFormat = FVF_PositionColored.Format;
                dev.DrawUserPrimitives(PrimitiveType.LineList, 1, verts);
            }
            return(result);
        }
	/// <summary>
	/// Refresh is a very crucial function.  Not only does it refresh the abstracted lists of ObjectHelpers and ComponentHelpers to reflect the actual scene,
	/// it is responsible for actually comparing objects
	/// </summary>
	/// <returns>IEnumerable for coroutine progress</returns>
	public IEnumerable Refresh() {
		scroll = ObjectMerge.scroll;
		ObjectMerge.refreshCount++;
		same = true;
		List<GameObject> myChildren = new List<GameObject>();
		List<GameObject> theirChildren = new List<GameObject>();
		List<Component> myComponents = new List<Component>();
		List<Component> theirComponents = new List<Component>();
		//Get lists of components and children
		if (mine) {
			myChildren.AddRange(from Transform t in mine.transform select t.gameObject);
			myComponents = new List<Component>(mine.GetComponents<Component>());
		}
		if (theirs) {
			theirChildren.AddRange(from Transform t in theirs.transform select t.gameObject);
			theirComponents = new List<Component>(theirs.GetComponents<Component>());
		}
		//TODO: turn these two chunks into one function... somehow
		//Merge Components
		ComponentHelper ch;
		for (int i = 0; i < myComponents.Count; i++) {
			Component match = null;
			Component myComponent = myComponents[i];
			if (myComponent != null) {
				foreach (Component g in theirComponents) {
					if (g != null) {
						if (myComponent.GetType() == g.GetType()) {
							match = g;
							break;
						}
					}
				}
				ch = components.Find(delegate(ComponentHelper helper) {
					return helper.mine == myComponent || (match != null && helper.theirs == match);
				});
				if (ch == null) {
					ch = new ComponentHelper(this, myComponent, match);
					components.Add(ch);
				}
				else {
					ch.mine = myComponent;
					ch.theirs = match;
				}
				foreach (IEnumerable e in ch.Refresh())
					yield return e;
				if (!ComponentIsFiltered(ch.type) && !ch.same) {
					same = false;
				}
				theirComponents.Remove(match);
			}
		}
		if (theirComponents.Count > 0) {
			foreach (Component g in theirComponents) {
				ch = components.Find(delegate(ComponentHelper helper) {
					return helper.theirs == g;
				});
				if (ch == null) {
					ch = new ComponentHelper(this, null, g);
					foreach (IEnumerable e in ch.Refresh())
						yield return e;
					components.Add(ch);
				}
				if (!ComponentIsFiltered(ch.type) && !ch.same)
					same = false;
			}
		}
		//Merge Children
		ObjectHelper oh;
		for (int i = 0; i < myChildren.Count; i++) {
			GameObject match = theirChildren.FirstOrDefault(g => SameObject(myChildren[i], g));
			oh = children.Find(delegate(ObjectHelper helper) {
				return helper.mine == myChildren[i] || (match != null && helper.theirs == match);
			});
			if (oh == null) {
				oh = new ObjectHelper {parent = this, mine = myChildren[i], theirs = match};
				children.Add(oh);
			}
			else {
				oh.mine = myChildren[i];
				oh.theirs = match;
			}
			theirChildren.Remove(match);
		}
		if (theirChildren.Count > 0) {
			same = false;
			foreach (GameObject g in theirChildren) {
				oh = children.Find(delegate(ObjectHelper helper) {
					return helper.theirs == g;
				});
				if (oh == null)
					children.Add(new ObjectHelper {parent = this, theirs = g});
			}
		}
		List<ObjectHelper> tmp = new List<ObjectHelper>(children);
		foreach (ObjectHelper obj in tmp) {
			if (obj.mine == null && obj.theirs == null)
				children.Remove(obj);
		}
		children.Sort(delegate(ObjectHelper a, ObjectHelper b) {
			if (a.mine && b.mine)
				return a.mine.name.CompareTo(b.mine.name);
			if (a.mine && b.theirs)
				return a.mine.name.CompareTo(b.theirs.name);
			if (a.theirs && b.mine)
				return a.theirs.name.CompareTo(b.mine.name);
			if (a.theirs && b.theirs)
				return a.theirs.name.CompareTo(b.theirs.name);
			return 0;
		});
		tmp = new List<ObjectHelper>(children);
		foreach (ObjectHelper child in tmp) {
			foreach (IEnumerable e in child.Refresh())
				yield return e;
			if (!child.same)
				same = false;
		}
		sameAttrs = CheckAttrs();
		if (!sameAttrs && ObjectMerge.compareAttrs) {
			same = false;
		}
		ObjectMerge.scroll = scroll;
	}
Exemple #36
0
	void OnGUI() {
		if(!SkinSetUp)
			SetUpSkin(GUI.skin);
		//Ctrl + w to close
		if(Event.current.Equals(Event.KeyboardEvent("^w"))) {
			Close();
			GUIUtility.ExitGUI();
		}
		/*
		 * SETUP
		 */
#if UNITY_3_0 || UNITY_3_0_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5
		EditorGUIUtility.LookLikeControls();
#endif
		alt = false;
		//Adjust colWidth as the window resizes
		colWidth = (position.width - UniMergeConfig.midWidth * 2 - UniMergeConfig.margin) / 2;
		if(root == null)
			root = new ObjectHelper();
		/*
		 * BEGIN GUI
		 */
		GUILayout.BeginHorizontal();
		{
			/*
			 * Options
			 */
			GUILayout.BeginVertical();
			deepCopy = EditorGUILayout.Toggle(new GUIContent("Deep Copy", "When enabled, copying GameObjects or Components will search for references to them and try to set them.  Disable if you do not want this behavior or if the window locks up on copy (too many objects)"), deepCopy);
			log = EditorGUILayout.Toggle(new GUIContent("Log", "When enabled, non-obvious events (like deep copy reference setting) will be logged"), log);
			compareAttrs = EditorGUILayout.Toggle(new GUIContent("Compare Attributes", "When disabled, attributes will not be included in comparison algorithm.  To choose which components are included, use the drop-downs to the right."), compareAttrs);
			if(GUILayout.Button("Expand Differences"))
				root.ExpandDiffs();
			if (GUILayout.Button("Refresh"))
				root.BubbleRefresh();
			DrawRowHeight();

			GUILayout.Space(10);						//Padding between controls and merge space
			GUILayout.EndVertical();

			/*
			 * Comparison Filters
			 */
			GUILayout.BeginVertical();
			GUILayout.BeginHorizontal();
			GUILayout.FlexibleSpace();
#if UNITY_3_0 || UNITY_3_0_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5			
			//TODO: Better masking for U3
			GUILayout.BeginVertical();
			GUILayout.Label("Enter a list of component types to exclude, separated by commas");
			filters = EditorGUILayout.TextField("Filters", filters);
			if(filters != lastFilters){
				ParseFilters();
			}
			lastFilters = filters;
			string filt = "Filtering: ";
			if(filterTypes.Count > 0){
				foreach(System.Type bad in filterTypes)
					filt += bad.Name + ", ";
				GUILayout.Label(filt.Substring(0, filt.Length - 2));
			}
			string err = "Sorry, the following types are invalid: ";
			if(badTypes.Count > 0){
				foreach(string bad in badTypes)
					err += bad + ", ";
				GUILayout.Label(err.Substring(0, err.Length - 2));
			}
			string cerr = "Sorry, the following types aren't components: ";
			if(notComponents.Count > 0){
				foreach(string bad in notComponents)
					cerr += bad + ", ";
				GUILayout.Label(cerr.Substring(0, cerr.Length - 2));
			}
			GUILayout.EndVertical();
#else
			GUILayout.Label(new GUIContent("Comparison Filters", "Select which components should be included in the comparison.  This is a little bugged right now so its disabled.  You can't filter more than 31 things :("));
			if(componentTypeStrings != null) {
				for(int i = 0; i < componentTypeStrings.Length; i++) {
					typeMask[i] = EditorGUILayout.MaskField(typeMask[i], componentTypeStrings[i], GUILayout.Width(75));
					if(i % 3 == 2) {
						GUILayout.EndHorizontal();
						GUILayout.BeginHorizontal();
						GUILayout.FlexibleSpace();
					}
				}
			}
#endif
			GUILayout.EndHorizontal();
			GUILayout.EndVertical();
		}
		GUILayout.EndHorizontal();
		GUILayout.BeginHorizontal();
		{
			GUILayout.BeginVertical(GUILayout.Width(colWidth));
			{
#if UNITY_3_0 || UNITY_3_0_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5
				mine = root.mine = (GameObject)EditorGUILayout.ObjectField("Mine", mine, typeof(GameObject));
#else
				mine = root.mine = (GameObject)EditorGUILayout.ObjectField("Mine", mine, typeof(GameObject), true);
#endif
			}
			GUILayout.EndVertical();
			GUILayout.Space(UniMergeConfig.midWidth * 2);
			GUILayout.BeginVertical(GUILayout.Width(colWidth));
			{
#if UNITY_3_0 || UNITY_3_0_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5
				theirs = root.theirs = (GameObject)EditorGUILayout.ObjectField("Theirs", theirs, typeof(GameObject));
#else
				theirs = root.theirs = (GameObject)EditorGUILayout.ObjectField("Theirs", theirs, typeof(GameObject), true);
#endif
			}
			GUILayout.EndVertical();
		}
		GUILayout.EndHorizontal();
		if(lastRoot == null) {
			lastRoot = new ObjectHelper();
		}
		if(root.mine != lastRoot.mine || root.theirs != lastRoot.theirs) {
			refresh = root.DoRefresh();
		}
		lastRoot.mine = root.mine;
		lastRoot.theirs = root.theirs;

#if !(UNITY_3_0 || UNITY_3_0_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2)
		EditorGUIUtility.labelWidth = 75;			//Make labels just a bit tighter for compactness 
#endif
		if(root.mine && root.theirs) {
			scroll = GUILayout.BeginScrollView(scroll);
			root.Draw();
			GUILayout.EndScrollView();
		}
		if(refresh != null) {
			Rect pbar = GUILayoutUtility.GetRect(position.width, PROGRESS_BAR_HEIGHT);
			EditorGUI.ProgressBar(pbar, (float)refreshCount / totalRefreshNum, refreshCount + "/" + totalRefreshNum);
			if(GUILayout.Button("Cancel")) {
				cancelRefresh = true;
				GUIUtility.ExitGUI();
			}
		}
	}