Пример #1
0
        public void AddBmp(Image bmp, Int32 size, Int32 bit)
        {
            // 缩放图片到目标大小
            var ico = new Bitmap(bmp, size, size);

            var ms = new MemoryStream();

            ico.Save(ms, ImageFormat.Bmp);

            var item = new IconItem();

            // bmp要跳过14字节,还要修改高度,png不用
            ms.Position   = 14;
            item.Data     = ms.ReadBytes();
            item.Size     = (UInt32)item.Data.Length;
            item.BitCount = (UInt16)bit;

            item.Width  = (Byte)size;
            item.Height = (Byte)size;

            //// BMP图形和ICO的高不一样  ICO的高是BMP的2倍
            //var h = BitConverter.ToInt32(item.Data, 8);
            //h *= 2;
            //var buf = BitConverter.GetBytes(h);
            //Buffer.BlockCopy(buf, 0, item.Data, 8, buf.Length);
            var h = item.Data.ReadBytes(8, 4).ToInt();

            h *= 2;
            item.Data.Write((UInt32)h, 8);

            Items.Add(item);

            ResetOffset();
        }
Пример #2
0
        public async void selectionChanged()
        {
            if (_listViewContent.SelectedItems.Count > 0)
            {
                //btnAdd.IsEnabled = true;
                if (_listViewContent.SelectedItems.Count == 1) //Mostrar info del Item seleccionado
                {
                    int         selectedMediaId = ((ListViewMediaItem)_listViewContent.SelectedItem).MediaId();
                    media_files mf = await DBManager.MediaFilesRepo.FindByIdAsync(selectedMediaId);

                    showInfoPanel(mf);
                }
                else
                {
                    _infoPanel.Visibility = Visibility.Hidden;
                }

                btnAdd.IsEnabled = checkSelectedFilesExistence();
            }
            else  //Si no hay contenido seleccionado veo si hay seleccion en el explorador
            {
                IconItem iitem = (IconItem)_treeView.SelectedItem;
                _infoPanel.Visibility = Visibility.Hidden;
                if (iitem != null)
                {
                    btnAdd.IsEnabled = iitem.FileExists();
                }
                else
                {
                    btnAdd.IsEnabled = false;
                }
            }
        }
        private void BtnDelete_Click(object sender, RoutedEventArgs e)
        {
            if (current_mf != null)
            {
                MessageBoxResult res = MessageBox.Show("¿Confirma que desea eliminar el archivo del catálogo?", "Información", MessageBoxButton.YesNo);
                if (res == MessageBoxResult.Yes)
                {
                    DBManager.MediaFilesRepo.DeleteEntity(current_mf);

                    IconItem item = (IconItem)_tree.SelectedItem;
                    if (!(item.Parent is TreeView))
                    {
                        ((IconItem)item.Parent).Items.Remove(item);
                    }

                    // ((TreeView)tab.Content).Items.Remove(item);
                    // else
                    //   ((IconItem)item.Parent).Items.Remove(item);

                    HideForm();

                    current_mf       = null;
                    current_treeItem = null;

                    BtnGuardar.IsEnabled = false;
                    BtnDelete.IsEnabled  = false;

                    AppMAnager.GlobalContentChanged();
                }
            }
        }
Пример #4
0
        String GetOptions(RenderContext context, TreeViewItem childElem)
        {
            var sb     = new StringBuilder("{");
            var fsBind = GetBinding(nameof(FolderSelect));

            if (fsBind != null)
            {
                sb.Append($"folderSelect: {fsBind.GetPath(context)},");
            }
            else if (FolderSelect)
            {
                sb.Append("folderSelect: true,");
            }
            var wlBind = GetBinding(nameof(WrapLabel));

            if (wlBind != null)
            {
                sb.Append($"wrapLabel: {wlBind.GetPath(context)},");
            }
            else if (WrapLabel)
            {
                sb.Append("wrapLabel: true,");
            }

            if (IconFolder != Icon.NoIcon && IconItem != Icon.NoIcon)
            {
                sb.Append("hasIcon: true,");
                sb.Append($"staticIcons: ['{IconFolder.ToString().ToKebabCase()}', '{IconItem.ToString().ToKebabCase()}'],");
            }

            childElem.AppendJsValues(sb, context);
            sb.RemoveTailComma();             // tail comma
            sb.Append("}");
            return(sb.ToString());
        }
