private async void UpdateClipboard() { Indicator.IsBusy = true; if (ProfileComboBox.IsLoaded && ProfileComboBox.SelectedValue != null && ProfileComboBox.SelectedValue as string != "Default") { if (ProfileComboBox.Items.Contains("Default")) { UpdateProfileComboBox(false, ProfileComboBox.SelectedValue as string); } Clipboard.ClearHistory(); using (LiteDatabase db = new LiteDatabase($"Filename={Path.Combine(documents, "Auto Paste Clipboard", "data.db")}; Connection=shared")) { ILiteCollection <ClipboardProfile> collection = db.GetCollection <ClipboardProfile>("clipboard"); ClipboardProfile clipboardProfile = collection.FindOne(x => x.Profile == ProfileComboBox.SelectedValue as string); foreach (string item in clipboardProfile.Clipboard) { DataPackage data = new DataPackage(); data.SetText(item); Clipboard.SetContent(data); await Task.Delay(450); } DelimiterComboBox.SelectedIndex = clipboardProfile.Delimeter; DelayUpDownBox.Value = clipboardProfile.Delay; ProfileNameTextBox.Text = ProfileComboBox.SelectedValue as string; } } UndoChangesBtn.IsEnabled = false; Indicator.IsBusy = false; }
private void ClearClipboard(object sender, RoutedEventArgs e) { Clipboard.ClearHistory(); UndoChangesBtn.IsEnabled = false; }