Пример #1
0
        public override System.Windows.FrameworkElement CreateLogIcon()
        {
            var color = IconUtils.GetTeamColor(Team);

            var grid = IconUtils.CreateBaseLogIcon(color);

            SolidColorBrush textColor = Brushes.Black;

            switch (Team)
            {
            case TeamID.Blue:
            case TeamID.Red:
            case TeamID.Pink:
                textColor = Brushes.White;
                break;
            }

            var label = new Label
            {
                Content                    = string.Format(CultureInfo.InvariantCulture, "{0:+##;-##;+0}", CurrentPoint - OldPoint),
                Foreground                 = textColor,
                HorizontalAlignment        = System.Windows.HorizontalAlignment.Center,
                HorizontalContentAlignment = System.Windows.HorizontalAlignment.Center,
            };

            grid.Children.Add(label);

            return(grid);
        }
Пример #2
0
 public void TrayIconChanging(AddonTrayIconEventArgs e)
 {
     if (SystemParameters.HighContrast)
     {
         e.Icon = IconUtils.ColorIcon(e.Icon, e.Kind, SystemColors.WindowTextColor);
     }
 }
        public override FrameworkElement CreateLogIcon()
        {
            var arrow_source = IconUtils.GetImageSource("icon_arrow");

            var color = IconUtils.GetTeamColor(NewTeam);

            var new_team_icon = IconUtils.CreateTeamIcon(NewTeam);

            new_team_icon.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;
            new_team_icon.Margin = new System.Windows.Thickness(2);
            new_team_icon.Width  = 26;

            var old_team_icon = IconUtils.CreateTeamIcon(OldTeam);

            old_team_icon.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            old_team_icon.Margin = new System.Windows.Thickness(2);
            old_team_icon.Width  = 26;

            var arrow_image = new Image
            {
                Source              = arrow_source,
                Stretch             = Stretch.Uniform,
                HorizontalAlignment = System.Windows.HorizontalAlignment.Center,
                Margin              = new System.Windows.Thickness(2),
                Width = 26,
            };

            var grid = IconUtils.CreateBaseLogIcon(color);

            grid.Children.Add(old_team_icon);
            grid.Children.Add(arrow_image);
            grid.Children.Add(new_team_icon);

            return(grid);
        }
Пример #4
0
        private void InitImageList(ImageList iconList, string path)
        {
            if (!Directory.Exists(path))
            {
                return;
            }

            var baseIcon = IconUtils.GetIcon(path);

            if (baseIcon != null)
            {
                iconList.Images.Add(DIRECTORY_ICON, baseIcon);
            }

            var files = Directory.GetFiles(path, "*", SearchOption.AllDirectories);

            foreach (var filePath in files)
            {
                var ext = GetExtension(filePath);
                if (!iconList.Images.ContainsKey(ext))
                {
                    iconList.Images.Add(ext, Icon.ExtractAssociatedIcon(filePath));
                }
            }
        }
Пример #5
0
        public override FrameworkElement CreateLogIcon()
        {
            var player_source = IconUtils.GetImageSource(Player.Class.ToLowerInvariant());
            var spawn_source  = IconUtils.GetImageSource("icon_respawn");

            var color = IconUtils.GetTeamColor(Player.Team);

            var spawn_image = new Image
            {
                Source              = spawn_source,
                Stretch             = Stretch.Uniform,
                HorizontalAlignment = System.Windows.HorizontalAlignment.Center,
                Margin              = new System.Windows.Thickness(2),
                Width = 26,
            };

            var player_image = new Image
            {
                Source              = player_source,
                Stretch             = Stretch.Uniform,
                HorizontalAlignment = System.Windows.HorizontalAlignment.Left,
                Margin              = new System.Windows.Thickness(2),
                Width = 26,
            };

            var grid = IconUtils.CreateBaseLogIcon(color);

            grid.Children.Add(player_image);
            grid.Children.Add(spawn_image);

            return(grid);
        }
Пример #6
0
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     if (value != null)
     {
         return(IconUtils.GetResourceIcon(value.ToString()));
     }
     return(null);
 }
Пример #7
0
        private static void IconPropertyChanged(BindableObject bindable, object oldValue, object newValue)
        {
            var       control   = (FontIcon)bindable;
            string    iconName  = newValue.ToString();
            IconUtils iconUtils = new IconUtils();

            control.icon.Text = iconUtils.GetIcon(iconName);
        }
