void Import(string filename, Hix.IFormatImporter importer, Ctrl.IContext con) { using (var progress = SI.PushProgress("importing: " + filename)) { var entry = this.GetDestination(con).Put(null); using (var stream = File.OpenRead(filename)) { progress.Step(0.8); importer.Import(stream, entry); } entry.Caption = Path.GetFileNameWithoutExtension(filename); progress.Step(0.2); con.View.Fit(); } }
CreateCommandItems(Hix.IFormatImporter importer) { var format = Hix.FormatRegistry.FindFormat(importer.FormatType); if (format != null) { string name = "Import." + format.Name; string caption = string.Format("{0} ({1})", format.Caption, format.FileFilter); yield return(CreateCommandItem(importer, typeof(void), "File." + name, caption)); yield return(CreateCommandItem(importer, typeof(Core.Document), name, caption)); yield return(CreateCommandItem(importer, typeof(Core.IEntry), name, caption)); } }
FormatImportCommand( Hix.IFormatImporter importer, Type target ) { _importer = importer; _target = target; }
FormatImportCommand(Hix.IFormatImporter importer, Type target) { _importer = importer; _target = target; }
static Ctrl.CommandItem CreateCommandItem( Hix.IFormatImporter importer, Type target, string name, string caption) { return(new Hisui.Ctrl.CommandItem( new FormatImportCommand(importer, target), name, caption)); }
static string GetFilterString(Hix.IFormatImporter importer) { var format = Hix.FormatRegistry.FindFormat(importer.FormatType); return(string.Format("{0} ({1})|{1}|All files (*.*)|*.*", format.Caption, format.FileFilter)); }