示例#1
0
        private async Task SetRemoteProfileToLocal(Profile remoteProfile)
        {
            Profile localProfile = ProfileFactory.CreateFromLocal();

            if (localProfile.GetProfileType() == ProfileType.ClipboardType.Unknown)
            {
                Log.Write("[PULL] Local profile type is Unkown, stop sync.");
                return;
            }

            Log.Write("[PULL] isChangingRemote = " + _isChangingRemote.ToString());
            if (!_isChangingRemote && remoteProfile != localProfile)
            {
                Thread.Sleep(200);
                if (!_isChangingRemote)
                {
                    SetDownloadingIcon();
                    PullStarted?.Invoke();

                    await remoteProfile.SetLocalClipboard().ConfigureAwait(true);

                    Log.Write("剪切板同步成功:" + remoteProfile.Text);
                    Global.Notifyer.ToastNotify("剪切板同步成功", remoteProfile.ToolTip(), remoteProfile.ExecuteProfile());
                    StopDownloadingIcon();

                    Thread.Sleep(50);
                    PullStopped?.Invoke();
                }
            }
        }
示例#2
0
        private async Task UploadClipboard()
        {
            var currentProfile = ProfileFactory.CreateFromLocal();

            if (currentProfile == null)
            {
                Log.Write("Local profile type is null, stop upload.");
                return;
            }

            if (currentProfile == null || currentProfile.GetProfileType() == ProfileType.ClipboardType.Unknown)
            {
                Log.Write("Local profile type is Unkown, stop upload.");
                return;
            }

            await UploadLoop(currentProfile).ConfigureAwait(true);
        }