예제 #1
0
        private PushButtonData CreateButton(string ButtonName,
                                            string ButtonText,
                                            string Image16,
                                            string Image32,
                                            string dllPath,
                                            string dllClass,
                                            string ToolTip
                                            )
        {
            PushButtonData pdData;

            try
            {
                pdData = new PushButtonData(ButtonName,
                                            ButtonText, dllPath, dllClass);
                // if we have a path for a small image, try to load the image
                if (Image16.Length != 0)
                {
                    try
                    {
                        // load the image
                        pdData.Image = CsUtilitiesMedia.GetBitmapImage(Image16, NAMESPACE_PREFIX_RESOURCES);
                    }
                    catch
                    {
                        // could not locate the image
                    }
                }

                // if have a path for a large image, try to load the image
                if (Image32.Length != 0)
                {
                    try
                    {
                        // load the image
                        pdData.LargeImage = CsUtilitiesMedia.GetBitmapImage(Image32, NAMESPACE_PREFIX_RESOURCES);
                    }
                    catch
                    {
                        // could not locate the image
                    }
                }

                // set the tooltip
                pdData.ToolTip = ToolTip;
            }
            catch
            {
                return(null);
            }

            return(pdData);
        }
예제 #2
0
        private PushButtonData createButton(string ButtonName, string ButtonText,
                                            string className, string ToolTip, string smallIcon, string largeIcon)
        {
            PushButtonData pbd;

            string dllPath = Assembly.GetExecutingAssembly().Location;

            try
            {
                pbd = new PushButtonData(ButtonName, ButtonText,
                                         AddInPath, string.Concat(CLASSPATH, className));
                // {
                //  Image = CsUtilitiesMedia.GetBitmapImage(smallIcon, NAMESPACE_PREFIX),
                //  LargeImage = CsUtilitiesMedia.GetBitmapImage(largeIcon, NAMESPACE_PREFIX),
                //  ToolTip = ToolTip
                // };

                pbd.Image      = CsUtilitiesMedia.GetBitmapImage(smallIcon, NAMESPACE_PREFIX);
                pbd.LargeImage = CsUtilitiesMedia.GetBitmapImage(largeIcon, NAMESPACE_PREFIX);
                pbd.ToolTip    = ToolTip;
            }
            catch (Exception e)
            {
                TaskDialog td = new TaskDialog($"CS Tools - Make Button");
                td.MainIcon        = TaskDialogIcon.TaskDialogIconWarning;
                td.MainInstruction = "Failed to create the button";

                td.MainContent  = $"class path| {CLASSPATH}\n";
                td.MainContent += $"class| {className}\n";
                td.MainContent += $"add in path| {AddInPath}\n";
                td.MainContent += $"dll path| {dllPath}\n";

                td.MainContent += "\nexception|\n"
                                  + $"{e.Message}";

                if (e.InnerException != null)
                {
                    td.MainContent += "\n\ninner exception|\n"
                                      + $"{e.InnerException.Message}";
                }


                td.Show();


                return(null);
            }

            return(pbd);
        }
예제 #3
0
        private PushButtonData createButton(string ButtonName, string ButtonText,
                                            string className, string ToolTip, string smallIcon, string largeIcon)
        {
            PushButtonData pbd;

            try
            {
                pbd = new PushButtonData(ButtonName, ButtonText, AddInPath, string.Concat(CLASSPATH, className))
                {
                    Image      = CsUtilitiesMedia.GetBitmapImage(smallIcon, NAMESPACE_PREFIX),
                    LargeImage = CsUtilitiesMedia.GetBitmapImage(largeIcon, NAMESPACE_PREFIX),
                    ToolTip    = ToolTip
                };
            }
            catch
            {
                return(null);
            }

            return(pbd);
        }