Loading CountDownList/Class/ListCore.cs +26 −5 Original line number Diff line number Diff line Loading @@ -457,11 +457,32 @@ namespace CountDownList.Class CountPanel.Children.Remove(element); } public List<ListLabel> ScanToCollection() { List<ListLabel> labels = new(); foreach (ListLabel item in DoingPanel.Children) { labels.Add(item); } foreach (ListLabel item in CountPanel.Children) { labels.Add(item); } foreach (ListLabel item in WcPanel.Children) { labels.Add(item); } return labels; } /// <summary> /// 将ListLabels转成列表 /// </summary> /// <returns></returns> public List<ListP> ScanList() public List<ListP> ScanToListP() { List<ListP> l = new(); Loading Loading @@ -590,7 +611,7 @@ namespace CountDownList.Class /// </summary> public void OpenMainWindow() { Home home = new(ScanList()); Home home = new(ScanToListP()); home.OnAdd += Home_OnAdd; home.OnEdit += Home_OnEdit; home.OnDelete += Home_OnDelete; Loading Loading @@ -636,7 +657,7 @@ namespace CountDownList.Class DeleteForElement(delElememt); if (sender != null) { ((Home)sender).RefreshList(ScanList()); ((Home)sender).RefreshList(ScanToListP()); } } else Loading Loading @@ -668,7 +689,7 @@ namespace CountDownList.Class EditAndChange(editElement); if (sender != null) { ((Home)sender).RefreshList(ScanList()); ((Home)sender).RefreshList(ScanToListP()); } } else Loading @@ -693,7 +714,7 @@ namespace CountDownList.Class { if (sender != null) { ((Home)sender).RefreshList(ScanList()); ((Home)sender).RefreshList(ScanToListP()); } } } Loading CountDownList/Class/XML.cs +47 −23 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ namespace CountDownList.Class xmlDoc.Load($"{AppDomain.CurrentDomain.BaseDirectory}\\Data\\CountDownList.xml"); } public void ReadListLabels(List<Controls.ListLabel> labels) public void WriteListLabels(List<Controls.ListLabel> labels) { XmlNode rootNode = xmlDoc.SelectSingleNode("shRabbit").SelectSingleNode("CountDownList"); foreach (XmlNode item in rootNode.ChildNodes) Loading @@ -39,7 +39,26 @@ namespace CountDownList.Class { XmlElement newElement = xmlDoc.CreateElement("ListLabel"); //newElement.att newElement.SetAttributeNode("Title", label.Title); newElement.SetAttributeNode("IsCount", Convert.ToString(label.IsCountMode)); newElement.SetAttributeNode("StartTime", label.StartTime.Ticks.ToString()); newElement.SetAttributeNode("EndTime", label.EndTime.Ticks.ToString()); newElement.SetAttributeNode("IsCount", Convert.ToString(label.DarkText)); if (label.LabelBackground.GetType() == new SolidColorBrush().GetType()) { //是纯色 newElement.SetAttributeNode("BackgroundType", "Color"); newElement.SetAttributeNode("BackgroundT", $"{((SolidColorBrush)label.LabelBackground).Color.A},{((SolidColorBrush)label.LabelBackground).Color.R},{((SolidColorBrush)label.LabelBackground).Color.G},{((SolidColorBrush)label.LabelBackground).Color.B}"); } else { //是图片 newElement.SetAttributeNode("BackgroundType", "Image"); newElement.SetAttributeNode("BackgroundT", ((ImageBrush)label.LabelBackground).ImageSource.ToString()); } newElement.SetAttributeNode("IsReadOnly", Convert.ToString(label.IsReadOnly)); rootNode.AppendChild(newElement); } Loading Loading @@ -111,7 +130,8 @@ namespace CountDownList.Class break; } } try { if (isImageBackground) { ImageBrush ib = new(); Loading @@ -121,12 +141,12 @@ namespace CountDownList.Class } else { byte[] color = new byte[3]; string[] colorRaw = new string[3]; byte[] color = new byte[4]; string[] colorRaw = new string[4]; colorRaw = backgroundRaw.Split(','); for (int i = 0; i < 3; i++) for (int i = 0; i < 4; i++) { color[i] = Convert.ToByte(colorRaw[i]); color[i] = Convert.ToByte(Convert.ToInt32(colorRaw[i])); } SolidColorBrush sb = new(Color.FromArgb(color[0], color[1], color[2], color[3])); Loading @@ -137,6 +157,10 @@ namespace CountDownList.Class lb.IsReadOnly = isReadOnly; result.Add(lb); } catch (Exception) { } } return result; } } Loading CountDownList/Data/CountDownList.xml +1 −1 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8" ?> <shRabbit> <CountDownList> <ListLabel Title="Test" IsCount="False" StartTime="638700660638405013" EndTime="638700663281575412" DarkText="False" BackgroundType="Image" Background="UI\test.png" IsReadOnly="True"/> <ListLabel Title="Test" IsCount="False" StartTime="638700660638405013" EndTime="638700663281575412" DarkText="False" BackgroundType="Color" Background="255,255,255,255" IsReadOnly="false"/> </CountDownList> </shRabbit> CountDownList/MainWindow.xaml.cs +2 −0 Original line number Diff line number Diff line Loading @@ -74,6 +74,8 @@ namespace CountDownList private void Button_Click_1(object sender, RoutedEventArgs e) { Class.CountCownListXml xml = new(); xml.WriteListLabels(Core.ScanToCollection()); Application.Current.Shutdown(); } Loading Loading
CountDownList/Class/ListCore.cs +26 −5 Original line number Diff line number Diff line Loading @@ -457,11 +457,32 @@ namespace CountDownList.Class CountPanel.Children.Remove(element); } public List<ListLabel> ScanToCollection() { List<ListLabel> labels = new(); foreach (ListLabel item in DoingPanel.Children) { labels.Add(item); } foreach (ListLabel item in CountPanel.Children) { labels.Add(item); } foreach (ListLabel item in WcPanel.Children) { labels.Add(item); } return labels; } /// <summary> /// 将ListLabels转成列表 /// </summary> /// <returns></returns> public List<ListP> ScanList() public List<ListP> ScanToListP() { List<ListP> l = new(); Loading Loading @@ -590,7 +611,7 @@ namespace CountDownList.Class /// </summary> public void OpenMainWindow() { Home home = new(ScanList()); Home home = new(ScanToListP()); home.OnAdd += Home_OnAdd; home.OnEdit += Home_OnEdit; home.OnDelete += Home_OnDelete; Loading Loading @@ -636,7 +657,7 @@ namespace CountDownList.Class DeleteForElement(delElememt); if (sender != null) { ((Home)sender).RefreshList(ScanList()); ((Home)sender).RefreshList(ScanToListP()); } } else Loading Loading @@ -668,7 +689,7 @@ namespace CountDownList.Class EditAndChange(editElement); if (sender != null) { ((Home)sender).RefreshList(ScanList()); ((Home)sender).RefreshList(ScanToListP()); } } else Loading @@ -693,7 +714,7 @@ namespace CountDownList.Class { if (sender != null) { ((Home)sender).RefreshList(ScanList()); ((Home)sender).RefreshList(ScanToListP()); } } } Loading
CountDownList/Class/XML.cs +47 −23 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ namespace CountDownList.Class xmlDoc.Load($"{AppDomain.CurrentDomain.BaseDirectory}\\Data\\CountDownList.xml"); } public void ReadListLabels(List<Controls.ListLabel> labels) public void WriteListLabels(List<Controls.ListLabel> labels) { XmlNode rootNode = xmlDoc.SelectSingleNode("shRabbit").SelectSingleNode("CountDownList"); foreach (XmlNode item in rootNode.ChildNodes) Loading @@ -39,7 +39,26 @@ namespace CountDownList.Class { XmlElement newElement = xmlDoc.CreateElement("ListLabel"); //newElement.att newElement.SetAttributeNode("Title", label.Title); newElement.SetAttributeNode("IsCount", Convert.ToString(label.IsCountMode)); newElement.SetAttributeNode("StartTime", label.StartTime.Ticks.ToString()); newElement.SetAttributeNode("EndTime", label.EndTime.Ticks.ToString()); newElement.SetAttributeNode("IsCount", Convert.ToString(label.DarkText)); if (label.LabelBackground.GetType() == new SolidColorBrush().GetType()) { //是纯色 newElement.SetAttributeNode("BackgroundType", "Color"); newElement.SetAttributeNode("BackgroundT", $"{((SolidColorBrush)label.LabelBackground).Color.A},{((SolidColorBrush)label.LabelBackground).Color.R},{((SolidColorBrush)label.LabelBackground).Color.G},{((SolidColorBrush)label.LabelBackground).Color.B}"); } else { //是图片 newElement.SetAttributeNode("BackgroundType", "Image"); newElement.SetAttributeNode("BackgroundT", ((ImageBrush)label.LabelBackground).ImageSource.ToString()); } newElement.SetAttributeNode("IsReadOnly", Convert.ToString(label.IsReadOnly)); rootNode.AppendChild(newElement); } Loading Loading @@ -111,7 +130,8 @@ namespace CountDownList.Class break; } } try { if (isImageBackground) { ImageBrush ib = new(); Loading @@ -121,12 +141,12 @@ namespace CountDownList.Class } else { byte[] color = new byte[3]; string[] colorRaw = new string[3]; byte[] color = new byte[4]; string[] colorRaw = new string[4]; colorRaw = backgroundRaw.Split(','); for (int i = 0; i < 3; i++) for (int i = 0; i < 4; i++) { color[i] = Convert.ToByte(colorRaw[i]); color[i] = Convert.ToByte(Convert.ToInt32(colorRaw[i])); } SolidColorBrush sb = new(Color.FromArgb(color[0], color[1], color[2], color[3])); Loading @@ -137,6 +157,10 @@ namespace CountDownList.Class lb.IsReadOnly = isReadOnly; result.Add(lb); } catch (Exception) { } } return result; } } Loading
CountDownList/Data/CountDownList.xml +1 −1 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8" ?> <shRabbit> <CountDownList> <ListLabel Title="Test" IsCount="False" StartTime="638700660638405013" EndTime="638700663281575412" DarkText="False" BackgroundType="Image" Background="UI\test.png" IsReadOnly="True"/> <ListLabel Title="Test" IsCount="False" StartTime="638700660638405013" EndTime="638700663281575412" DarkText="False" BackgroundType="Color" Background="255,255,255,255" IsReadOnly="false"/> </CountDownList> </shRabbit>
CountDownList/MainWindow.xaml.cs +2 −0 Original line number Diff line number Diff line Loading @@ -74,6 +74,8 @@ namespace CountDownList private void Button_Click_1(object sender, RoutedEventArgs e) { Class.CountCownListXml xml = new(); xml.WriteListLabels(Core.ScanToCollection()); Application.Current.Shutdown(); } Loading