Beispiel #1
0
 public GameplayStage(PopupManager <PopupType> popupManager, EventAggregator eventAggregator, TimeTicker timeTicker, IconLoader iconLoader)
 {
     _popupManager    = popupManager;
     _eventAggregator = eventAggregator;
     _timeTicker      = timeTicker;
     _iconLoader      = iconLoader;
 }
        public void Update(DownloadItemState state)
        {
            ItemName.Text  = Uri.TryCreate(state.Url, UriKind.Absolute, out var uri) ? Path.GetFileName(uri.AbsolutePath) : state.Url;
            Progress.Value = state.Completion * 100;
            Status.Text    = $"{text.Get(TextKey.BrowserWindow_Downloading)} ({state.Completion * 100}%)";

            if (File.Exists(state.FullPath))
            {
                ItemName.Text = Path.GetFileName(state.FullPath);
                Icon.Content  = new Image {
                    Source = IconLoader.LoadIconFor(new FileInfo(state.FullPath))
                };
            }

            if (state.IsCancelled)
            {
                Progress.Visibility = System.Windows.Visibility.Collapsed;
                Status.Text         = text.Get(TextKey.BrowserWindow_DownloadCancelled);
            }
            else if (state.IsComplete)
            {
                Progress.Visibility = System.Windows.Visibility.Collapsed;
                Status.Text         = text.Get(TextKey.BrowserWindow_DownloadComplete);
            }
        }
Beispiel #3
0
        private TreeViewItem CreateItem(DirectoryInfo directory)
        {
            var header = new StackPanel {
                Orientation = Orientation.Horizontal, Margin = new Thickness(2)
            };
            var image = new Image
            {
                Height = 16,
                Source = IconLoader.LoadIconFor(directory)
            };
            var item      = new TreeViewItem();
            var textBlock = new TextBlock {
                Margin = new Thickness(5, 0, 0, 0), Text = directory.Name, VerticalAlignment = VerticalAlignment.Center
            };

            header.Children.Add(image);
            header.Children.Add(textBlock);

            item.Cursor  = Cursors.Hand;
            item.Header  = header;
            item.Tag     = directory;
            item.ToolTip = directory.FullName;
            item.Items.Add(text.Get(TextKey.FileSystemDialog_Loading));

            return(item);
        }
Beispiel #4
0
        public override void OnSubmenuRequested(IToolbarBuilder builder)
        {
            var itemNames = builder.ItemNames.ToList();
            var index     = itemNames.Count;

            var smartFolderIndex = itemNames.IndexOf("miCreateSmartfoldertype");

            if (smartFolderIndex != -1)
            {
                index = smartFolderIndex - 1;
            }

            if (_selected.Type.IsProject)
            {
                builder.AddButtonItem(Const.COMMAND_UPDATE_NAME, index)
                .WithHeader(Const.COMMAND_UPDATE_TITLE)
                .WithIcon(IconLoader.GetIcon(_projectCloneCreator.Icon));
            }
            else
            {
                builder.AddButtonItem(Const.COMMAND_NAME, index)
                .WithHeader(Const.COMMAND_TITLE)
                .WithIcon(IconLoader.GetIcon(_projectCloneCreator.Icon));
            }
        }
