Beispiel #1
0
        private static async Task ResolveDmPlugin()
        {
            SettingsViewModel model = SoftContext.Locator.Settings;

            if (!File.Exists(model.DmFile))
            {
                await SoftContext.ShowMessageAsync("错误", $"指定大漠路径“{model.DmFile}”的文件不存在");

                return;
            }
            try
            {
                DmPlugin dm = new DmPlugin(model.DmFile);

                Version ver = new Version(dm.Ver());
                model.DmVersion      = ver.ToString();
                model.DmVersionShow  = true;
                model.DmRegCodeShow  = ver > new Version("3.1233");
                SoftContext.DmSystem = new DmSystem(dm);
            }
            catch (Exception ex)
            {
                await SoftContext.MainWindow.Dispatcher.Invoke(async() =>
                {
                    await SoftContext.ShowMessageAsync("错误", $"大漠初始化错误:{ex.Message}");
                });

                model.DmFile = null;
            }
        }
Beispiel #2
0
 public void Can_generate_schema()
 {
     Database.SetInitializer<SoftContext>(null);
     var ctx = new SoftContext("Test");
     var result = ctx.CreateDatabaseScript();
     result.ShouldNotBeNull();
     Console.Write(result);
 }
Beispiel #3
0
        public bool AutoLogin(Role role, Account account)
        {
            if (account == null)
            {
                account = SoftContext.GetAccount();
                if (account == null)
                {
                    Debug.WriteLine("所有帐号已经执行完毕!");
                    return(false);
                }
            }
            if (role == null)
            {
                return(false);
            }
            if (account.IsFinished == true)
            {
                return(false);
            }
            role.CurrentAccount = account;
            bool result = false;

            account.IsWorking = true;
            SoftContext.Locator.Accounts.SetAccountState(account);
            switch (account.Platform)
            {
            case Platform.飞流:
                result = FeiliuLogin(account, role);
                break;

            case Platform.楚游:
                result = FeiliuLogin(account, role);
                break;
            }
            if (result)
            {
                // account = null;
                return(true);
            }
            return(false);
        }
Beispiel #4
0
 async public Task Save(DbContext obj)
 {
     SoftContext db = obj as SoftContext;
     await db.SaveChangesAsync();
 }
Beispiel #5
0
 public ForumRepository(SoftContext db)
 {
     this.db = db;
 }
Beispiel #6
0
 public ForumRepository()
 {
     db = new SoftContext();
 }
Beispiel #7
0
 public MainThemeRepository(SoftContext db)
 {
     this.db = db;
 }
Beispiel #8
0
 public MainThemeRepository()
 {
     db = new SoftContext();
 }
 public ReplyModelRepository(SoftContext db)
 {
     this.db = db;
 }
 public ReplyModelRepository()
 {
     db = new SoftContext();
 }
 public MainArticleModelRepository(SoftContext db)
 {
     this.db = db;
 }
 public MainArticleModelRepository()
 {
     db = new SoftContext();
 }