Пример #5
0
        public void AddPng(Image bmp, Int32 size, Int32 bit)
        {
            // 缩放图片到目标大小
            var ico = new Bitmap(bmp, size, size);

            var ms = new MemoryStream();

            ico.Save(ms, ImageFormat.Png);

            var item = new IconItem();

            item.Data     = ms.ToArray();
            item.Size     = (UInt32)item.Data.Length;
            item.BitCount = (UInt16)bit;

            if (size >= 256)
            {
                size = 0;
            }
            item.Width  = (Byte)size;
            item.Height = (Byte)size;

            Items.Add(item);

            ResetOffset();
        }
Пример #6
0
        private void seekToSelectItem(ItemCollection list, int mediaId)
        {
            foreach (IconItem iitem in list)
            {
                if (iitem.MediaId() == mediaId)
                {
                    iitem.IsSelected = true;
                    iitem.IsExpanded = true;

                    IconItem parent = (IconItem)iitem.Parent;
                    while (parent != null)
                    {
                        parent.IsExpanded = true;
                        if (parent.Parent is IconItem)
                        {
                            parent = (IconItem)parent.Parent;
                        }
                        else
                        {
                            parent = null;
                        }
                    }

                    break;
                }
                else
                {
                    seekToSelectItem(iitem.Items, mediaId);
                }
            }
        }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (e == null)
            {
                return;
            }
            base.OnNavigatedTo(e);
            ConnectedAnimation anim = ConnectedAnimationService.GetForCurrentView().GetAnimation("ForwardConnectedAnimation");

            if (anim != null)
            {
                anim.TryStart(TransitionReceiver);
            }
            if (e.Parameter is IconItem ownIcon)
            {
                icon = ownIcon;
                SymbolIconXAMLCodeSample.Code       = SampleTemplateProvider.GetXAMLSymbolIconCodeFromGlyph(icon.Name);
                SymbolIconCSCodeSample.Code         = SampleTemplateProvider.GetCSSymbolIconCodeFromGlyph(icon.Name);
                ButtonSymbolIconXAMLCodeSample.Code = SampleTemplateProvider.GetXAMLButtonIconFromSymbolName(icon.Name);
                ButtonSymbolIconCSCodeSample.Code   = SampleTemplateProvider.GetCSButtonIconFromSymbolName(icon.Name);

                FontIconXAMLCodeSample.Code       = SampleTemplateProvider.GetXAMLFontIconCodeFromGlyph(icon.StringGlyph);
                FontIconCSCodeSample.Code         = SampleTemplateProvider.GetCSFontIconCodeFromGlyph(icon.StringGlyph);
                ButtonFontIconXAMLCodeSample.Code = SampleTemplateProvider.GetXAMLButtonIconFromGlyph(icon.StringGlyph);
                ButtonFontIconCSCodeSample.Code   = SampleTemplateProvider.GetCSButtonIconFromGlyph(icon.StringGlyph);

                CustomIconCode.Code = SampleTemplateProvider.GetXAMLCustomizedFontIconCode(icon.StringGlyph, FontIconColorPicker.Color.ToString(), ((int)CustomIconFontSize.Value).ToString());
                Bindings.Update();
            }
        }
Пример #8
0
        void Click(IconItem item)
        {
            int  number   = SelectUnit.Count;
            bool selected = !item.IsSelected;

            if (selected)
            {
                number++;
            }
            else
            {
                number--;
            }
            if (number <= Count)
            {
                item.Change(selected);
                if (selected)
                {
                    SelectUnit.Add(item.unit);
                }
                else
                {
                    SelectUnit.Remove(item.unit);
                }
            }
            else
            {
                PanelManager.Instantiate.ErrorPanel.Open("full", 3);
            }
        }
Пример #9
0
            public override bool Equals(object obj)
            {
                IconItem item = obj as IconItem;

                if (item == null)
                {
                    return(false);
                }
                return(Name.Equals(item.Name));
            }