Beispiel #5
0
        private TreeViewItem CreateItem(FileInfo file)
        {
            var header = new StackPanel {
                Orientation = Orientation.Horizontal, Margin = new Thickness(2)
            };
            var image = new Image
            {
                Height = 16,
                Source = IconLoader.LoadIconFor(file)
            };
            var item      = new TreeViewItem();
            var textBlock = new TextBlock {
                Margin = new Thickness(5, 0, 0, 0), Text = file.Name, VerticalAlignment = VerticalAlignment.Center
            };

            header.Children.Add(image);
            header.Children.Add(textBlock);

            item.Header  = header;
            item.Tag     = file;
            item.ToolTip = file.FullName;

            if (element == FileSystemElement.File && operation == FileSystemOperation.Open)
            {
                item.Cursor = Cursors.Hand;
            }
            else
            {
                item.Cursor          = Cursors.No;
                item.Focusable       = false;
                textBlock.Foreground = Brushes.Gray;
            }

            return(item);
        }
        // --- Components

        /// <summary>
        /// Constructs the Table responsible for sending events and
        /// showing statistics about the Tracker
        /// </summary>
        /// <returns></returns>
        private StackLayout BuildTrackFunctionsView()
        {
            // --- Send Buttons

            var floodCell = new ActionImageCell("Send all event types", IconLoader.Load(Utils.Icon.Send));

            floodCell.Tapped += (s, e) => { TrackEvents(); };

            // --- Statistics

            _statisticsTableSection = new StatisticsTableSection();
            _statisticsTableSection.StartUpdater();
            _statisticsTableSection.UpdateStatistics();

            // --- Assemblew View

            var settingsTable = new TableView
            {
                Intent = TableIntent.Settings,
                Root   = new TableRoot
                {
                    new TableSection("Track Functions")
                    {
                        floodCell
                    },
                    _statisticsTableSection.Section
                }
            };

            return(new StackLayout
            {
                Children = { settingsTable },
                VerticalOptions = LayoutOptions.FillAndExpand
            });
        }
        private void CreateUnits()
        {
            if (m_IconLoader == null)
            {
                m_IconLoader = new IconLoader();
            }
            var units = new List <Unit>();

            foreach (var profile in m_UnitProfiles)
            {
                if (!m_PlayableUnitIds.Contains(profile.UnitId))
                {
                    continue;
                }
                var isUnlock6 = m_UnlockRarity6UnitIds.Contains(profile.UnitId);
                var data      = m_UnitData.SingleOrDefault(x => x.UnitId == profile.UnitId);
                var unit      = new Unit(profile, data, m_IconLoader.LoadIcon(profile.UnitId, isUnlock6), isUnlock6);
                units.Add(unit);
            }

            if (units.Any(x => x.Icon == null))
            {
                MessageBox.Show("画像が無いキャラがあります。\nメニュー>データベース>キャラアイコン更新 を実行してください。");
            }

            Units = units.OrderBy(x => x.Order).ToArray();
        }
Beispiel #8
0
 public MouseToolType(string iconName, DesignationType designation)
 {
     sprite = iconName != "none"
         ? IconLoader.get("orders/" + iconName)
         : null;
     this.designation = designation;
 }
        private void AddTeamNamesWidget()
        {
            Gtk.Frame sframe, tframe;
            EventBox  ebox;

            sframe = new Gtk.Frame("<b>" + Catalog.GetString("Shield") + "</b>");
            (sframe.LabelWidget as Label).UseMarkup = true;
            sframe.ShadowType = ShadowType.None;
            tframe            = new Gtk.Frame("<b>" + Catalog.GetString("Team Name") + "</b>");
            (tframe.LabelWidget as Label).UseMarkup = true;
            tframe.ShadowType = ShadowType.None;

            ebox = new EventBox();
            ebox.ButtonPressEvent += OnImageClicked;

            shieldImage        = new Gtk.Image();
            shieldImage.Pixbuf = IconLoader.LoadIcon(this, "gtk-execute", IconSize.Dialog);
            box = new VBox();

            teamentry          = new Entry();
            teamentry.Changed += delegate(object sender, EventArgs e) {
                Template.TeamName = teamentry.Text;
            };

            sframe.Add(ebox);
            ebox.Add(shieldImage);
            tframe.Add(teamentry);

            box.PackStart(sframe, false, false, 0);
            box.PackStart(tframe, false, false, 0);
            box.ShowAll();
            box.Sensitive = false;
            AddUpperWidget(box);
        }