Пример #8
0
        public void UWPListRefesh()
        {
            if (Inited)
            {
                listUwpApps.Show();
                pl_UWPEnumFailTip.Hide();
                listUwpApps.Items.Clear();

                if (!M_UWP_EnumUWPApplications())
                {
                    listUwpApps.Hide();
                    pl_UWPEnumFailTip.Show();
                    lbUWPEnumFailText.Text = LanuageMgr.GetStr("UWPEnumFail", false);
                    return;
                }


                int count = M_UWP_GetUWPApplicationsCount();
                for (int i = 0; i < count; i++)
                {
                    UWP_PACKAGE_INFO info = M_UWP_GetUWPApplicationAt((uint)i);

                    TaskMgrListItem li = new TaskMgrListItem(info.DisplayName);
                    li.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem());
                    li.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem());
                    li.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem());
                    li.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem());
                    li.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem());
                    li.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem());
                    li.SubItems[0].Font = listUwpApps.Font;
                    li.SubItems[1].Font = listUwpApps.Font;
                    li.SubItems[2].Font = listUwpApps.Font;
                    li.SubItems[0].Text = info.DisplayName;
                    li.SubItems[1].Text = info.AppPackageFullName;
                    li.SubItems[2].Text = info.InstallPath;
                    li.SubItems[3].Text = info.AppUserModelId;
                    li.Tag      = info;
                    li.IsUWPICO = true;
                    if (info.IconBackgroundColor != 0 && info.IconBackgroundColor != 65535 && info.IconBackgroundColor != 30720)
                    {
                        li.UWPIcoColor = Uint32StrToColor((uint)info.IconBackgroundColor);
                    }

                    string iconpath = UWPSearchIcon(info.InstallPath, info.IconPath);
                    if (iconpath != "" && MFM_FileExist(iconpath))
                    {
                        using (Image img = Image.FromFile(iconpath))
                            li.Icon = IconUtils.ConvertToIcon(img);
                        // li.Image = IconUtils.GetThumbnail(new Bitmap(iconpath), 16, 16);
                    }
                    listUwpApps.Items.Add(li);
                }
            }
        }
        /// <summary>
        /// Add CSS declarations for event category.
        /// </summary>
        /// <param name="page"></param>
        protected void addCssForEventCategory(CmsPage page, CmsLanguage lang)
        {
            // -- note: the colour of events is now assigned in the JSON feed

            // -- add CSS for icons.
            string appPath = CmsContext.ApplicationPath;
            Set    iconSet = IconUtils.getIconSet(CmsContext.ApplicationPath, false);

            foreach (string i in iconSet)
            {
                page.HeadSection.AddCSSStyleStatements(IconUtils.getIconCss(appPath, false, i, "EventCategory_file"));
            }
        }
Пример #10
0
        public void ShouldSetListenerIconForAsset()
        {
            var asset = CreateAsset();
            var icon  = new ScriptableIcon(ScriptableIconType.Listener);

            Assert.True(IconUtils.TrySetIcon(asset, icon));

            var metaText     = File.ReadAllText(AssetMetaPath);
            var iconGuid     = GetIconGuid("IconListener");
            var iconMetaText = GetIconMetaText(iconGuid);

            Assert.True(metaText.Contains(iconMetaText));
        }
Пример #11
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            ImageSource ret      = null;
            var         iconInfo = (IconLoadInfo)value;

            if (iconInfo.IsLoadComplete)
            {
                return(iconInfo.CachedValue);
            }

            try
            {
                if (iconInfo.IsDesktopApp)
                {
                    if (!string.IsNullOrWhiteSpace(iconInfo.IconPath))
                    {
                        var iconPath  = new StringBuilder(iconInfo.IconPath);
                        int iconIndex = Shlwapi.PathParseIconLocationW(iconPath);
                        if (iconIndex != 0)
                        {
                            ret = IconUtils.GetIconAsImageSourceFromFile(iconPath.ToString(), iconIndex);
                        }
                        else
                        {
                            using (var icon = System.Drawing.Icon.ExtractAssociatedIcon(iconInfo.IconPath))
                            {
                                ret = icon.ToImageSource();
                            }
                        }
                    }
                }
                else
                {
                    var bitmap = new BitmapImage();
                    bitmap.BeginInit();
                    bitmap.CacheOption = BitmapCacheOption.OnLoad;
                    bitmap.UriSource   = new Uri(iconInfo.IconPath);
                    bitmap.EndInit();
                    ret = bitmap;
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine($"Failed to load icon: {ex}");
            }

            iconInfo.IsLoadComplete = true;
            iconInfo.CachedValue    = ret;
            return(ret);
        }
