From: Stricted Date: Sun, 10 Jan 2016 11:13:50 +0000 (+0100) Subject: copy all selected items on syslog page to clipboard X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=15fd2b09404c1af7148a6df07cfcbfbe939f2668;p=GitHub%2FStricted%2FSpeedportHybridControl.git copy all selected items on syslog page to clipboard --- diff --git a/SpeedportHybridControl/Model/SyslogList.cs b/SpeedportHybridControl/Model/SyslogList.cs index a77d167..d25a122 100644 --- a/SpeedportHybridControl/Model/SyslogList.cs +++ b/SpeedportHybridControl/Model/SyslogList.cs @@ -8,6 +8,7 @@ namespace SpeedportHybridControl.Model { public class SyslogList : SuperViewModel { private string _message; private string _timestamp; + private bool _isSelected; public string message { get { return _message; } @@ -19,6 +20,12 @@ namespace SpeedportHybridControl.Model { set { SetProperty(ref _timestamp, value); } } + public bool IsSelected + { + get { return _isSelected; } + set { SetProperty(ref _isSelected, value); } + } + public override string ToString () { return string.Concat(timestamp, ": ", message); } diff --git a/SpeedportHybridControl/PageModel/SyslogPageModel.cs b/SpeedportHybridControl/PageModel/SyslogPageModel.cs index 0239332..f758664 100644 --- a/SpeedportHybridControl/PageModel/SyslogPageModel.cs +++ b/SpeedportHybridControl/PageModel/SyslogPageModel.cs @@ -14,7 +14,7 @@ namespace SpeedportHybridControl.PageModel { private DelegateCommand _clearCommand; private string _searchText; - private SyslogList _selectedItem; + private SyslogList _selectedItems; private List _syslogList; private List _filteredList; @@ -43,9 +43,10 @@ namespace SpeedportHybridControl.PageModel { } } - public SyslogList SelectedItem { - get { return _selectedItem; } - set { SetProperty(ref _selectedItem, value); } + public SyslogList SelectedItems + { + get { return _selectedItems; } + set { SetProperty(ref _selectedItems, value); } } public List syslogList { @@ -70,8 +71,18 @@ namespace SpeedportHybridControl.PageModel { new Thread(() => { SpeedportHybrid.initSyslog(); }).Start(); } + public IEnumerable SelectedItens + { + get { return filteredList.Where(o => o.IsSelected); } + } + private void OnCopyCommandExecute () { - Clipboard.SetText(SelectedItem.ToString()); + string text = string.Empty; + foreach (SyslogList item in SelectedItens) { + text = string.Concat(text, Environment.NewLine, item.ToString()); + } + + Clipboard.SetText(text); } private void OnClearCommandExecute () { diff --git a/SpeedportHybridControl/page/SyslogPage.xaml b/SpeedportHybridControl/page/SyslogPage.xaml index 2c3fa52..c04aaed 100644 --- a/SpeedportHybridControl/page/SyslogPage.xaml +++ b/SpeedportHybridControl/page/SyslogPage.xaml @@ -11,7 +11,12 @@ - + + + +