Exemple #1
0
        public SyncViewModel(ConnectionInfo server = new ConnectionInfo())
        {
            Title = "Синхронизация";

            LocalConnectionString = Nhib.ConnectionString;
            LocalProviderName     = LocalConnectionString.Contains(".sdf") ? Constants.SqlCeProvider : Constants.SqlServerProvider;

            Remote = new DataConnectionViewModel(server);

            Poster.MessagePosted += syncer_MessagePosted;
            Syncer.SyncEnded     += syncer_SyncEnded;
        }
Exemple #2
0
        public bool CanSync(bool local, bool remote)
        {
            bool result = !Syncer.InSync;

            if (local)
            {
                result &= !LocalConnectionString.IsNullOrEmpty() &&
                          (LocalProviderName == Constants.SqlCeProvider ||
                           LocalProviderName == Constants.SqlServerProvider);
            }
            if (remote)
            {
                result &= !RemoteConnectionString.IsNullOrEmpty() &&
                          (RemoteProviderName == Constants.SqlCeProvider ||
                           RemoteProviderName == Constants.SqlServerProvider);
            }
            return(result);
        }