Пример #10
0
        //----- Mostrar el catalogo en la pagina principal-----------------------------------------
        /**Muestra el catalogo en la pagina principal en forma de posters*/

        /*public static void ShowMainCatalogPosters(TabControl tabControl)
         * {
         *   dict_container.Clear();
         * //  dict_category_current_parent.Clear();
         *   tabControl.Items.Clear();
         *   tabControl.ClipToBounds = true;
         *   CategoriasRepository repo = DBManager.CategoriasRepo;
         *   List<categoria> ListaCategorias = repo.List;
         *   if (ListaCategorias.Count > 0)
         *   {
         *       List<media_files> mediaList;
         *       TabItem page;
         *       WrapPanel container;
         *       ModernButton buttonBack;
         *       Grid grid;
         *       ScrollViewer scroll;
         *       foreach (categoria categ in ListaCategorias)
         *       {
         *           page = new TabItem();
         *           page.Header = categ.categoria1;
         *           page.Tag = categ.id;  //PAra las busquedas en la ventana proncipal del catalogo
         *
         *           mediaList = repo.ListFirstMedias(categ.media_files);
         *
         *           scroll = new ScrollViewer();
         *           scroll.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
         *           scroll.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled;
         *           container = new WrapPanel();
         *           container.Orientation = Orientation.Horizontal;
         *           scroll.Content = container;
         *           // container.ViewportWidth = scroll.ViewportWidth;
         *
         *           buttonBack = GetBackButton();
         *           buttonBack.Tag = -1; //En el tag del boton guardo el ID del padre
         *           grid = new Grid();
         *           RowDefinition r0 = new RowDefinition();
         *           r0.Height = new GridLength(35);
         *           grid.RowDefinitions.Add(r0);
         *           grid.RowDefinitions.Add(new RowDefinition());
         *           grid.Tag = categ.id;  //Para el click del boton Atras
         *
         *           container.Tag = buttonBack; //Para poder acceder a el luego
         *
         *           dict_container.Add(categ.id, container);
         *
         *           grid.Children.Add(buttonBack);
         *           Grid.SetRow(buttonBack, 0);
         *           grid.Children.Add(scroll);
         *           Grid.SetRow(scroll, 1);
         *
         *           page.Content = grid;
         *           tabControl.Items.Add(page);
         *
         *           RefreshMediaContainer(mediaList, categ.id, container);
         *       }
         *   }
         *   else
         *       ((Grid) ((Grid)tabControl.Parent).Parent).Visibility = Visibility.Hidden;
         * }
         *
         * // Realiza una busqueda para la categoria y el filtro seleccionados
         * public static void FiltrarCatalogo(TabItem page, string filtro)
         * {
         *   if (page != null)
         *   {
         *       int categId = int.Parse(page.Tag.ToString());
         *
         *       MediaFilesRepository mrepo = DBManager.MediaFilesRepo;
         *       CategoriasRepository categrepo = DBManager.CategoriasRepo;
         *
         *       List<media_files> mediaList;
         *       if (!String.IsNullOrEmpty(filtro))
         *           mediaList = mrepo.AplyFilter(categId, filtro);
         *       else
         *           mediaList = categrepo.ListFirstMedias(categId);
         *
         *       RefreshMediaContainer(mediaList, categId, dict_container[categId]);
         *   }
         * }
         *
         * private static ModernButton GetBackButton()
         * {
         *   GeometryConverter geomConvert = new GeometryConverter();
         *   Geometry iconData = (Geometry)geomConvert.ConvertFromString("F1 M 57,42L 57,34L 32.25,34L 42.25,24L 31.75,24L 17.75,38L 31.75,52L 42.25,52L 32.25,42L 57,42 Z ");
         *   ModernButton buttonBack = new ModernButton();
         *   buttonBack.EllipseDiameter = 30;
         *   buttonBack.IconHeight = 20;
         *   buttonBack.IconWidth = 20;
         *   buttonBack.ToolTip = "Atrás";
         *   buttonBack.Click += new System.Windows.RoutedEventHandler(BackFolderClick);
         *   buttonBack.IconData = iconData;
         *   buttonBack.IsEnabled = false;
         *
         *   return buttonBack;
         * }
         *
         * // Click de ir atras en el catalogo
         * private static void BackFolderClick(object sender, RoutedEventArgs e)
         * {
         *   MediaFilesRepository mediarepo = DBManager.MediaFilesRepo; // new MediaFilesRepository();
         *   int categId = int.Parse( ((Grid)(((ModernButton)sender).Parent)).Tag.ToString() );
         *   int parentId = int.Parse( ((ModernButton)sender).Tag.ToString() );
         *   media_files mediafile =  mediarepo.FindById(parentId);
         *
         *   if(mediafile != null)
         *   {
         *       ((ModernButton)sender).Tag = mediafile.parent_id;
         *       List<media_files> mediaList;
         *       CategoriasRepository repo = DBManager.CategoriasRepo;
         *       categoria categ = repo.FindById(categId);
         *
         *       if (categ != null)
         *       {
         *           if (mediafile.parent_id <= 0)
         *           {
         *               mediaList = repo.ListFirstMedias(categ.media_files);
         *               ((ModernButton)sender).IsEnabled = false;
         *           }
         *           else
         *           {
         *               mediaList = mediarepo.FindByCategoria(categId, (int)mediafile.parent_id);
         *           }
         *
         *           RefreshMediaContainer(mediaList, categId, dict_container[categId]);
         *           PHome._PHome.ClearPageSelection(false);  //false porque se crearan nuevos Posters
         *       }
         *   }
         * }
         *
         * //Carga el contenido de una carpeta MEDia File. Doble Click POster
         * public static void LoadMediaFiles(int categId, int mediaParentId)
         * {
         *   MediaFilesRepository repo = DBManager.MediaFilesRepo; // new MediaFilesRepository();
         *   List<media_files>  mediaList = repo.FindByCategoria(categId, mediaParentId);
         *   WrapPanel container = dict_container[categId];
         *   if (container != null)
         *   {
         *       ((ModernButton)container.Tag).IsEnabled = true; //Boton de ir atras
         *       ((ModernButton)container.Tag).Tag = mediaParentId;
         *
         *       RefreshMediaContainer(mediaList, categId, container);
         *       PHome._PHome.ClearPageSelection(false);  //false porque se crearan nuevos Posters
         *   }
         * }
         *
         * private static void RefreshMediaContainer(List<media_files> mediaList, int categId, WrapPanel container)
         * {
         *   container.Children.Clear();
         *   Poster poster;
         *
         *   foreach (media_files media in mediaList)
         *   {
         *       poster = new Poster(media.fichero_portada, media.titulo, media.id, media.is_folder, categId);
         *       poster.MouseEnter += PosterMouseEnter;
         *       poster.MouseLeave += PosterMouseLeave;
         *       container.Children.Add(poster);
         *   }
         * }
         *
         * private static void PosterMouseEnter(object sender, MouseEventArgs e)
         * {
         *   ((Poster)sender).ShowBorder();
         * }
         *
         * private static void PosterMouseLeave(object sender, MouseEventArgs e)
         * {
         *   ((Poster)sender).HidesBorder();
         * }
         *
         * public static WrapPanel GetHomeWrapPanel(int categId)
         * {
         *   if(dict_container != null && dict_container.Keys.Contains(categId))
         *       return dict_container[categId];
         *
         *   return null;
         * }*/

        //------- Edicion de los registros de MovieFiles en la BD------------------------------------------
        /**Carga los movie files en el tab control Para la edicion*/
        public static async Task Load_Movies_Tree(TreeView treeView, IIconItemClickHandler _iitemClickHandler, Dispatcher _dispatcher, bool foldersOnly)
        {
            // changes_timer.Stop();

            treeView.Items.Clear();
            List <categoria> ListaCategorias = await DBManager.CategoriasRepo.ListAsync;

            List <media_files> mediaList;

            if (ListaCategorias.Count > 0)
            {
                IconItem nodo;
                IconItem nodoCateg;

                await Task.Run(async() =>
                {
                    foreach (categoria categ in ListaCategorias)
                    {
                        /*_dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Background,
                         * (Action)(() => {
                         *
                         * }));*/

                        mediaList = DBManager.MediaFilesRepo.FindByCategoria(categ.id, -1, foldersOnly);

                        await _dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Background,
                                                      (Action)(() =>
                        {
                            nodoCateg = new IconItem(categ.categoria1, true, _iitemClickHandler);   //Nodo categoria padre
                            nodoCateg.Tag = categ.id;
                            treeView.Items.Add(nodoCateg);
                            foreach (media_files mf in mediaList)
                            {
                                nodo = new IconItem(mf.titulo, mf, _iitemClickHandler);
                                nodoCateg.Items.Add(nodo);    //treeView.Items.Add(nodo);

                                if (mf.is_folder)
                                {
                                    FillMovieChildrens(nodo, categ.id, mf.id, _iitemClickHandler, foldersOnly);
                                }

                                //Verificar si el MF no existe fisicamente lo notifico
                                CheckMF_Exists(mf);
                            }
                        }));
                    }
                });
            }
            else
            {
                ((Grid)treeView.Parent).Visibility = Visibility.Hidden;
            }

            //  changes_timer.Start();
        }
            protected override AdvancedDropdownItem BuildRoot()
            {
                var item = new IconItem(string.Empty);

                foreach (var icon in icons)
                {
                    var child = item.FindOrCreate(icon, s => new IconItem(s));
                    child.name = icon;
                    child.icon = EditorGUIUtility.IconContent(icon).image as Texture2D;
                }
                item.OrderByGroupFirst();
                return(item);
            }
