public IconSetWindow(IconSource current) { InitializeComponent(); CurrentSource = current; this.Icon = current.GetImage(IconType.Refresh).Icon; RefreshIcons(); }
private void ThemeChanged() { if (IconSource != null) { IconSource.SetColorProperty("Foreground", ActualTheme == ElementTheme.Light ? Colors.Black : Colors.White); } }
public ChangeIconDialog(int itemPosition, bool isDark) { RetainInstance = true; _itemPosition = itemPosition; _iconSource = new IconSource(isDark); }
public static bool MoveChunk(IconSource source, Chunk existing) { var region = existing.Region; var window = new EditChunkWindow(source, existing, region, ChunkEditPurpose.Move); return(window.ShowDialog() == DialogResult.OK); // window moves the chunk by itself }
public ExportWindow(IconSource source, ExportSettings template, string destination_path) { InitializeComponent(); this.Icon = source.GetImage(IconType.Save).Icon; CompressionBox.Items.Add(new CompressionDisplay("Uncompressed", NbtCompression.None)); CompressionBox.Items.Add(new CompressionDisplay("G-Zip", NbtCompression.GZip)); CompressionBox.Items.Add(new CompressionDisplay("ZLib", NbtCompression.ZLib)); CompressionBox.SelectedIndex = 0; if (template is not null) { RadioSnbt.Checked = template.Snbt; RadioNbt.Checked = !template.Snbt; CompressionBox.SelectedItem = CompressionBox.Items.Cast <CompressionDisplay>().FirstOrDefault(x => x.Compression == template.Compression); CheckMinify.Checked = template.Minified; CheckJson.Checked = template.Json; CheckLittleEndian.Checked = !template.BigEndian; CheckBedrockHeader.Checked = template.BedrockHeader; } else { string extension = Path.GetExtension(destination_path); bool? binary = NbtUtil.BinaryExtension(extension); RadioSnbt.Checked = binary == false; RadioNbt.Checked = binary == true; CheckLittleEndian.Checked = extension == ".mcstructure"; CheckJson.Checked = extension == ".json"; } SetEnables(); Tooltips.SetToolTip(CheckLittleEndian, "Required for all Bedrock Edition files"); Tooltips.SetToolTip(CheckBedrockHeader, "Required for Bedrock Edition level.dat files"); Tooltips.SetToolTip(CheckJson, "Quotes all keys, removes type suffixes and list indicators"); }
public void CreateFileEnumFor(IconSource icon = IconSource.MaterialDesign, IconSize iconSize = IconSize.PX18) { const string quote = "\""; var filename = $"{icon.GetDescription<IconSource>()}.json"; filename = Path.Combine(_settings.Folder.Icons, filename); var records = JsonConvert.DeserializeObject <List <OxIcon> >(System.IO.File.ReadAllText(filename)); var _id = 0; var ws = File.CreateText("c:\\usr\\MaterialDesignIcon.cs"); ws.WriteLine("using System.ComponentModel;"); ws.WriteLine("namespace Works.Web.Common.Icons"); ws.WriteLine("\t\t{"); ws.WriteLine("\t\t\tpublic enum MaterialDesignIcon"); ws.WriteLine("\t\t\t{"); foreach (var record in records) { var prefix = "mdi"; var name = $"{prefix}-{record.Name}"; var desc = $"\t\t\t\t\t[Description({quote}{name}{quote})"; ws.WriteLine(desc); var arr = record.Name.Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries); var nameCapitalized = string.Empty; foreach (var oneString in arr) { nameCapitalized += oneString.Substring(0, 1).ToUpper() + oneString.Substring(1); } ws.WriteLine($"\t\t\t\t\t{nameCapitalized},"); } ws.WriteLine("\t\t\t}"); ws.WriteLine("\t\t}"); ws.Flush(); ws.Close(); }
private static string GetIconSource(IconSource source) { switch (source) { case IconSource.CommonPropSheet: return(IconSrcCommonPropSheet); case IconSource.Devices: return(IconSrcDevice); case IconSource.IE: return(IconSrcIE); case IconSource.Network: return(IconSrcNetwork); case IconSource.Shell: return(IconSrcShell); case IconSource.WinImg: return(IconSrcWinImg); default: return(null); } }
protected void RaisePropertyChanged([CallerMemberName] string propertyName = null) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); switch (propertyName) { case nameof(IconFilter): IconSource.Refresh(); break; case nameof(FontSize): RaisePropertyChanged(nameof(FontAwesomeExampleString)); break; case nameof(Width): case nameof(Height): RaisePropertyChanged(nameof(ImageAwesomeExampleString)); break; case nameof(Flip): case nameof(Rotation): case nameof(IsSpin): case nameof(SpinDuration): RaisePropertyChanged(nameof(FontAwesomeExampleString)); RaisePropertyChanged(nameof(ImageAwesomeExampleString)); break; } }
public List <DataItemCombo> GetIcons(IconSource icon = IconSource.MaterialDesign, IconSize iconSize = IconSize.PX18) { var lstIcons = new List <DataItemCombo>(); var filename = $"{icon.GetDescription<IconSource>()}.json"; filename = Path.Combine(_settings.Folder.Icons, filename); var records = JsonConvert.DeserializeObject <List <OxIcon> >(System.IO.File.ReadAllText(filename)); var _id = 0; foreach (var record in records) { _id++; var data = new DataItemCombo(); var prefix = string.Empty; if (icon == IconSource.MaterialDesign) { prefix = "mdi"; } var suffix = $"{prefix}-{iconSize.GetDescription<IconSize>()}"; var name = $"{prefix} {prefix}-{record.Name} {suffix}"; data.Key = _id; data.Text = name; data.Descricao = record.Name; lstIcons.Add(data); } lstIcons = lstIcons.OrderBy(f => f.Descricao).ToList(); return(lstIcons); }
public void SetIconSource(IconSource source) { foreach (var item in Items) { item.IconSource = source; } }
public IconDialog(Action <object, EventArgs> itemClick, Action <object, EventArgs> negative, int position, bool isDark) { _itemClick = itemClick; _negativeButtonEvent = negative; _iconSource = new IconSource(isDark); Position = position; }
private AppIcon(IconSource source, string iconName, IEnumerable <string> names, bool cacheFiles) { Source = source; UseFileCache = cacheFiles; Icons = GetIcons(iconName, names); DefaultIcon = GetDefaultIcon(Icons); UseFileCache = true; }
public static IconElement MakeIconElementFrom(IconSource iconSource) { if (iconSource is FontIconSource fontIconSource) { FontIcon fontIcon = new FontIcon(); fontIcon.Glyph = fontIconSource.Glyph; fontIcon.FontSize = fontIconSource.FontSize; if (fontIconSource.FontFamily != null) { fontIcon.FontFamily = fontIconSource.FontFamily; } fontIcon.FontWeight = fontIconSource.FontWeight; fontIcon.FontStyle = fontIconSource.FontStyle; fontIcon.IsTextScaleFactorEnabled = fontIconSource.IsTextScaleFactorEnabled; fontIcon.MirroredWhenRightToLeft = fontIconSource.MirroredWhenRightToLeft; return(fontIcon); } else if (iconSource is SymbolIconSource symbolIconSource) { SymbolIcon symbolIcon = new SymbolIcon(); symbolIcon.Symbol = symbolIconSource.Symbol; return(symbolIcon); } else if (iconSource is BitmapIconSource bitmapIconSource) { BitmapIcon bitmapIcon = new BitmapIcon(); if (bitmapIconSource.UriSource != null) { bitmapIcon.UriSource = bitmapIconSource.UriSource; } if (IsSystemDll() || ApiInformation.IsPropertyPresent("Windows.UI.Xaml.Controls.BitmapIcon", "ShowAsMonochrome")) { bitmapIcon.ShowAsMonochrome = bitmapIconSource.ShowAsMonochrome; } return(bitmapIcon); } else if (iconSource is PathIconSource pathIconSource) { PathIcon pathIcon = new PathIcon(); if (pathIconSource.Data != null) { pathIcon.Data = pathIconSource.Data; } return(pathIcon); } return(null); }
/// <summary> /// Wandelt die Quelle in einen string um! /// </summary> /// <param name="source">Quelle des Bildes</param> /// <returns></returns> private static string GetSource(IconSource source) { switch (source) { case IconSource.Pokemon: return(POKEMON_FORMAT); } throw new InvalidOperationException("Ungültiger Aufruf!"); }
public override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); _position = Arguments.GetInt("position", 0); var activity = (BaseActivity)Activity; _iconSource = new IconSource(activity.IsDark); }
public FindWindow(IconSource source, NbtTreeModel model, NbtTreeView view) { InitializeComponent(); SearchingModel = model; SearchingView = view; this.Icon = source.GetImage(IconType.Search).Icon; UpdateButtons(); }
private RenameFileWindow(IconSource source, IHavePath file) { InitializeComponent(); OriginalItem = file; this.Icon = source.GetImage(IconType.Rename).Icon; NameBox.SetItem(file); NameBox.SelectAll(); }
public void Add(string name) { IconSet icon_set = new IconSet(); IconSource source = new IconSource(); source.IconName = name; icon_set.AddSource(source); Add(name, icon_set); }
public void Be_Creatable(IconChar iconChar) { var iconSource = new IconSource(iconChar); iconSource.Should().NotBeNull(); var serviceProvider = Substitute.For <IServiceProvider>(); var imageSource = (ImageSource)iconSource.ProvideValue(serviceProvider); imageSource.Should().NotBeNull(); }
public void RefreshIcons() { SuspendLayout(); Action select = () => { }; int row = 0; IconTable.Controls.Clear(); IconTable.RowStyles.Clear(); foreach (var item in IconSourceRegistry.RegisteredSources) { var source = item.Value; var buttons = new IconSourceButtons(source); buttons.Dock = DockStyle.Fill; IconTable.RowStyles.Add(new RowStyle(SizeType.Absolute, buttons.Height)); IconTable.Controls.Add(buttons, 0, row); IconTable.ColumnStyles[0].Width = Math.Max(IconTable.ColumnStyles[0].Width, buttons.PreferredSize.Width + 5); buttons.ConfirmClicked += (s, e) => { SelectedSource = source; this.Close(); }; buttons.DeleteClicked += (s, e) => { IconSourceRegistry.Unregister(item.Key); Properties.Settings.Default.CustomIconSets.Remove(item.Key); RefreshIcons(); }; var preview = new IconSourcePreview(source, IconType.OpenFile, IconType.Save, IconType.Edit, IconType.Cut, IconType.Undo, IconType.ByteTag, IconType.StringTag, IconType.IntArrayTag, IconType.ListTag, IconType.Region, IconType.Chunk ); preview.Dock = DockStyle.Fill; IconTable.Controls.Add(preview, 1, row); IconTable.RowStyles[row].Height = Math.Max(IconTable.RowStyles[row].Height, preview.PreferredSize.Height + 5); if (CurrentSource == source) { SelectedRow = row; buttons.BackColor = Color.FromArgb(201, 255, 221); preview.BackColor = Color.FromArgb(201, 255, 221); select = () => buttons.Select(); } row++; } select(); ResumeLayout(); }
public FullIconPreviewWindow(IconSource source) { InitializeComponent(); var preview = new IconSourcePreview(source, false, (IconType[])Enum.GetValues(typeof(IconType))); preview.MaximumSize = new Size(470, 0); preview.Dock = DockStyle.Fill; Controls.Add(preview); this.Text = source.Name + " Icon Set"; this.Icon = source.GetImage(IconType.Search).Icon; }
/// <summary> /// /// </summary> /// <param name="content"></param> /// <param name="title"></param> /// <param name="icon"></param> private TabUiItem GenerateTabUiItem(object content, string title, IconSource icon) { TabUiItem tabUiItem = new TabUiItem { DocumentTitle = title, Content = content, DocumentIcon = icon }; return(tabUiItem); }
public UpdateWindow(IconSource source, AvailableUpdate update) { InitializeComponent(); AvailableUpdate = update; this.Icon = source.GetImage(IconType.NbtStudio).Icon; CurrentVersionValue.Text = Updater.GetCurrentVersion().ToString(false); AvailableVersionValue.Text = update.Version.ToString(false); ChangelogBox.Text = update.Changelog; ButtonOk.Select(); }
public void Be_Creatable(IconChar iconChar) { var iconSource = new IconSource(iconChar); iconSource.Should().NotBeNull(); iconSource.Should().BeAssignableTo <IHaveIconFont>(); iconSource.IconFont.Should().Be(IconFont.Auto); var serviceProvider = Substitute.For <IServiceProvider>(); var imageSource = (ImageSource)iconSource.ProvideValue(serviceProvider); imageSource.Should().NotBeNull(); }
public static bool ModifyTag(IconSource source, NbtTag existing, EditPurpose purpose) { if (purpose == EditPurpose.Create) { throw new ArgumentException("Use CreateTag to create tags"); } var parent = existing.Parent; bool has_name = parent is NbtCompound; var window = new EditHexWindow(source, existing, parent, has_name, purpose); return(window.ShowDialog() == DialogResult.OK); // window modifies the tag by itself }
private EditHexWindow(IconSource source, NbtTag tag, NbtContainerTag parent, bool set_name, EditPurpose purpose) { InitializeComponent(); TabView.Size = new Size(0, 0); WorkingTag = tag; TagParent = parent; NameBox.SetTags(tag, parent); SettingName = set_name; NameLabel.Visible = SettingName; NameBox.Visible = SettingName; Provider = ByteProviders.GetByteProvider(tag); HexBox.ByteProvider = Provider; HexBox.GroupSize = Provider.BytesPerValue; HexBox.GroupSeparatorVisible = Provider.BytesPerValue > 1; HexBox.SelectionBackColor = Constants.SelectionColor; HexBox.SelectionForeColor = HexBox.ForeColor; string tagname; if (tag is NbtList list) { tagname = NbtUtil.TagTypeName(list.ListType) + " List"; this.Icon = NbtUtil.TagTypeImage(source, list.ListType).Icon; } else { tagname = NbtUtil.TagTypeName(tag.TagType); this.Icon = NbtUtil.TagTypeImage(source, tag.TagType).Icon; } if (purpose == EditPurpose.Create) { this.Text = $"Create {tagname} Tag"; } else if (purpose == EditPurpose.EditValue || purpose == EditPurpose.Rename) { this.Text = $"Edit {tagname} Tag"; } if (SettingName && purpose != EditPurpose.EditValue) { NameBox.Select(); NameBox.SelectAll(); } else { HexBox.Select(); } }
public static NbtTag CreateTag(IconSource source, NbtTagType type, NbtContainerTag parent, bool bypass_window = false) { bool has_name = parent is NbtCompound; var tag = NbtUtil.CreateTag(type); if (bypass_window) { tag.Name = NbtUtil.GetAutomaticName(tag, parent); return(tag); } var window = new EditHexWindow(source, tag, parent, has_name, EditPurpose.Create); return(window.ShowDialog() == DialogResult.OK ? tag : null); }
public IconSourcePreview(IconSource source, bool show_preview_button, params IconType[] types) { Source = source; InitializeComponent(); var boxes = types.Select(x => MakePictureBox(source, x)).ToArray(); IconsPanel.Controls.AddRange(boxes); IconsPanel.Controls.Add(PreviewButton); if (!show_preview_button) { PreviewButton.Visible = false; } }
static void AddIcon(string stockid, string resource) { Gtk.IconSet iconset = stock.Lookup(stockid); if (iconset == null) { iconset = new Gtk.IconSet(); Gdk.Pixbuf img = Gdk.Pixbuf.LoadFromResource(resource); IconSource source = new IconSource(); source.Size = Gtk.IconSize.Menu; source.SizeWildcarded = false; source.Pixbuf = img; iconset.AddSource(source); stock.Add(stockid, iconset); } }
static void AddIcon(IconFactory stock, string stockid, string resource) { Gtk.IconSet iconset = stock.Lookup(stockid); if (iconset != null) { return; } iconset = new Gtk.IconSet(); Gdk.Pixbuf img = Gdk.Pixbuf.LoadFromResource(resource); IconSource source = new IconSource(); source.Pixbuf = img; iconset.AddSource(source); stock.Add(stockid, iconset); }
private static IconSource GetIconSource( string result ) { string[] parts = result.Split( ',' ); if ( parts.Length != 2 ) { parts = new[] { parts[0], "0" }; } string fileName = parts[0]; int index = Math.Max( int.Parse( parts[1] ), 0 ); var source = new IconSource { FileName = fileName, Index = index }; return source; }