Пример #12
0
 public void TrayIconChanging(AddonTrayIconEventArgs e)
 {
     if (!SystemParameters.HighContrast)
     {
         if (SystemSettings.IsSystemLightTheme)
         {
             e.Icon = IconUtils.ColorIcon(e.Icon, e.Kind, Colors.Black);
         }
         else
         {
             // It's the default so don't bother doing anything.
         }
     }
 }
Пример #13
0
        public override System.Windows.FrameworkElement CreateLogIcon()
        {
            var grid = IconUtils.CreateBaseLogIcon(Brushes.Black);

            var label = new Label
            {
                Content                    = string.Format(CultureInfo.InvariantCulture, "{0}", CurrentStage.ToString()),
                Foreground                 = Brushes.White,
                HorizontalAlignment        = System.Windows.HorizontalAlignment.Center,
                HorizontalContentAlignment = System.Windows.HorizontalAlignment.Center,
            };

            grid.Children.Add(label);

            return(grid);
        }
        /// <summary>
        /// Render the html to display an attached file
        /// </summary>
        /// <param name="lang"></param>
        /// <param name="f"></param>
        /// <param name="u"></param>
        /// <returns></returns>
        protected string renderAttachedFile(CmsLanguage lang, FileLibraryDetailsData f, WebPortalUser u, CmsUrlFormat fileUrlFormat)
        {
            CmsPage detailsFilePage = CmsContext.getPageById(f.DetailsPageId);

            if (detailsFilePage.Zone.canRead(u) || detailsFilePage.Zone.canWrite(u))
            {
                string iconTag     = IconUtils.getIconTag(CmsContext.ApplicationPath, false, f.fileExtension);
                string urlDownload = FileLibraryDetailsData.getDownloadAnchorHtml(detailsFilePage, f.Identifier, lang, f.FileName, f.FileName, "_blank", "", fileUrlFormat);

                string urlPage = detailsFilePage.getUrl(lang);
                urlPage = "&#160;&#160;<a href=\"" + urlPage + "\" class=\"rightArrowLink\">" + getSeeFileDetailsText(lang) + "</a>";

                return(iconTag + " " + urlDownload + urlPage);
            }
            return("");
        }
        public virtual FrameworkElement CreateLogIcon()
        {
            var grid = IconUtils.CreateBaseLogIcon(Brushes.Black);

            var label = new Label
            {
                Content                    = Type.ToString(),
                Foreground                 = Brushes.White,
                HorizontalAlignment        = HorizontalAlignment.Center,
                HorizontalContentAlignment = HorizontalAlignment.Center,
            };

            grid.Children.Add(label);

            return(grid);
        }
Пример #16
0
 public static Icon GetDesktopIconFromFile(string path)
 {
     if (!string.IsNullOrWhiteSpace(path))
     {
         var iconPath  = new StringBuilder(path);
         int iconIndex = Shlwapi.PathParseIconLocationW(iconPath);
         if (iconIndex != 0)
         {
             return(IconUtils.ShellExtractIcon(iconPath.ToString(), iconIndex));
         }
         else
         {
             return(System.Drawing.Icon.ExtractAssociatedIcon(path));
         }
     }
     return(null);
 }