Пример #12
0
 public override void OnUpdate()
 {
     while (BriskItem.Count > 0)
     {
         IconItem item = BriskItem.Dequeue();
         item.Close();
         IdelItem.Enqueue(item);
     }
     for (int i = 0; i < UnitAry.Count; i++)
     {
         IconItem item = GetItem;
         item.SetData(UnitAry[i]);
         BriskItem.Enqueue(item);
     }
 }
Пример #13
0
        /** Adicionar elemento a la lista de copia*/
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            if (firstAddition)
            {
                ShowCopyList();
                firstAddition = false;
            }

            media_files mf;
            string      btnxaml = XamlWriter.Save(btnDelete);

            if (_listViewContent.SelectedItems.Count > 0)
            {
                bool fileExist;
                foreach (ListViewMediaItem item in _listViewContent.SelectedItems)
                {
                    mf = DBManager.MediaFilesRepo.FindById(item.MediaId());

                    if (mf.is_folder)
                    {
                        fileExist = Directory.Exists(mf.file_url);
                    }
                    else
                    {
                        fileExist = File.Exists(mf.file_url);
                    }

                    if (mf != null && !inList(mf.id) && fileExist)
                    {
                        btnCopy.IsEnabled = true;
                        addMediaToCopyList(mf, btnxaml);
                    }
                }
            }
            else  //Si no hay contenido seleccionado veo si hay seleccion en el explorador
            {
                IconItem iitem = (IconItem)_treeView.SelectedItem;
                if (iitem != null)
                {
                    mf = DBManager.MediaFilesRepo.FindById(iitem.MediaId());
                    if (mf != null && !inList(mf.id))
                    {
                        btnCopy.IsEnabled = true;
                        addMediaToCopyList(mf, btnxaml);
                    }
                }
            }
        }
