public void New(RoutedEventArgs e) { var menuItem = e.Source as MenuItem; var header = menuItem.Header.ToString(); int type = 0; if (header.ToLower() == "folder") { type = 1; } else if (header.ToLower() == "file") { type = 2; } else if (header.ToLower() == "image") { type = 3; } var parentId = SelectedMenu.Id; var menuDto = new MenuModel { Name = "New " + header, Pid = parentId, Type = type }; _menuService.AddOrUpdate(menuDto).Then(r => { if (r.HasError()) { WindowManager.ShowErrorWindow(r.StatusCode); return; } var menu = r.Data.Data; if (menu != null) { SelectedMenu.Id = menu.Id; menuDto.Id = menu.Id; } menuDto.Icon = IconUtility.GetIcon(menuDto.Type); menuDto.Parent = SelectedMenu; SelectedMenu.Children.Add(menuDto); }); }
public void New(RoutedEventArgs e) { var menuItem = e.Source as MenuItem; var header = menuItem.Header.ToString(); int type = 0; if (header.ToLower() == "folder") { type = 1; } else if (header.ToLower() == "file") { type = 2; } else if (header.ToLower() == "image") { type = 3; } var parentId = SelectedMenu.Id; var menuDto = new MenuModel { Name = "New " + header, Pid = parentId, Type = type }; var addResult = _menuService.AddOrUpdate(menuDto); var menu = addResult.Data; if (menu != null) { SelectedMenu.Id = menu.Id; menuDto.Id = menu.Id; } menuDto.Icon = IconUtility.GetIcon(menuDto.Type); menuDto.Parent = SelectedMenu; SelectedMenu.Children.Add(menuDto); }
public BusinessProfile() { CreateMap <Menu, MenuModel>() .ForMember(dst => dst.Icon, opt => opt.MapFrom((src, dst) => { return(IconUtility.GetIcon(src.type)); })); CreateMap <MenuModel, Menu>(); CreateMap <PersonModel, Person>(); CreateMap <Person, PersonModel>(); CreateMap <ClientModel, Client>(); CreateMap <Client, ClientModel>(); CreateMap <StudentModel, Student>();//.ForMember(dst => dst.Courses,opt => opt.Ignore()); CreateMap <Student, StudentModel>(); CreateMap <CourseModel, Course>(); CreateMap <Course, CourseModel>(); }
static void Init() { if (s_Initialized) { return; } s_Initialized = true; s_ButtonStyle = new GUIStyle() { normal = new GUIStyleState() { background = IconUtility.GetIcon(k_ButtonBackgroundNormal), textColor = UnityEditor.EditorGUIUtility.isProSkin ? k_TextColorWhiteNormal : Color.black }, hover = new GUIStyleState() { background = IconUtility.GetIcon(k_ButtonBackgroundHover), textColor = UnityEditor.EditorGUIUtility.isProSkin ? k_TextColorWhiteHover : Color.black, }, active = new GUIStyleState() { background = IconUtility.GetIcon(k_ButtonBackgroundPressed), textColor = UnityEditor.EditorGUIUtility.isProSkin ? k_TextColorWhiteActive : Color.black, }, alignment = ProBuilderEditor.s_IsIconGui ? TextAnchor.MiddleCenter : TextAnchor.MiddleLeft, border = new RectOffset(3, 3, 3, 3), stretchWidth = true, stretchHeight = false, margin = new RectOffset(4, 4, 4, 4), padding = new RectOffset(4, 4, 4, 4) }; s_ToolbarHelpIcon = new GUIStyle() { margin = new RectOffset(0, 0, 0, 0), padding = new RectOffset(0, 0, 0, 0), alignment = TextAnchor.MiddleCenter, fixedWidth = 18, fixedHeight = 18 }; s_SettingsGroup = new GUIStyle() { normal = new GUIStyleState() { background = IconUtility.GetIcon(k_SettingsBackgroundNormal) }, hover = new GUIStyleState() { background = IconUtility.GetIcon(k_SettingsBackgroundNormal) }, active = new GUIStyleState() { background = IconUtility.GetIcon(k_SettingsBackgroundNormal) }, border = new RectOffset(3, 3, 3, 3), stretchWidth = true, stretchHeight = false, margin = new RectOffset(4, 4, 4, 4), padding = new RectOffset(4, 4, 4, 6) }; s_RowStyle = new GUIStyle() { normal = new GUIStyleState() { background = UnityEditor.EditorGUIUtility.whiteTexture }, stretchWidth = true, stretchHeight = false, margin = new RectOffset(4, 4, 4, 4), padding = new RectOffset(4, 4, 4, 4) }; s_HeaderLabel = new GUIStyle(UnityEditor.EditorStyles.boldLabel) { alignment = TextAnchor.LowerLeft, fontSize = 18, stretchWidth = true, stretchHeight = false }; Font asap = FileUtility.LoadInternalAsset <Font>(k_FontAsap); if (asap != null) { s_HeaderLabel.font = asap; } s_SceneTextBox = new GUIStyle(GUI.skin.box) { wordWrap = false, richText = true, stretchWidth = false, stretchHeight = false, border = new RectOffset(2, 2, 2, 2), padding = new RectOffset(4, 4, 4, 4), alignment = TextAnchor.UpperLeft, normal = new GUIStyleState() { textColor = k_TextColorWhiteNormal, background = IconUtility.GetIcon(k_SceneTextBoxBackgroundNormal) } }; }
public void GetIcon_ArgumentValidPathToTexture_ReturnsValidReference() { Assert.IsNotNull(IconUtility.GetIcon(k_SculpIconPath)); }
public void GetIcon_ArgumentInvalidPathToTexture_ReturnsNull() { Assert.IsNull(IconUtility.GetIcon(k_InvalidPath)); }
public void GetIcon_ArgumentEmptyString_ReturnsNull() { Assert.IsNull(IconUtility.GetIcon(string.Empty)); }
public void GetIcon_ArgumentEmptyString_NoExceptionThrown() { Assert.DoesNotThrow(() => IconUtility.GetIcon(string.Empty)); }