Пример #17
0
        private Gdk.Pixbuf GetImage(VolumeItem item)
        {
            Gdk.Pixbuf img = null;

            if (App.Settings.ShowThumbsInItemLists)
            {
                int sz = IconUtils.GetIconSizeVal(ICON_SIZE);
                img = PathUtil.GetThumb(item, database, sz);
            }

            if (img == null)
            {
                img = itemIcons.GetIconForItem(item, ICON_SIZE);
            }

            return(img);
        }
        public override FrameworkElement CreateLogIcon()
        {
            var current_source = IconUtils.GetImageSource(CurrentClass.ToLowerInvariant());
            var old_source     = IconUtils.GetImageSource(OldClass.ToLowerInvariant());
            var arrow_source   = IconUtils.GetImageSource("icon_arrow");

            var color = IconUtils.GetTeamColor(Player.Team);

            var old_image = new Image
            {
                Source              = old_source,
                Stretch             = Stretch.Uniform,
                HorizontalAlignment = HorizontalAlignment.Left,
                Margin              = new Thickness(2),
                Width = 26,
            };

            var arrow_image = new Image
            {
                Source              = arrow_source,
                Stretch             = Stretch.Uniform,
                HorizontalAlignment = HorizontalAlignment.Center,
                Margin              = new Thickness(2),
                Width = 26,
            };

            var current_image = new Image
            {
                Source              = current_source,
                Stretch             = Stretch.Uniform,
                HorizontalAlignment = HorizontalAlignment.Right,
                Margin              = new Thickness(2),
                Width = 26,
            };

            var grid = IconUtils.CreateBaseLogIcon(color);

            grid.Children.Add(current_image);
            grid.Children.Add(arrow_image);
            grid.Children.Add(old_image);

            return(grid);
        }
Пример #19
0
        private TaskMgrListItem UWPForceReadAddItem(string fullName, string appfimalyid, string installDir, string dsbName, string logoPath, string bgColor)
        {
            UWP_PACKAGE_INFO info = new UWP_PACKAGE_INFO();

            info.AppPackageFullName   = fullName;
            info.AppPackageFamilyName = appfimalyid;
            info.DisplayName          = dsbName;
            info.IconPath             = logoPath;
            info.InstallPath          = installDir;

            TaskMgrListItem li = new TaskMgrListItem(info.DisplayName);

            li.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem());
            li.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem());
            li.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem());
            li.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem());
            li.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem());
            li.SubItems.Add(new TaskMgrListItem.TaskMgrListViewSubItem());
            li.SubItems[0].Font = listUwpApps.Font;
            li.SubItems[1].Font = listUwpApps.Font;
            li.SubItems[2].Font = listUwpApps.Font;
            li.SubItems[0].Text = info.DisplayName;
            li.SubItems[1].Text = info.AppPackageFullName;
            li.SubItems[2].Text = info.InstallPath;
            li.SubItems[3].Text = info.AppUserModelId;
            li.Tag = info;
            if (bgColor != "" && bgColor != "transparent")
            {
                li.UWPIcoColor = MainUtils.HexStrToColor(bgColor);
            }
            li.IsUWPICO = true;

            string iconpath = UWPSearchIcon(info.InstallPath, info.IconPath);

            if (iconpath != "" && MFM_FileExist(iconpath))
            {
                using (Image img = Image.FromFile(iconpath))
                    li.Icon = IconUtils.ConvertToIcon(img);
            }
            listUwpApps.Items.Add(li);
            return(li);
        }
        /// <summary>
        /// Render left hand side of the file details page (file icon and size)
        /// </summary>
        /// <param name="detailsPage"></param>
        /// <param name="identifier"></param>
        /// <param name="lang"></param>
        /// <param name="fileData"></param>
        /// <returns></returns>
        protected string renderLeftPane(CmsPage detailsPage, int identifier, CmsLanguage lang, FileLibraryDetailsData fileData, CmsUrlFormat fileUrlFormat)
        {            
            string fName = fileData.FileName;
            StringBuilder html = new StringBuilder();
            html.Append("<div style=\"float: left; text-align: center;\">" + EOL);

            string iconTag = IconUtils.getIconTag(CmsContext.ApplicationPath, true, fileData.fileExtension);
            html.Append(renderDiv(FileLibraryDetailsData.getDownloadAnchorHtml(detailsPage, identifier, lang, fName, iconTag, "_blank", "", fileUrlFormat)));

            html.Append(renderDiv(FileLibraryDetailsData.getDownloadAnchorHtml(detailsPage, identifier, lang, fName, getDownloadText(lang), "_blank", "downloadLink", fileUrlFormat)));

            html.Append("<p style=\"font-style: italic; font-size: smaller;\">(" + getLinkOpensNewWindowText(lang) + ")</p>" + EOL);

            html.Append(renderDiv(getFileTypeName(fileData)));
            long size = FileLibraryDetailsData.getFileSize(detailsPage, identifier, lang, fName);
            html.Append(renderDiv(StringUtils.formatFileSize(size)));

            html.Append("</div>" + EOL);
            return html.ToString();
        }