Пример #14
0
 void Update()
 {
     for (int i = use.Count - 1; i >= 0; i--)
     {
         IconItem item = use[i];
         float    move = item.speed * Time.deltaTime;
         if (Vector3.Distance(item.target, item.transform.position) < move)
         {
             pool.Add(item);
             use.RemoveAt(i);
             item.transform.localScale = Vector3.zero;
             return;
         }
         item.transform.position += (item.target - item.transform.position).normalized * move;
     }
 }
Пример #15
0
        static IconItem GetNewIcon()
        {
            if (root == null)
            {
                GameObject go = new GameObject();
                go.AddComponent <IconMove>();
                go.name = "IconMovePool";
                root    = go.transform;
                root.SetParent(FindObjectOfType <Canvas>().transform, false);
                root.position = Vector3.zero;
                prefab        = CreateUI.NewImage();
            }
            IconItem item = new IconItem(GameObject.Instantiate <GameObject>(prefab));

            return(item);
        }
Пример #16
0
    // Start is called before the first frame update
    void Start()
    {
        foreach (var child in GetComponentsInChildren <Button>())
        {
            child.onClick.AddListener(() =>
            {
                Sprite s    = child.GetComponent <Image>().sprite;
                IconItem ii = child.GetComponent <IconItem>();


                if (iconAction != null)
                {
                    iconAction(s, ii.path);
                }
            });
        }
    }
Пример #17
0
        static IconItem GetNewIcon()
        {
            if (root == null)
            {
                GameObject go = new GameObject();
                go.name = "IconMove";
                root    = go.transform;
                root.SetParent(Object.FindObjectOfType <Canvas>().transform, false);
                root.position = Vector3.zero;
                prefab        = CreateUI.NewImage();
                prefab.transform.SetParent(root);
                prefab.transform.localScale = Vector3.zero;
            }
            IconItem item = new IconItem(Object.Instantiate(prefab));

            return(item);
        }
