Пример #1
0
        /// <summary>
        /// Execute the command.
        /// </summary>
        public override void execute()
        {
            try
            {
                System.Windows.Forms.SaveFileDialog dialog = new System.Windows.Forms.SaveFileDialog();
                dialog.AddExtension = true;
                dialog.Title        = CadKit.Helios.Application.Instance.Name + " -- Export Image";

                CadKit.Interfaces.IExportImage export = CadKit.Documents.Manager.Instance.ActiveView as CadKit.Interfaces.IExportImage;
                if (null != export)
                {
                    string finalFilter = "";
                    CadKit.Interfaces.Filters filters = export.Filters;
                    foreach (CadKit.Interfaces.Filter filter in filters)
                    {
                        finalFilter += (filter.Text + '|' + filter.Extensions + '|');
                    }
                    finalFilter   = finalFilter.TrimEnd(new char[] { '|' });
                    dialog.Filter = finalFilter;
                    dialog.ShowDialog();
                    string filename = dialog.FileName;
                    export.export(filename);
                }
            }
            catch (System.Exception exception)
            {
                System.Console.WriteLine("Error 2610699216: exception caught while trying to export image.");
                System.Console.WriteLine("Message: {0}", exception.Message);
            }
        }
Пример #2
0
 /// <summary>
 /// Export the image.
 /// </summary>
 void CadKit.Interfaces.IExportImage.export(string filename)
 {
     CadKit.Interfaces.IExportImage export = this.Panel as CadKit.Interfaces.IExportImage;
     if (null == export)
     {
         throw new System.Exception(System.String.Format("Error 1078988943: Failed to export image file '{0}', feature not supported", filename));
     }
     export.export(filename);
 }