Beispiel #10
0
        void RenderState(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter)
        {
            string iconName = "";
            JobVM  jobVM    = model.GetValue(iter, 0) as JobVM;

            switch (jobVM.State)
            {
            case JobState.Error:
                iconName = "gtk-dialog-error";
                break;

            case JobState.Finished:
                iconName = "gtk-ok";
                break;

            case JobState.Cancelled:
                iconName = "gtk-cancel";
                break;

            case JobState.Pending:
                iconName = "gtk-execute";
                break;

            case JobState.Running:
                iconName = "gtk-media-record";
                break;
            }
            (cell as CellRendererPixbuf).Pixbuf = IconLoader.LoadIcon(this, iconName, IconSize.Button);
        }
    public void LaunchLoadLocalIcon()
    {
        IconLoader icon = new IconLoader();

        try
        {
            icon.LoadImage();
        }
        catch (Exception ex)
        {
            GlobalFuncs.LogExceptions(ex);
        }

        if (!string.IsNullOrWhiteSpace(icon.getInstallOutcome()))
        {
            MessageBoxIcon boxicon = MessageBoxIcon.Information;

            if (icon.getInstallOutcome().Contains("Error"))
            {
                boxicon = MessageBoxIcon.Error;
            }

            MessageBox.Show(icon.getInstallOutcome(), "Novetus - Icon Installed", MessageBoxButtons.OK, boxicon);
        }

        LoadLocalIcon();
    }
Beispiel #12
0
        private void Start()
        {
            UnitData unitDataByUniqueId = MonoSingleton <GameManager> .Instance.Player.FindUnitDataByUniqueID((long)GlobalVars.SelectedUnitUniqueID);

            JobData jobData = (JobData)null;

            for (int index = 0; index < unitDataByUniqueId.Jobs.Length; ++index)
            {
                if (unitDataByUniqueId.Jobs[index] != null && unitDataByUniqueId.Jobs[index].UniqueID == (long)GlobalVars.SelectedJobUniqueID)
                {
                    jobData = unitDataByUniqueId.Jobs[index];
                }
            }
            if (jobData == null)
            {
                return;
            }
            if (Object.op_Inequality((Object)this.JobIcon, (Object)null))
            {
                string str = AssetPath.JobIconSmall(jobData == null ? (JobParam)null : jobData.Param);
                if (!string.IsNullOrEmpty(str))
                {
                    IconLoader iconLoader = GameUtility.RequireComponent <IconLoader>(this.JobIcon);
                    if (Object.op_Inequality((Object)iconLoader, (Object)null))
                    {
                        iconLoader.ResourcePath = str;
                    }
                }
            }
            if (!Object.op_Inequality((Object)this.JobName, (Object)null))
            {
                return;
            }
            this.JobName.set_text(jobData.Name);
        }
Beispiel #13
0
 public static IconLoader GetInstance()
 {
     if (IconLoader.instance == null)
     {
         IconLoader.instance = new IconLoader();
     }
     return(IconLoader.instance);
 }
Beispiel #14
0
        // --- Components

        /// <summary>
        /// Constructs the Table responsible for sending events and
        /// showing statistics about the Tracker
        /// </summary>
        /// <returns></returns>
        private StackLayout BuildTrackFunctionsView()
        {
            // --- Send Buttons

            var icSendImage = IconLoader.Load(Utils.Icon.Send);

            var selfDescribingCell = new ActionImageCell("TrackSelfDescribing", icSendImage);

            selfDescribingCell.Tapped += (s, e) => { TrackEvent(0); };
            var pageViewCell = new ActionImageCell("TrackPageView", icSendImage);

            pageViewCell.Tapped += (s, e) => { TrackEvent(1); };
            var screenViewCell = new ActionImageCell("TrackScreenView", icSendImage);

            screenViewCell.Tapped += (s, e) => { TrackEvent(2); };
            var timingCell = new ActionImageCell("TrackTiming", icSendImage);

            timingCell.Tapped += (s, e) => { TrackEvent(3); };
            var structCell = new ActionImageCell("TrackStructEvent", icSendImage);

            structCell.Tapped += (s, e) => { TrackEvent(4); };
            var ecommerceTransactionCell = new ActionImageCell("TrackEcommerceTransaction", icSendImage);

            ecommerceTransactionCell.Tapped += (s, e) => { TrackEvent(5); };

            // --- Statistics

            _statisticsTableSection = new StatisticsTableSection();
            _statisticsTableSection.StartUpdater();
            _statisticsTableSection.UpdateStatistics();

            // --- Assemblew View

            var settingsTable = new TableView
            {
                Intent = TableIntent.Settings,
                Root   = new TableRoot
                {
                    new TableSection("Event Track Functions")
                    {
                        selfDescribingCell,
                        pageViewCell,
                        screenViewCell,
                        timingCell,
                        structCell,
                        ecommerceTransactionCell
                    },
                    _statisticsTableSection.Section
                }
            };

            return(new StackLayout
            {
                Children = { settingsTable },
                VerticalOptions = LayoutOptions.FillAndExpand
            });
        }