Пример #18
0
        private async Task SwitchHeader(IconItem item, bool isRefresh = false)
        {
            if (item.Name == StaticString.MESSAGE_REPLYME)
            {
                await InitReply(isRefresh);
            }
            else if (item.Name == StaticString.MESSAGE_AT)
            {
                await InitAt(isRefresh);
            }
            else if (item.Name == StaticString.MESSAGE_LIKE)
            {
                await InitLike(isRefresh);
            }
            await InitHeader();

            await App.BiliViewModel.CheckUnreadMessage();
        }
        private void IconView_ItemClicked(object sender, ItemClickedEventArgs <ItemModelBase> e)
        {
            selectedId = e.Child.Id;

            ItemModelBase model;

            details.Title = "Component";
            model         = new ComponentModel(e.Child.ParentId, e.Child.Id);

            details.ItemName    = model.Description;
            details.DisplayName = model.DisplayName;
            details.Price       = model.Price;

            details.Set(e.Child.Id, 1, false);

            details.ParentId = parent;

            IconItem <ItemModelBase> icon = (IconItem <ItemModelBase>)sender;

            if (level == 1)
            {
                ;
            }
            else
            {
                if (fullViewSelected && icon.IsChecked)
                {
                    details.EnableGroup();
                    ComponentModel subModel = new ComponentModel(parent, e.Child.Id, true);
                    details.Group = subModel.Group;
                }
                else if (fullViewSelected && !icon.IsChecked)
                {
                    details.DisableGroup();
                    details.Group = 0;
                }
                else if (!fullViewSelected)
                {
                    details.EnableGroup();
                    ComponentModel subModel = new ComponentModel(parent, e.Child.Id, true);
                    details.Group = subModel.Group;
                }
            }
        }
Пример #20
0
    // Start is called before the first frame update
    void Start()
    {
        ShowName id = ShowName.ICON1;

        foreach (Transform tran in transform)
        {
            IconItem ii = tran.gameObject.AddComponent <IconItem>();
            ShowItem si = tran.gameObject.AddComponent <ShowItem>();


            si.Init(id);
            id++;


            si.AddListener(() =>
            {
                selectItem = si;
                iItem      = ii;
            });
        }
    }
Пример #21
0
        /**Verifica si el MovieFile tiene hijos y los inserta en el TreeItem*/
        public static async void FillMovieChildrens(IconItem nodo, int categId, int mediaPArentId, IIconItemClickHandler _iitemClickHandler, bool foldersOnly)
        {
            MediaFilesRepository mediaRepo = DBManager.MediaFilesRepo; // new MediaFilesRepository();
            List <media_files>   mediaList = await mediaRepo.FindByCategoriaAsync(categId, mediaPArentId, foldersOnly);

            if (mediaList.Count > 0)
            {
                IconItem child;
                foreach (media_files mf in mediaList)
                {
                    child = new IconItem(mf.titulo, mf, _iitemClickHandler);
                    nodo.Items.Add(child);
                    if (mf.is_folder)
                    {
                        FillMovieChildrens(child, categId, mf.id, _iitemClickHandler, foldersOnly);
                    }

                    //Verificar si el MF no existe fisicamente lo notifico
                    CheckMF_Exists(mf);
                }
            }
        }
Пример #22
0
    private static void SetPath()
    {
        foreach (GameObject go in Selection.gameObjects)
        {
            foreach (Transform tran in go.transform)
            {
                if (tran.GetComponent <Image>() == null)
                {
                    continue;
                }
                Sprite s    = tran.GetComponent <Image>().sprite;
                string path = AssetDatabase.GetAssetPath(s);
                path = Application.dataPath + path.Substring(6);
                Debug.Log(path);
                IconItem ii = tran.GetComponent <IconItem>();
                if (ii == null)
                {
                    tran.gameObject.AddComponent <IconItem>();
                }

                ii.path = path;
            }
        }
    }
Пример #23
0
        public void Reset()
        {
            if (HeaderCollection.Count == 0)
            {
                var headers = IconItem.GetMessageHeaderItems();
                headers.ForEach(p => HeaderCollection.Add(p));
            }
            else
            {
                foreach (var header in HeaderCollection)
                {
                    header.Param = "";
                }
            }
            ReplyCollection.Clear();
            AtCollection.Clear();
            LikeCollection.Clear();
            LoadingRing.IsActive       = false;
            NoDataContainer.Visibility = Visibility.Collapsed;

            _replyCursor = null;
            _likeCursor  = null;
            _atCursor    = null;
        }
