Exemplo n.º 1
0
 public void OnRequestBitmapSource(IconRequestEventArgs e)
 {
     if (RequestBitmapSource != null)
     {
         RequestBitmapSource(e);
     }
 }
Exemplo n.º 2
0
        protected override ImageSource GetIcon(string fullNameOfIcon)
        {
            IconRequestEventArgs iconRequest;

            // If there is no path, that means it's just created node.
            // Use DefaultAssembly to load icon.
            if (String.IsNullOrEmpty(Path))
            {
                iconRequest = new IconRequestEventArgs(Configurations.DefaultAssembly, fullNameOfIcon);
                OnRequestBitmapSource(iconRequest);
                return(iconRequest.Icon);
            }

            string customizationPath = System.IO.Path.GetDirectoryName(Path);

            customizationPath = System.IO.Directory.GetParent(customizationPath).FullName;
            customizationPath = System.IO.Path.Combine(customizationPath, "bin", "Package.dll");

            iconRequest = new IconRequestEventArgs(customizationPath, fullNameOfIcon, false);
            OnRequestBitmapSource(iconRequest);

            if (iconRequest.Icon != null)
            {
                return(iconRequest.Icon);
            }

            // If there is no icon inside of customization assembly,
            // try to find it in dynamo assembly.
            iconRequest = new IconRequestEventArgs(Configurations.DefaultAssembly, fullNameOfIcon);
            OnRequestBitmapSource(iconRequest);

            return(iconRequest.Icon);
        }
Exemplo n.º 3
0
        private ImageSource GetIcon(string fullNameOfIcon)
        {
            var iconRequest = new IconRequestEventArgs(Assembly, fullNameOfIcon);

            OnRequestBitmapSource(iconRequest);

            return(iconRequest.Icon);
        }
Exemplo n.º 4
0
        private ImageSource LoadDefaultIcon()
        {
            var iconRequest = new IconRequestEventArgs(Configurations.DefaultAssembly,
                                                       Configurations.DefaultIcon);

            OnRequestBitmapSource(iconRequest);

            return(iconRequest.Icon);
        }
        protected ImageSource GetIcon(string fullNameOfIcon)
        {
            if (string.IsNullOrEmpty(Model.Assembly))
            {
                return(null);
            }

            var iconRequest = new IconRequestEventArgs(Model.Assembly, fullNameOfIcon);

            OnRequestBitmapSource(iconRequest);

            return(iconRequest.Icon);
        }
        protected virtual ImageSource LoadDefaultIcon(ResourceType resourceType)
        {
            if (resourceType == ResourceType.LargeIcon)
            {
                return(null);
            }

            var iconRequest = new IconRequestEventArgs(Configurations.DefaultAssembly,
                                                       Configurations.DefaultIcon);

            OnRequestBitmapSource(iconRequest);

            return(iconRequest.Icon);
        }
Exemplo n.º 7
0
        protected override ImageSource GetIcon(string fullNameOfIcon)
        {
            string customizationPath = System.IO.Path.GetDirectoryName(Path);

            customizationPath = System.IO.Directory.GetParent(customizationPath).FullName;
            customizationPath = System.IO.Path.Combine(customizationPath, "bin", "Package.dll");

            var iconRequest = new IconRequestEventArgs(customizationPath, fullNameOfIcon, false);

            OnRequestBitmapSource(iconRequest);

            if (iconRequest.Icon != null)
            {
                return(iconRequest.Icon);
            }

            // If there is no icon inside of customization assembly,
            // try to find it in dynamo assembly.
            iconRequest = new IconRequestEventArgs(Configurations.DefaultAssembly, fullNameOfIcon);
            OnRequestBitmapSource(iconRequest);

            return(iconRequest.Icon);
        }