protected override async Task <(string Title1, string Title2, string Title3)> GetTitle123Async(Company item, int parentId, eAction action)
        {
            var title1 = string.Empty;
            var title2 = string.Empty;
            var title3 = string.Empty;

            switch (action)
            {
            case eAction.Index:

                title1 = $"Setup {GetTypeName().ToSpaceDelimitedWords().Pluralize()}";

                break;

            case eAction.GetCreate:
            case eAction.PostCreate:

                title1 = action.ToString();
                title2 = GetTypeName().ToSpaceDelimitedWords();

                break;

            case eAction.GetEdit:
            case eAction.PostEdit:

                title1 = action.ToString();
                title2 = item.Name;

                break;

            case eAction.GetDelete:
            case eAction.PostDelete:

                title1 = action.ToString();
                title2 = item.Name;

                break;

            case eAction.Details:

                title1 = action.ToString();
                title2 = item.Name;

                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(action), action, null);
            }

            var result = (title1, title2, title3);

            return(await Task.FromResult(result));
        }
Exemple #2
0
        void CallBack(eAction action, object obj1, object obj2, object obj3)
        {
            Debug.Print(action.ToString() + "===>" + obj1.ToString());
            switch (action)
            {
                case eAction.Message:
                    string Message = obj1 as string;
                    if (Message != null)
                    {
                        if (lastMessage != Message)
                            sbiMessage.Content = Message + Environment.NewLine + sbiMessage.Content;
                        lastMessage = Message;
                    }

                    break;
                case eAction.Error:
                    if (obj1 is string)
                    {
                        MessageBox.Show((string)obj1, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                    break;
                case eAction.State:
                    string state = obj1 as string;
                    if (state != null)
                    {
                        if (lastState != state)
                            sbiState.Content = state + Environment.NewLine + sbiState.Content;
                        lastState = state;
                    }
                    break;
                case eAction.Notification:
                    break;
                case eAction.RestError:
                    if (obj1 is System.Net.HttpStatusCode)
                    {
                        System.Net.HttpStatusCode StatusCode = (System.Net.HttpStatusCode)obj1;
                        if (StatusCode == System.Net.HttpStatusCode.Forbidden)
                            MessageBox.Show("Invalid Credentials", "Forbidden", MessageBoxButton.OK, MessageBoxImage.Error);
                        else
                            MessageBox.Show("Error:" + (string)obj2, "Error", MessageBoxButton.OK, MessageBoxImage.Error);

                    }
                    break;
                case eAction.WebSocketError:
                    break;
                case eAction.CacheError:
                    break;
                default:
                    break;
            }

        }
        protected override async Task <(string Title1, string Title2, string Title3)> GetTitle123Async(Employee item, int parentId, eAction action)
        {
            var title1 = string.Empty;
            var title2 = string.Empty;
            var title3 = string.Empty;

            switch (action)
            {
            case eAction.Index:

                title1 = $"Setup {GetTypeName().ToSpaceDelimitedWords().Pluralize()}";
                title2 = await GetParentName(parentId);

                break;

            case eAction.GetCreate:
            case eAction.PostCreate:

                title1 = action.ToString().Replace("Get", string.Empty).Replace("Post", string.Empty);
                title2 = GetTypeName().ToSpaceDelimitedWords();

                if (!Request.IsAjaxRequest())
                {
                    title3 = await GetParentName(parentId);
                }

                break;

            case eAction.GetEdit:
            case eAction.PostEdit:

                title1 = action.ToString().Replace("Get", string.Empty).Replace("Post", string.Empty);
                title2 = $"{item.FirstName} {item.LastName}";

                if (!Request.IsAjaxRequest())
                {
                    title3 = await GetParentName(parentId);
                }

                break;

            case eAction.GetDelete:
            case eAction.PostDelete:

                title1 = action.ToString().Replace("Get", string.Empty).Replace("Post", string.Empty);
                title2 = $"{item.FirstName} {item.LastName}";

                if (!Request.IsAjaxRequest())
                {
                    title3 = await GetParentName(parentId);
                }

                break;

            case eAction.Details:

                title1 = action.ToString().Replace("Get", string.Empty).Replace("Post", string.Empty);
                title2 = $"{item.FirstName} {item.LastName}";

                if (!Request.IsAjaxRequest())
                {
                    title3 = await GetParentName(parentId);
                }

                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(action), action, null);
            }

            var result = (title1, title2, title3);

            return(await Task.FromResult(result));
        }
Exemple #4
0
        public void Draw()
        {
            GUILayout.BeginVertical("box");

            m_SummonData.prop.Draw();
            #region Motion
            GUILayout.BeginVertical("box");
            m_DrawMotion = EditorGUILayout.Foldout(m_DrawMotion, "Motions");

            if (m_DrawMotion)
            {
                for (int i = 0; i < m_Motions.Count; i++)
                {
                    m_Motions[i].Draw();
                }

                EditorGUILayout.Space();
                GUILayout.BeginHorizontal("box");

                m_CreateMotionType = (eMotion)EditorGUILayout.EnumPopup(m_CreateMotionType);
                if (GUILayout.Button("添加Motion"))
                {
                    System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly(); // 获取当前程序集

                    Motion motion = (Motion)assembly.CreateInstance("Code.SkillSystem.Runtime." + m_CreateMotionType.ToString().Replace("M_", "Motion"));

                    if (motion != null)
                    {
                        motion.AddDefault(motion.prop);
                        motion.Create_Editor(motion.prop, this);

                        motion.prop.SetValue(PropertiesKey.MOTION_OWNER_SKILL, m_SummonData.owner.ToString());
                        motion.prop.SetValue(PropertiesKey.MOTION_OWNER, m_SummonData.id.ToString());
                        motion.prop.SetValue(PropertiesKey.SUMMON_ID, (GameCenter.Instance.DataManager.skillMotionDB.MaxID(motion.prop) + 1).ToString());
                        m_Motions.Add(motion);
                        GameCenter.Instance.DataManager.skillMotionDB.Add(motion.prop);
                    }
                }
                GUILayout.EndHorizontal();
            }
            GUILayout.EndVertical();
            #endregion

            #region Action
            GUILayout.BeginVertical("box");
            m_DrawAction = EditorGUILayout.Foldout(m_DrawAction, "Actions");

            if (m_DrawAction)
            {
                for (int i = 0; i < m_Actions.Count; i++)
                {
                    m_Actions[i].Draw();
                }

                GUILayout.BeginHorizontal("box");
                m_CreateActionType = (eAction)EditorGUILayout.EnumPopup(m_CreateActionType);
                if (GUILayout.Button("添加Action"))
                {
                    System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly(); // 获取当前程序集


                    Action action = (Action)assembly.CreateInstance("Code.SkillSystem.Runtime.Action" + m_CreateActionType.ToString());

                    if (action != null)
                    {
                        action.AddDefault(action.prop);
                        action.Create(action.prop, this);
                        action.prop.SetValue(PropertiesKey.ACTION_OWNER_SKILL, m_SummonData.owner.ToString());
                        action.prop.SetValue(PropertiesKey.ACTION_OWNER, m_SummonData.id.ToString());
                        action.prop.SetValue(PropertiesKey.ACTION_ID, (GameCenter.Instance.DataManager.skillActionDB.MaxID(action.prop) + 1).ToString());
                        m_Actions.Add(action);
                        GameCenter.Instance.DataManager.skillActionDB.Add(action.prop);
                    }
                }
                GUILayout.EndHorizontal();
            }
            GUILayout.EndVertical();
            #endregion

            GUILayout.EndVertical();
        }
        protected override async Task <(string Title1, string Title2, string Title3)> GetTitle123Async(AspNetUserRole item, string parentId, eAction action)
        {
            var title1 = string.Empty;
            var title2 = string.Empty;
            var title3 = string.Empty;

            switch (action)
            {
            case eAction.Index:

                title1 = "Manage Roles";
                title2 = await GetParentName(parentId);

                break;

            case eAction.GetCreate:
            case eAction.PostCreate:

                title1 = "Add";
                title2 = "Roles";

                if (!Request.IsAjaxRequest())
                {
                    title3 = await GetParentName(parentId);
                }

                break;

            case eAction.GetEdit:
            case eAction.PostEdit:

                title1 = action.ToString();
                title2 = item.RoleName;

                if (!Request.IsAjaxRequest())
                {
                    title3 = await GetParentName(parentId);
                }

                break;

            case eAction.GetDelete:
            case eAction.PostDelete:

                title1 = action.ToString();
                title2 = item.RoleName;

                if (!Request.IsAjaxRequest())
                {
                    title3 = await GetParentName(parentId);
                }

                break;

            case eAction.Details:

                title1 = action.ToString();
                title2 = item.RoleName;

                if (!Request.IsAjaxRequest())
                {
                    title3 = await GetParentName(parentId);
                }

                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(action), action, null);
            }

            var result = (title1, title2, title3);

            return(await Task.FromResult(result));
        }