Пример #24
0
        public override void Update(float deltaTime)
        {
            if (m_lastCounterArray != CardData.Counters)
            {
                IconItem[] newArray = new IconItem[MaxIcons];
                int newIndex = 0;
                for (int i = 0; i < Math.Min(CardData.Counters.Count, MaxIcons); ++i)
                {
                    var counter = CardData.Counters[i];
                    int oldIndex = m_icons.FindIndex(item => item.EqualsTo(counter));
                    if (oldIndex >= 0)
                    {
                        newArray[newIndex] = m_icons[oldIndex];
                        newArray[newIndex].m_counterData = counter;
                        newArray[newIndex].m_ui.CounterData = counter;
                        newArray[newIndex++].m_ui.Dispatcher = null;
                        m_icons[oldIndex].m_counterData = null;
                    }
                    else
                    {
                        newArray[newIndex].m_counterData = counter;
                        newArray[newIndex].m_ui = new Icon
                        {
                            CounterData = counter,
                            TextLabel = m_label,
                            TextPanel = m_labelPanel,
                            CounterNumberColor = Color.White,
                            CounterNumberFormatOptions = m_counterFmtOptions,
                            LabelTextFormatOptions = m_textFmtOptions
                        };
                        newArray[newIndex++].m_ui.Initialize();
                    }
                }

                foreach (var oldItem in m_icons)
                {
                    if (oldItem.m_counterData != null)
                    {
                        oldItem.m_ui.ReleaseTexture();
                        oldItem.m_ui.Dispatcher = null;
                    }
                }

                var fromY = (Control.Region.Height - (IconSize + Interval) * MaxIcons + Interval) / 2;
                for (int i = 0; i < newArray.Length; ++i)
                {
                    var newItem = newArray[i];
                    if (newItem.m_ui != null)
                    {
                        newItem.m_ui.Transform = MatrixHelper.Translate(0, fromY + i * (IconSize + Interval), 0);
                        newItem.m_ui.Dispatcher = Control.BodyContainer;
                        newItem.m_ui.UpdateCounter();
                    }
                }
                m_icons = newArray;
                m_lastCounterArray = CardData.Counters;
            }

            m_labelPanel.Dispatcher = m_label.FormattedText != null ? GameApp.Service<Services.GameUI>().InGameUIPage.Style.ChildIds["World2D"].Target : null;
            m_label.Dispatcher = m_label.FormattedText != null ? GameApp.Service<Services.GameUI>().InGameUIPage.Style.ChildIds["World2D"].Target : null;
        }
Пример #25
0
 public IconDemo()
 {
     InitializeComponent();
     _lv.Data   = IconItem.GetAllIcons();
     _lv.Filter = OnFilter;
 }
        /**Carga un mediaFile al formulario*/
        public void LoadMediaFile(media_files mf, IconItem iitem)
        {
            if (_formControl.Visibility == Visibility.Hidden)
            {
                ShowForm();

                /* _c1.Width = c1Width;
                 * _cForm.Width = new GridLength(680);
                 * _formControl.Visibility = Visibility.Visible;*/
            }

            if (mf.is_folder)
            {
                lfichero.Text                = "Carpeta";
                lDuracion.Visibility         = Visibility.Hidden;
                tbDuracion.Visibility        = Visibility.Hidden;
                _rowSubtitleLAbel.Height     = new GridLength(0);
                _rowSubtitleTextField.Height = new GridLength(0);
                chbxSaveRecursive.Visibility = Visibility.Visible;
            }
            else
            {
                lfichero.Text                = "Archivo de película";
                lDuracion.Visibility         = Visibility.Visible;
                tbDuracion.Visibility        = Visibility.Visible;
                _rowSubtitleLAbel.Height     = new GridLength(25);
                _rowSubtitleTextField.Height = new GridLength(25);
                chbxSaveRecursive.Visibility = Visibility.Hidden;
            }

            tbTitulo.Text    = mf.titulo;
            tbFichero.Text   = mf.file_url;
            tbSubtitulo.Text = mf.str_file;

            LoadPortadaFile(mf.fichero_portada);

            tbDirector.Text   = mf.director;
            tbAnno.Text       = mf.anno.ToString();
            tbDuracion.Text   = mf.duracion.ToString();
            tbProductora.Text = mf.productora;
            tbReparto.Text    = mf.reparto;
            tbSinopsis.Text   = mf.sinopsis;
            tbPremios.Text    = mf.premios;
            tbTrailer.Text    = mf.fichero_trailer;

            List <genero> generos_list = new List <genero>();

            foreach (media_generos mg in mf.media_generos)
            {
                generos_list.Add(mg.genero);
            }
            RefreshMediaGeneros(generos_list);

            List <pais> paises_list = new List <pais>();

            foreach (media_paises mp in mf.media_paises)
            {
                paises_list.Add(mp.pais);
            }
            RefreshMediaPaises(paises_list);

            current_mf       = mf;
            current_treeItem = iitem;

            BtnOpenSubtitle.IsEnabled = !mf.is_folder;
            lSubtitulo.IsEnabled      = !mf.is_folder;


            chbxSaveRecursive.IsChecked = false;
            // BtnOpenPortada.IsEnabled = !mf.is_folder;

            BtnGuardar.IsEnabled = true;
            BtnDelete.IsEnabled  = true;
        }