Пример #21
0
        static frmSpectra()
        {
            // Load up category info, attempt to find icons registered with the operating system.
            var mainIcon = IconUtils.LoadIconFromAssembly(typeof(frmSpectra), "Icons.Spectra.ico", 16, 16);

            MainCategory      = new CategoryInfo("Files", mainIcon);
            XCaliburCategory  = CategoryForType("XCalibur", IconUtils.GetIconForFileType("raw", IconSize.Small, false, false, false));
            AgilentCategory   = CategoryForType("Agilent", IconUtils.GetIconForFileType("wiff", IconSize.Small, false, false, false));
            MicromassCategory = CategoryForType("Micromass",
                                                IconUtils.AttemptIconForFile(new String[] { @"C:\MassLynx\mlynx.exe",
                                                                                            @"C:\MassLynx\mlynx3.exe",
                                                                                            @"C:\MassLynx\mlynx4.exe",
                                                                                            @"C:\MassLynx\mlynx5.exe",
                                                                                            @"C:\Program Files\MassLynx\mlynx.exe",
                                                                                            @"C:\Program Files\MassLynx\mlynx3.exe",
                                                                                            @"C:\Program Files\MassLynx\mlynx4.exe",
                                                                                            @"C:\Program Files\MassLynx\mlynx5.exe" },
                                                                             IconSize.Small, false, false, false));
            // Who knows what's associated with .s files
            SFileCategory  = CategoryForType("S-File", IconUtils.LoadIconFromAssembly(typeof(frmSpectra), "Icons.SFile.ico", 16, 16));
            BrukerCategory = CategoryForType("Bruker", IconUtils.GetIconForFileType("ser", IconSize.Small, false, false, false));
        }
Пример #22
0
        public static Icon Create(IconKind kind)
        {
            switch (kind)
            {
            case IconKind.Invalid: throw new InvalidOperationException("invalid icon");

            case IconKind.OriginalIcon: return(new Icon(Application.GetResourceStream(new Uri("pack://application:,,,/EarTrumpet;component/Assets/Tray.ico")).Stream));

            default:
                try
                {
                    return(IconUtils.GetIconFromFile(Interop.SndVolSSO.DllPath, (int)kind, WindowsTaskbar.Current.Dpi > 1));
                }
                catch (Exception ex)
                {
                    Trace.WriteLine($"Couldn't load icon: {ex}");
                    return(Create(IconKind.OriginalIcon));
                }
            }

            throw new NotImplementedException();
        }
 public override FrameworkElement CreateMapIcon()
 {
     return(IconUtils.CreateMapIcon(Player, IconUtils.CreateTeamIcon(NewTeam)));
 }
Пример #24
0
        public override FrameworkElement CreateMapIcon()
        {
            var teleport_source = IconUtils.GetImageSource("icon_teleport");

            return(IconUtils.CreateMapIcon(Player, teleport_source));
        }
        public override FrameworkElement CreateMapIcon()
        {
            var shield_source = IconUtils.GetImageSource("icon_shield");

            return(IconUtils.CreateMapIcon(Player, shield_source));
        }
        public override FrameworkElement CreateMapIcon()
        {
            var current_source = IconUtils.GetImageSource(CurrentClass.ToLowerInvariant());

            return(IconUtils.CreateMapIcon(Player, current_source));
        }
Пример #27
0
 private void SampleIcon_Changed(object sender, EventArgs e)
 {
     IconUtils.UpdateSampleIcon(comboGeneralIconFont, comboGeneralIconColor, comboGeneralIconTextColor,
                                upDownGeneralIconSize.Text, txtGeneralIconSampleText.Text, picGeneralIconSample);
 }
Пример #28
0
        public override System.Windows.FrameworkElement CreateMapIcon()
        {
            var sword_source = IconUtils.GetImageSource("icon_sword");

            return(IconUtils.CreateMapIcon(Player, sword_source));
        }
        public override FrameworkElement CreateMapIcon()
        {
            var death_source = IconUtils.GetImageSource("icon_death");

            return(IconUtils.CreateMapIcon(Player, death_source));
        }
Пример #30
0
 private void LoadedSampleIcon_Changed(object sender, EventArgs e)
 {
     IconUtils.UpdateLoadedSampleIcon(txtEnvIconFileLocation.Text, picEnvSampleIcon);
 }