Example #1
0
        protected override bool Execute(object target, Hisui.Ctrl.IContext con)
        {
            var filter = string.Format("{0}|{1}|All files (*.*)|*.*",
                                       _importer.MakeCaptionString(), _importer.MakeFileFilterString());
            var dialog = new OpenFileDialog {
                Filter = filter
            };

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                using (var prg = Core.Progress.Start("importing: " + dialog.FileName)) {
                    prg.Step(1.0);
                    var dst = this.GetDestination(con);
                    _importer.Import(dst.Put(null), dialog.FileName);
                    con.View.Fit();
                }
            }
            return(true);
        }
Example #2
0
        public static Ctrl.CommandItem CreateCommandItem(Hix.IImporter importer, Type target)
        {
            var command = new ImportCommand(importer, target);

            return(new Ctrl.CommandItem(command, command.Name, importer.MakeCaptionString()));
        }