Пример #27
0
        public static void Extract(STUD itemStud, string output, string heroName, string itemName, string itemGroup, Dictionary <ushort, List <ulong> > track, Dictionary <ulong, Record> map, CASCHandler handler, bool quiet, OverToolFlags flags)
        {
            string path = string.Format("{0}{1}{2}{1}{3}{1}{5}{1}{4}.dds", output, Path.DirectorySeparatorChar, Util.Strip(Util.SanitizePath(heroName)), Util.SanitizePath(itemStud.Instances[0].Name), Util.SanitizePath(itemName), Util.SanitizePath(itemGroup));

            if (itemStud.Instances == null)
            {
                return;
            }
            IconItem item = (IconItem)itemStud.Instances[0];

            if (item == null)
            {
                return;
            }
            if (!map.ContainsKey(item.Data.decal.key))
            {
                return;
            }
            STUD decalStud = new STUD(Util.OpenFile(map[item.Data.decal.key], handler));

            if (decalStud.Instances == null)
            {
                return;
            }
            Decal decal = (Decal)decalStud.Instances[0];

            if (decal == null)
            {
                return;
            }
            if (!map.ContainsKey(decal.Records[0].definiton.key))
            {
                return;
            }

            ImageDefinition definition = new ImageDefinition(Util.OpenFile(map[decal.Records[0].definiton.key], handler));

            ulong imageKey = definition.Layers[0].Key;

            if (!map.ContainsKey(imageKey))
            {
                return;
            }
            if (!Directory.Exists(Path.GetDirectoryName(path)))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(path));
            }

            ulong imageDataKey = (imageKey & 0xFFFFFFFFUL) | 0x100000000UL | 0x0320000000000000UL;

            using (Stream outp = File.Open(path, FileMode.Create, FileAccess.Write)) {
                if (map.ContainsKey(imageDataKey))
                {
                    Texture tex = new Texture(Util.OpenFile(map[imageKey], handler), Util.OpenFile(map[imageDataKey], handler));
                    tex.Save(outp);
                }
                else
                {
                    TextureLinear tex = new TextureLinear(Util.OpenFile(map[imageKey], handler));
                    tex.Save(outp);
                }
            }
            if (!quiet)
            {
                Console.Out.WriteLine("Wrote icon {0}", path);
            }
        }
Пример #28
0
 public void Init(ShowName id)
 {
     ID    = id;
     image = GetComponent <Image>();
     ii    = GetComponent <IconItem>();
 }
Пример #29
0
        protected override void OnDrawItem(DrawItemEventArgs e)
        {
            // Make sure we're not trying to draw something that isn't there.
            if (e.Index >= this.Items.Count || e.Index <= -1)
            {
                return;
            }



            // Get the item object.
            var it = this.Items[e.Index];

            if (!(it is IconItem))
            {
                return;
            }
            IconItem item = (IconItem)it;

            if (item.Image == null)
            {
                return;
            }


            // Draw the background color depending on
            // if the item is selected or not.
            if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
            {
                // The item is selected.
                // We want a blue background color.
                e.Graphics.FillRectangle(new SolidBrush(Color.DarkSeaGreen), e.Bounds);
            }
            else
            {
                // The item is NOT selected.
                // We want a white background color.
                e.Graphics.FillRectangle(new SolidBrush(Color.White), e.Bounds);
            }

            // icon title
            string text;

            if (item.Tag != null)
            {
                text = item.Tag;
            }
            else
            {
                text = string.Format("0x{0:x8}", item.Flag);
            }

            // draw the text.
            var   font       = new Font(this.Font, FontStyle.Bold);
            SizeF stringSize = e.Graphics.MeasureString(text, font);

            e.Graphics.DrawString(text, font, new SolidBrush(Color.Black),
                                  new PointF(60, e.Bounds.Y + (e.Bounds.Height - stringSize.Height) / 2));

            // draw the bitmap
            Image image = new Bitmap(item.Image);

            e.Graphics.DrawImage(image, 15, e.Bounds.Y + 6, item.Width, item.Height > this.ItemHeight - 6 ? this.ItemHeight - 6 : item.Height);
            e.Graphics.Save();
        }