Beispiel #15
0
 public DirectoryItem(string name, string fullName, string size, string type, string lastmodify)
 {
     Name        = name;
     DisplayName = name.Length < 17 ? Name : Name.Substring(0, 17) + "...";
     FullName    = fullName;
     Size        = size;
     Type        = type;
     LastModify  = lastmodify;
     Icon        = IconLoader.GetInstance().GetIcon(FullName);
 }
Beispiel #16
0
        public void CreateInventoryPartCategory()
        {
            IconLoader loader = UnityEngine.Object.FindObjectOfType <IconLoader>();
            Icon       icon   = loader.icons.FirstOrDefault(i => string.Equals(i.name, "stockIcon_structural", StringComparison.Ordinal));

            PartCategorizer.Category category = PartCategorizer.AddCustomFilter("ScrapYard", "ScrapYard", icon, new UnityEngine.Color(0.75f, 0.75f, 0.75f));
            category.displayType     = EditorPartList.State.PartsList;
            category.exclusionFilter = PartCategorizer.Instance.filterGenericNothing;

            PartCategorizer.AddCustomSubcategoryFilter(category, "Inventory", "Inventory", icon, Filter);
        }
Beispiel #17
0
        private BitmapFrame LoadIcon()
        {
            string executable;

            using (var process = Process.GetProcessById((int)_entry.ProcessId))
            {
                executable = process.GetExecutablePath();
            }

            return(IconLoader.LoadIcon(_entry.IconHandle, executable));
        }
Beispiel #18
0
        private BitmapFrame LoadIcon()
        {
            //string executable;

            //using (var process = Process.GetProcessById((int) _entry.ProcessId))
            //{
            //    executable = process.GetExecutablePath();
            //}

            return(IconLoader.LoadIcon(_entry.IconHandle, _entry.ExecutablePath));
        }
Beispiel #19
0
        public static BitmapFrame LoadIcon(IWindowEntry win)
        {
            //string executable;

            //using (var process = Process.GetProcessById((int)win.ProcessId))
            //{
            //    executable = process.GetExecutablePath();
            //}

            return(IconLoader.LoadIcon(win.IconHandle, win.ExecutablePath));
        }
Beispiel #20
0
        public BrowserModel()
        {
            CurrentDirectory = "";
            Searcher         = new FileSearcher();
            _iconLoader      = new IconLoader();

            Searcher.SearcherEvent       += SearchCallback;
            Searcher.SearchFinishedEvent += SearchFinished;
            Searcher.SearchProgressEvent += Searcher_SearchProgressEvent;

            _items = new ObservableCollection <DirectoryItem>();
            State  = ExplorerState.Browsing;
        }
