public bool Save() { try { using (var sw = new StreamWriter(saveFileName)) { XmlSerializer xml = new XmlSerializer(typeof(List <ClipItem>)); xml.Serialize(sw, ClipItems.ToList()); } } catch { return(false); } return(true); }
public MainViewModel() { LoadSettings(); CopyCommand = new RelayCommand <ClipItem>(CopyCommandExecute); AddCommand = new RelayCommand(o => { SelectedItem = new ClipItem(); ClipItems.Add(SelectedItem); }); RemoveCommand = new RelayCommand(o => { ClipItems.Remove(SelectedItem); }, o => SelectedItem != null); ToggleAlwaysOnTopCommand = new RelayCommand <Window>(wnd => { wnd.Topmost = Settings.Default.AlwaysOnTop; }); }