예제 #1
0
        public Task <IExplorerObject> CreateExplorerObject(IExplorerObject parentExObject)
        {
            if (!CanCreate(parentExObject))
            {
                return(null);
            }

            SaveFileDialog dlg = new SaveFileDialog();

            dlg.Title            = "New SQLite Feature Database...";
            dlg.Filter           = "SQLite DB(*.fdb)|*.fdb";
            dlg.InitialDirectory = parentExObject.FullName;
            dlg.FileName         = "database1.fdb";

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                SQLiteFDB fdb = new SQLiteFDB();
                if (!fdb.Create(dlg.FileName))
                {
                    MessageBox.Show(fdb.LastErrorMessage, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(Task.FromResult <IExplorerObject>(null));
                }
                _filename = dlg.FileName;
                return(Task.FromResult <IExplorerObject>(this));
            }
            return(null);
        }
예제 #2
0
        public IExplorerObject CreateExplorerObject(IExplorerObject parentExObject)
        {
            if (!CanCreate(parentExObject))
            {
                return(null);
            }

            SaveFileDialog dlg = new SaveFileDialog();

            dlg.Title    = "New SQLite Feature Database...";
            dlg.Filter   = "SQLite DB(*.fdb)|*.fdb";
            dlg.FileName = parentExObject.FullName + @"\database1.fdb";

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                SQLiteFDB fdb = new SQLiteFDB();
                if (!fdb.Create(dlg.FileName))
                {
                    MessageBox.Show(fdb.lastErrorMsg, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(null);
                }
                _filename = dlg.FileName;
                return(this);
            }
            return(null);
        }