Beispiel #21
0
    /// <summary>
    ///  Check to see if the user needs to be warned of unsaved changes.
    /// </summary>
    /// <returns><c>true</c>, if the action can continue to be processed, <c>false</c> if it should be cancelled.</returns>
    protected bool ModifiedActionCheck(bool onExit = false)
    {
        bool retVal = true;

        if (_currentSong.IsModified)
        {
            MessageDialog md = new MessageDialog(this
                                                 , DialogFlags.DestroyWithParent
                                                 , MessageType.Warning
                                                 , ButtonsType.None
                                                 , "The current file has been modified.  Do you want to save it?");

            Button btn = (Button)md.AddButton("Cancel", (int)ResponseType.Cancel);
            Image  img = new Image();
            img.Pixbuf = IconLoader.LoadIcon(this, "gtk-cancel", IconSize.Menu);
            btn.Image  = img;

            btn = (Button)md.AddButton("Discard", (int)ResponseType.No);
            Image img2 = new Image();
            if (onExit)
            {
                img2.Pixbuf = IconLoader.LoadIcon(this, "gtk-quit", IconSize.Menu);
            }
            else
            {
                img2.Pixbuf = IconLoader.LoadIcon(this, "gtk-delete", IconSize.Menu);
            }
            btn.Image = img2;

            btn = (Button)md.AddButton(onExit ? "Save and Quit" : "Save", (int)ResponseType.Yes);
            Image img3 = new Image();
            img3.Pixbuf = IconLoader.LoadIcon(this, "gtk-save", IconSize.Menu);
            btn.Image   = img3;

            int response = md.Run();

            if (response == (int)ResponseType.Yes)
            {
                on_SaveSongFile(null, null);
            }
            else if (response == (int)ResponseType.Cancel)
            {
                retVal = false;
            }

            md.Destroy();
        }


        return(retVal);
    }
        void onGUIEditorToolbarReady()
        {
            if (icon == null)
            {
                IconLoader iconloader = PartCategorizer.Instance.iconLoader;
                icon = iconloader.GetIcon("R&D_node_icon_fuelsystems");
            }
            PartCategorizer.Category cat    = PartCategorizer.Instance.filters.Find(c => c.button.categoryName == "Filter by Module");
            PartCategorizer.Category subcat = cat.subcategories.Find(c => c.button.categoryName == "Modular Fuel Tank");
            subcat.button.SetIcon(icon);

            cat = PartCategorizer.Instance.filters.Find(c => c.button.categoryName == "Filter by Function");
            PartCategorizer.AddCustomSubcategoryFilter(cat, "MFT Tanks", "MFT Tanks", icon, mftItemFilter);
        }
        public void createButton(string text, string iconName, Action onClick, KeyCode hotKey)
        {
            GameObject buttonPrefab = PrefabLoader.get("toolbarButton");
            float      buttonWidth  = buttonPrefab.GetComponent <RectTransform>().rect.width;
            GameObject button       = Instantiate(buttonPrefab, gameObject.transform);

            button.transform.localPosition = new Vector3(buttonWidth * buttonCount++, 0, 0);
            button.GetComponentInChildren <Button>().onClick.AddListener(onClick.Invoke);
            button.GetComponentInChildren <TextMeshProUGUI>().text = text;
            Sprite icon = IconLoader.get(iconName);

            button.GetComponentsInChildren <Image>()[1].sprite = icon;
            hotKeyMap.Add(hotKey, () => button.GetComponentInChildren <Button>().onClick.Invoke());
        }
 void DrawEquipmentSlot(CharacterBase.EquipmentSlot s, float x, float y, float size)
 {
     if (s.inUse)
     {
         if (GUI.Button(new Rect(x, y, size, size), ""))
         {
             selectedCharacter.UnequipSlot(s.slot);
         }
         GUI.DrawTexture(new Rect(x, y, size, size), IconLoader.GetInstance().GetIcon(s.itemId));
     }
     else
     {
         GUI.Box(new Rect(x, y, size, size), "" + s.slot.ToString());
     }
 }
        private void FeedLoadWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                MessageBox.Show(this, $"Cannot load feed data from remote server - {e.Error.Message}", Text,
                                MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                return;
            }

            if (e.Cancelled)
            {
                MessageBox.Show(this, "Feed data loading cancelled.", Text,
                                MessageBoxButtons.OK, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button1);
                return;
            }

            var feed = e.Result as DistroFeed;

            if (feed == null)
            {
                MessageBox.Show(this, "Cannot load feed data from remote server.", Text,
                                MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                return;
            }

            foreach (var eachItem in feed.Items.ToArray())
            {
                var lvItem = new ListViewItem(eachItem.Title);
                lvItem.ImageKey = "linux";
                lvItem.Tag      = eachItem;

                if (eachItem.IsOfficialDistro())
                {
                    lvItem.Group = ItemListView.Groups["official"];
                }
                else
                {
                    lvItem.Group = ItemListView.Groups["user_created"];
                }

                lvItem.SubItems.Add(new ListViewItem.ListViewSubItem(lvItem, eachItem.Author.Name));
                ItemListView.Items.Add(lvItem);
            }

            IconLoader.RunWorkerAsync(feed.Items.ToArray());
        }
