private void Start() { State = ClientStates.Synchronization; OpeningSettings = new ClientSettings(this); Settings = OpeningSettings; // .Clone(); if (FileSystem == null) { FileSystem = new YnetFS.FileSystem.Mock.MockFS(this, MyDir.FullName); FileSystem.OnFolderEvent += FileSystem_OnFolderEvent; FileSystem.OnFileEvent += FileSystem_OnFileEvent; } if (Environment == null) Environment = new MemoryIE(this); Environment.OnIeStateChanged += _Environment_OnIeStateChanged; ; Environment.OnReady += Environment_OnReady; RemoteClients.CollectionChanged += RemoteClients_CollectionChanged; Environment.Start(); bool groupSynced = CheckGroupSynchronized(); var losync = !groupSynced && CheckLastOneSynchronized(); if (losync) { Log(LogLevel.Info, "Мы сами LastOne", null); Environment.SendToAll(new SyncMessage()); if (CheckReadyForOnline()) { State = ClientStates.Online; } else { State = ClientStates.Idle; } } else { State = ClientStates.Synchronization; } SaveSettings(); }
public ClientSettings Clone() { var r = new ClientSettings() { RemainingClients = new ObservableCollection<string>(this.RemainingClients), //FirstStart = this.FirstStart, c = this.c, WasInSynchronizedGroup = this.WasInSynchronizedGroup }; r.RemainingClients.CollectionChanged += r.RemainingClients_CollectionChanged; return r; }