예제 #1
0
        public async Task DoRecentImport(RecentDataSource recent)
        {
            var session = (IImportSession)Activator.CreateInstance(recent.ImportSessionType);

            session.FromRecent(recent, _owner);
            await DoCommonImport(session);
        }
        public static void Add(RecentDataSource source)
        {
            var file = LoadFile();

            foreach (var oldItem in file.Items.Where(x => x.DisplayName.ToLower() == source.DisplayName.ToLower()).ToList())
            {
                file.Items.Remove(oldItem);
            }

            file.Items.Add(new StorageItem {
                ImportSessionTypeName = source.ImportSessionType.FullName,
                DisplayName           = source.DisplayName,
                ConnectionString      = source.ConnectionString
            });

            int fileCount, serverCount;

            file.Count(out fileCount, out serverCount);
            for (; fileCount > MAX_RECENTS; fileCount--)
            {
                file.RemoveFirst(typeof(IFileImportSession));
            }
            for (; serverCount > MAX_RECENTS; serverCount--)
            {
                file.RemoveFirst(typeof(IDatabaseImportSession));
            }

            SaveFile(file);
        }
예제 #3
0
 public bool FromRecent(RecentDataSource recent, IWin32Window owner)
 {
     _builder = CreateBuilder(recent.ConnectionString);
     return(DoConnect(owner));
 }
예제 #4
0
 public bool FromRecent(RecentDataSource recent, IWin32Window owner)
 {
     FromFilePath(recent.ConnectionString);
     return(true);
 }