public MainViewModel() { #if !DEBUG Thread timeAlignThread = new Thread(Models.SteamTwoFactor.AlignTime); timeAlignThread.Start(); Thread ranksThread = new Thread(() => { var ranks = Models.Rank.GetAll(); AvailableRanks = ranks; }); ranksThread.Start(); Items = new System.Collections.ObjectModel.ObservableCollection <Models.Account>(Models.Account.GetAll()); avatarThread = new Thread(LoadAccountSummary); avatarThread.Start(); Thread banThread = new Thread(LoadAccountBans); banThread.Start(); LoginCommand = new lib.AutomatedCommand(Login, CanLogin); OpenURLCommand = new lib.Command(OpenURL); LockAccountCommand = new lib.AutomatedCommand(LockAccount, CanLockAccount); CopyClipboardCommand = new lib.AutomatedCommand(CopyCode, CanCopyCode); ranksThread.Join(); refreshLockTimesThread = new Thread(RefreshLockTimes); refreshLockTimesThread.Start(); #endif }
public TwoFactorViewModel() { new Thread(() => Models.SteamTwoFactor.AlignTime()).Start(); CopyClipboardCommand = new lib.Command((o) => Clipboard.SetText(string.IsNullOrEmpty(Code) ? "" : Code)); t = new DispatcherTimer(); t.Interval = TimeSpan.FromSeconds(1); t.Tick += ((o, e) => DoAsyncWork()); t.Start(); }