Пример #1
0
        private void menuItemExportSchema_Click(object sender, RoutedEventArgs e)
        {
            ExportSchema win = new ExportSchema();

            win.Owner       = this;
            win.FontFamily  = FontFamily;
            win.FontSize    = FontSize;
            win.FontStretch = FontStretch;
            win.FontStyle   = FontStyle;
            win.FontWeight  = FontWeight;
            win.DataSet     = CurrentDataSet;
            win.ShowDialog();
        }
Пример #2
0
        public static void Execute()
        {
            NpgsqlConnectionInfo info = new NpgsqlConnectionInfo
            {
                ServerName   = _hostname,
                ServerPort   = _port,
                DatabaseName = _database,
                UserName     = _username
            };

            info.FillStoredPassword(false);
            using (IDbConnection conn = TryLogin(info))
            {
                if (conn == null)
                {
                    Console.Error.WriteLine("ログインできませんでした。終了します。");
                    Environment.Exit(1);
                }
            }
            ExportSchema obj = new ExportSchema
            {
                DataSet = new NpgsqlDataSet(info)
                {
                    NewLineRule = _newLine
                }
            };

            if (_exportDir == null)
            {
                _exportDir = Environment.CurrentDirectory;
            }
            Task t = obj.ExportAsync(obj.DataSet, _schemas, _excludeSchemas, _exportDir, _encoding);

            while (!t.IsCompleted)
            {
                Thread.Sleep(100);
            }
            if (t.IsFaulted)
            {
                Console.Error.WriteLine(t.ToString());
                Console.Error.Flush();
                Environment.Exit(1);
            }
        }
Пример #3
0
 static void Main(string[] args)
 {
     ExportSchema.AnalyzeArguments(args);
     ExportSchema.Execute();
 }