Beispiel #26
0
        /// <summary>
        /// Gets an image with the specified icon file.
        /// </summary>
        /// <param name="icon">Type of icon correpsonding to the icon file stored in Resources folder.</param>
        public static ImageSource GetCachedImageSource(IconType icon)
        {
            string resUriString = GetResourceUri(icon);

            if (ImageCache.ContainsKey(resUriString))
            {
                return(ImageCache[resUriString]);
            }

            //Cache hit failed, construct new image source
            var resUri  = new Uri(resUriString);
            var resInfo = Application.GetResourceStream(resUri);
            var retVal  = IconLoader.ConvertFrom(resInfo.Stream) as ImageSource;

            ImageCache.Add(resUriString, retVal);
            return(retVal);
        }
Beispiel #27
0
    void Awake()
    {
        info = transform.Find("UserPanel");

        nick = info.Find("nick").GetComponent <UILabel>();
        id   = info.Find("id").GetComponent <UILabel>();
        ip   = info.Find("ip").GetComponent <UILabel>();
        addr = info.Find("addr").GetComponent <UILabel>();
        icon = info.Find("bghead/icon").GetComponent <IconLoader>();

        Transform btnclose = info.Find("btn_close");

        PUtils.onClick(btnclose, () => {
            info.gameObject.SetActive(false);
        });

        Transform grid = info.Find("emojis/grid");

        for (int i = 0; i < grid.childCount; i++)
        {
            Transform child = grid.GetChild(i);
            int       j     = i;
            PUtils.onClick(child, () => {
                JsonObject ob = new JsonObject();
                ob.Add("id", j);
                ob.Add("target", userid);
                NetMgr.GetInstance().send("demoji", ob);
                close();
            });
        }

        grid = info.Find("semojis/grid");
        for (int i = 0; i < grid.childCount; i++)
        {
            Transform child = grid.GetChild(i);
            int       j     = i + 100;
            PUtils.onClick(child, () => {
                JsonObject ob = new JsonObject();
                ob.Add("id", j);
                ob.Add("target", userid);
                NetMgr.GetInstance().send("demoji", ob);
                close();
            });
        }
    }
Beispiel #28
0
        // --- Components

        private StackLayout GetNavigation()
        {
            var icNavImage = IconLoader.Load(Utils.Icon.Nav);

            var settingsPageNav = new ActionImageCell("Tracker setup", icNavImage);

            settingsPageNav.Tapped += OnSettingsClicked;
            var singleEventsPageNav = new ActionImageCell("Single event tracking", icNavImage);

            singleEventsPageNav.Tapped += OnSingleEventsClicked;
            var floodEventsPageNav = new ActionImageCell("Flood event tracking", icNavImage);

            floodEventsPageNav.Tapped += OnFloodEventsClicked;
            var helpPageNav = new ActionImageCell("Help", icNavImage);

            helpPageNav.Tapped += OnHelpClicked;

            var navigationTable = new TableView
            {
                Intent = TableIntent.Settings,
                Root   = new TableRoot
                {
                    new TableSection("Settings")
                    {
                        settingsPageNav
                    },
                    new TableSection("Tracking")
                    {
                        singleEventsPageNav,
                        floodEventsPageNav
                    },
                    new TableSection("Misc")
                    {
                        helpPageNav
                    }
                }
            };

            return(new StackLayout
            {
                Children = { navigationTable },
                VerticalOptions = LayoutOptions.FillAndExpand
            });
        }
Beispiel #29
0
 public static Gdk.Pixbuf LoadIcon(Gtk.Widget widget, string name, Gtk.IconSize size)
 {
     Gdk.Pixbuf res = widget.RenderIcon(name, size, null);
     if ((res != null))
     {
         return(res);
     }
     else
     {
         int sz;
         int sy;
         global::Gtk.Icon.SizeLookup(size, out sz, out sy);
         try
         {
             return(Gtk.IconTheme.Default.LoadIcon(name, sz, 0));
         }
         catch (System.Exception)
         {
             if ((name != "gtk-missing-image"))
             {
                 return(IconLoader.LoadIcon(widget, "gtk-missing-image", size));
             }
             else
             {
                 Gdk.Pixmap pmap = new Gdk.Pixmap(Gdk.Screen.Default.RootWindow, sz, sz);
                 Gdk.GC     gc   = new Gdk.GC(pmap);
                 gc.RgbFgColor = new Gdk.Color(255, 255, 255);
                 pmap.DrawRectangle(gc, true, 0, 0, sz, sz);
                 gc.RgbFgColor = new Gdk.Color(0, 0, 0);
                 pmap.DrawRectangle(gc, false, 0, 0, (sz - 1), (sz - 1));
                 gc.SetLineAttributes(3, Gdk.LineStyle.Solid, Gdk.CapStyle.Round, Gdk.JoinStyle.Round);
                 gc.RgbFgColor = new Gdk.Color(255, 0, 0);
                 pmap.DrawLine(gc, (sz / 4), (sz / 4), ((sz - 1)
                                                        - (sz / 4)), ((sz - 1)
                                                                      - (sz / 4)));
                 pmap.DrawLine(gc, ((sz - 1)
                                    - (sz / 4)), (sz / 4), (sz / 4), ((sz - 1)
                                                                      - (sz / 4)));
                 return(Gdk.Pixbuf.FromDrawable(pmap, pmap.Colormap, 0, 0, 0, 0, sz, sz));
             }
         }
     }
 }
Beispiel #30
0
		[Test] public void Test_01_GetIconForExtension()
		{
			IconLoader iconLoader = new IconLoader();
			ImageList smallList = new ImageList();
			smallList.ImageSize = new System.Drawing.Size(16, 16);
			ImageList largeList = new ImageList();
			largeList.ImageSize = new System.Drawing.Size(32, 32);
			iconLoader.SmallIcons = smallList;
			iconLoader.LargeIcons = largeList;

			int index = iconLoader.AddSystemIcon(FILE_DOC);
			Assert.IsTrue(smallList.Images.Count == 1);
			Assert.IsTrue(largeList.Images.Count == 1);
			Assert.IsTrue(index == 0);

			index = iconLoader.AddSystemIcon(FILE_XLS);
			Assert.IsTrue(smallList.Images.Count == 2);
			Assert.IsTrue(largeList.Images.Count == 2);
			Assert.IsTrue(index == 1);
		}
        public void Build(IMenuBuilder builder, ObjectsViewContext context)
        {
            var objects = context.SelectedObjects.ToList();

            if (objects.Count != 1)
            {
                return;
            }

            var menu = builder.ItemNames.ToList();

            if (!menu.Contains("miCreate"))
            {
                return;
            }

            var subMenu = builder.GetItem("miCreate");
            var index   = subMenu.Count;

            var smartFolderIndex = subMenu.ItemNames.ToList().IndexOf("miCreateSmartfoldertype");

            if (smartFolderIndex != -1)
            {
                index = smartFolderIndex - 1;
            }

            var selected = objects.First();

            if (selected.Type.IsProject)
            {
                subMenu.AddItem(Const.COMMAND_UPDATE_NAME, index)
                .WithHeader(Const.COMMAND_UPDATE_TITLE)
                .WithIcon(IconLoader.GetIcon(_projectCloneCreator.Icon));
            }
            else
            {
                subMenu.AddItem(Const.COMMAND_NAME, index)
                .WithHeader(Const.COMMAND_TITLE)
                .WithIcon(IconLoader.GetIcon(_projectCloneCreator.Icon));
            }
        }