diff --git a/App.xaml.cs b/App.xaml.cs
index b145026..d1066f8 100644
--- a/App.xaml.cs
+++ b/App.xaml.cs
@@ -1,7 +1,9 @@
using GeekDesk.Constant;
+using GeekDesk.Util;
using Microsoft.Win32;
using System;
using System.IO;
+using System.Text;
using System.Windows;
using System.Windows.Media.Animation;
using System.Windows.Threading;
@@ -35,47 +37,20 @@ namespace GeekDesk
}
}
}
+
+ void Current_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
+ {
+ e.Handled = true;//使用这一行代码告诉运行时,该异常被处理了,不再作为UnhandledException抛出了。
+ LogUtil.WriteErrorLog(e, "未捕获异常!");
+ }
+
+ void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
+ {
+ LogUtil.WriteErrorLog(e, "严重异常!");
+ MessageBox.Show("GeekDesk遇到未知问题崩溃!");
+ }
+
+
}
-
-
-
-
- // private void WriteLog(object exception)
- // {
- // Exception ex = exception as Exception;
-
- // using (FileStream fs = File.Open(".//ErrorLog.txt", FileMode.OpenOrCreate, FileAccess.ReadWrite))
- // {
- // fs.Seek(0, SeekOrigin.End);
- // byte[] buffer = Encoding.Default.GetBytes("-------------------------------------------------------\r\n");
- // fs.Write(buffer, 0, buffer.Length);
-
- // buffer = Encoding.Default.GetBytes(DateTime.Now.ToString() + "\r\n");
- // fs.Write(buffer, 0, buffer.Length);
-
- // if (ex != null)
- // {
- // buffer = Encoding.Default.GetBytes("成员名: " + ex.TargetSite + "\r\n");
- // fs.Write(buffer, 0, buffer.Length);
-
- // buffer = Encoding.Default.GetBytes("引发异常的类: " + ex.TargetSite.DeclaringType + "\r\n");
- // fs.Write(buffer, 0, buffer.Length);
-
- // buffer = Encoding.Default.GetBytes("异常信息: " + ex.Message + "\r\n");
- // fs.Write(buffer, 0, buffer.Length);
-
- // buffer = Encoding.Default.GetBytes("引发异常的程序集或对象: " + ex.Source + "\r\n");
- // fs.Write(buffer, 0, buffer.Length);
-
- // buffer = Encoding.Default.GetBytes("栈:" + ex.StackTrace + "\r\n");
- // fs.Write(buffer, 0, buffer.Length);
- // }
- // else
- // {
- // buffer = Encoding.Default.GetBytes("应用程序错误: " + exception.ToString() + "\r\n");
- // fs.Write(buffer, 0, buffer.Length);
- // }
- // }
-
- //}
+
}
diff --git a/Constant/Constants.cs b/Constant/Constants.cs
index 1cda463..f344463 100644
--- a/Constant/Constants.cs
+++ b/Constant/Constants.cs
@@ -20,6 +20,10 @@ namespace GeekDesk.Constant
///
public static string DATA_FILE_PATH = APP_DIR + "Data"; //app数据文件路径
+ public static string LOG_FILE_PATH = APP_DIR + "Log.log";
+
+ public static string ERROR_FILE_PATH = APP_DIR + "Error.log";
+
//默认文件夹图标
public static string DEFAULT_DIR_IMAGE_BASE64 = "iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAASISURBVHhe7dvPi9R1HMfx/Qu6RYfqEp1CZ8Yko0MQRNEPgnQ36FJEFyPoF/0DHbx06dSlnVkF6SgEgocOYUEG0cFWpQ476yhbQfTDslJxk+k79S1IP/NSF3f2O+7jBY/TKgvz/j5nXMUZMzMzMzMzMzMzMzMzMzMzu959023dsbSw9YGlbuchyk7v3XbP0t5tt9Yvmd3MW3r//luWu623TvbahytDrtvBQa/9xvJ85776JbWbZf359s7quCcKR2cNqjeaQ/35zgv1y2vTvOqgOy4/MDdG9abzwWC+06lfapu2jf4cXTosN9SZ5W7n9folt2nZ6Ifw6niDy47JelloH6hfepuGLffa7xQPyfpZaL9Xv/zW5K307r27eEDWXfXG9GJ9BmvqqneyV0rHYzL63a3b61NYEzfodT4rHY4J8UetZq/6mF8pHo6J8SnS4JUOxqS19tTnsKatfDAm7Hh9DmvaCsdiAwx6rcfqk1iTVjoWkzfotd+uT2JNWulYTN5yr/VFfRJr0krHYoN0t7Tqs1hTVjwUG6L6OeS1+izWlJUOxYb5xb+JNGyFI7Gxfqp+YN83+h+drK/+wtbH+3u33FmnUF7hQLCpLPfaSycX2u/WSfx/pd8Am1H1yf3d6FOlTuOflX4hbGrd1vN1HgKBou6W2wQC4+0XCASnuu1dAoGxWnsEAmMMeq1DAoExRn/tKxAIBALBmgMZ7Nsx/Pbgc9B4J3udK57fa7WmQEbf1GyatnLg6eKzfDVrCuTcypH625pNx37rHyo+y1ezpkAufL9Yf1uz6dgfpz8uPstXIxDbFBOIWZhAzMIEYhYmELMwgZiFCcQsTCBmYQIxCxOIWZhAzMIEYhYmELMwgZiFrTmQ0/u3D89+8tjw/OdPXbPVr18eXlp6E6bG6le7i8/yOL8efnR4at+24czvR54Y/nl8DrjM6INjpvQFYG548ehOgcA4AoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCC4e3XVJIDBG9QmyKhAY4+Li7HmBwBirx2bPCgTGOTH3g0BgHIFAIBAI6kDOXPEFoDLbn7l0bG53+YuwyS3OPTsz2oVjs3etLs49OM65T5/c9fNHj7z044cPvwrTbvQsj57p0rP+r3NfPnP733GYmZmZmZmZmZmZmZmZmZnZf5uZ+QsdP8v10G4AYgAAAABJRU5ErkJggg==";
diff --git a/Control/Other/IconInfoDialog.xaml.cs b/Control/Other/IconInfoDialog.xaml.cs
index ef9ebde..5d8223e 100644
--- a/Control/Other/IconInfoDialog.xaml.cs
+++ b/Control/Other/IconInfoDialog.xaml.cs
@@ -74,9 +74,10 @@ namespace GeekDesk.Control.Other
info.BitmapImage = ImageUtil.GetBitmapIconByPath(ofd.FileName);
CommonCode.SaveAppData(MainWindow.appData);
}
- } catch (Exception)
+ } catch (Exception e1)
{
HandyControl.Controls.Growl.WarningGlobal("修改图标失败,已重置为默认图标!");
+ LogUtil.WriteErrorLog(e1, "修改图标失败!");
}
}
diff --git a/Control/Other/IconInfoUrlDialog.xaml.cs b/Control/Other/IconInfoUrlDialog.xaml.cs
index c3bd8ca..bc1b6c2 100644
--- a/Control/Other/IconInfoUrlDialog.xaml.cs
+++ b/Control/Other/IconInfoUrlDialog.xaml.cs
@@ -89,9 +89,10 @@ namespace GeekDesk.Control.Other
info.BitmapImage = ImageUtil.GetBitmapIconByPath(ofd.FileName);
CommonCode.SaveAppData(MainWindow.appData);
}
- } catch (Exception)
+ } catch (Exception e1)
{
HandyControl.Controls.Growl.WarningGlobal("修改图标失败,已重置为默认图标!");
+ LogUtil.WriteErrorLog(e1, "修改图标失败!");
}
}
diff --git a/Control/UserControls/Config/ThemeControl.xaml.cs b/Control/UserControls/Config/ThemeControl.xaml.cs
index 6b54c22..933a037 100644
--- a/Control/UserControls/Config/ThemeControl.xaml.cs
+++ b/Control/UserControls/Config/ThemeControl.xaml.cs
@@ -53,9 +53,10 @@ namespace GeekDesk.Control.UserControls.Config
appConfig.BacImgName = ofd.FileName;
}
}
- catch (Exception)
+ catch (Exception e1)
{
HandyControl.Controls.Growl.WarningGlobal("修改背景失败,已重置为默认背景!");
+ LogUtil.WriteErrorLog(e1, "修改背景失败!");
}
}
@@ -69,9 +70,10 @@ namespace GeekDesk.Control.UserControls.Config
appConfig.BitmapImage = ImageUtil.Base64ToBitmapImage(Constants.DEFAULT_BAC_IMAGE_BASE64);
appConfig.BacImgName = "系统默认";
}
- catch (Exception)
+ catch (Exception e1)
{
HandyControl.Controls.Growl.WarningGlobal("修改背景失败,已重置为默认背景!");
+ LogUtil.WriteErrorLog(e1, "修改默认背景失败!");
}
}
diff --git a/Control/UserControls/PannelCard/RightCardControl.xaml.cs b/Control/UserControls/PannelCard/RightCardControl.xaml.cs
index 89d7ebc..ff785e6 100644
--- a/Control/UserControls/PannelCard/RightCardControl.xaml.cs
+++ b/Control/UserControls/PannelCard/RightCardControl.xaml.cs
@@ -195,9 +195,10 @@ namespace GeekDesk.Control.UserControls.PannelCard
p.Start();
icon.Count++;
}
- catch (Exception)
+ catch (Exception e)
{
HandyControl.Controls.Growl.WarningGlobal("程序启动失败(不支持的启动方式)!");
+ LogUtil.WriteErrorLog(e, "程序启动失败:path=" + icon.Path + ",type=" + type);
}
}
diff --git a/Control/Windows/IconfontWindow.xaml.cs b/Control/Windows/IconfontWindow.xaml.cs
index e705650..c8c9b6a 100644
--- a/Control/Windows/IconfontWindow.xaml.cs
+++ b/Control/Windows/IconfontWindow.xaml.cs
@@ -168,9 +168,10 @@ namespace GeekDesk.Control.Windows
LoadingEle.Visibility = Visibility.Collapsed;
CustomIcon.Visibility = Visibility.Visible;
}
- catch (Exception)
+ catch (Exception e)
{
HandyControl.Controls.Growl.WarningGlobal("加载远程图标异常!");
+ LogUtil.WriteErrorLog(e, "加载远程图标异常!");
}
}
diff --git a/Control/Windows/UpdateWindow.xaml.cs b/Control/Windows/UpdateWindow.xaml.cs
index 6b1be10..a02d33e 100644
--- a/Control/Windows/UpdateWindow.xaml.cs
+++ b/Control/Windows/UpdateWindow.xaml.cs
@@ -38,9 +38,9 @@ namespace GeekDesk.Control.Windows
InitializeComponent();
DataHandle(jo);
}
- catch (Exception)
+ catch (Exception e)
{
-
+ LogUtil.WriteErrorLog(e, "更新信息格式化失败!");
}
}
diff --git a/GeekDesk.csproj b/GeekDesk.csproj
index 6906e6d..21987d3 100644
--- a/GeekDesk.csproj
+++ b/GeekDesk.csproj
@@ -195,13 +195,13 @@
-
+
diff --git a/Thread/UpdateThread.cs b/Thread/UpdateThread.cs
index 13ffb41..947366d 100644
--- a/Thread/UpdateThread.cs
+++ b/Thread/UpdateThread.cs
@@ -59,12 +59,9 @@ namespace GeekDesk.Thread
}));
}
}
-#pragma warning disable CS0168 // 声明了变量“e”,但从未使用过
} catch (Exception e)
-#pragma warning restore CS0168 // 声明了变量“e”,但从未使用过
{
- //不做处理
- //MessageBox.Show(e.Message);
+ LogUtil.WriteErrorLog(e, "检测更新失败!");
}
}
}
diff --git a/Util/FileUtil.cs b/Util/FileUtil.cs
index e5d100b..eefdca4 100644
--- a/Util/FileUtil.cs
+++ b/Util/FileUtil.cs
@@ -36,6 +36,7 @@ namespace GeekDesk.Util
catch (Exception e)
#pragma warning restore CS0168 // 声明了变量“e”,但从未使用过
{
+ LogUtil.WriteErrorLog(e, "获取文件图标失败! filePath=" + filePath);
return null;
}
}
diff --git a/Util/Functions.cs b/Util/Functions.cs
deleted file mode 100644
index d5b3bf7..0000000
--- a/Util/Functions.cs
+++ /dev/null
@@ -1,87 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.IO;
-
-namespace GeekDesk.Util
-{
-
- public class Functions
- {
- public static string GetShortcutTarget(string file)
- {
- try
- {
- if (System.IO.Path.GetExtension(file).ToLower() != ".lnk")
- {
- throw new Exception("Supplied file must be a .LNK file");
- }
-
- FileStream fileStream = File.Open(file, FileMode.Open, FileAccess.Read);
- using (System.IO.BinaryReader fileReader = new BinaryReader(fileStream))
- {
- fileStream.Seek(0x14, SeekOrigin.Begin); // Seek to flags
- uint flags = fileReader.ReadUInt32(); // Read flags
- if ((flags & 1) == 1)
- { // Bit 1 set means we have to
- // skip the shell item ID list
- fileStream.Seek(0x4c, SeekOrigin.Begin); // Seek to the end of the header
- uint offset = fileReader.ReadUInt16(); // Read the length of the Shell item ID list
- fileStream.Seek(offset, SeekOrigin.Current); // Seek past it (to the file locator info)
- }
-
- long fileInfoStartsAt = fileStream.Position; // Store the offset where the file info
- // structure begins
- uint totalStructLength = fileReader.ReadUInt32(); // read the length of the whole struct
- fileStream.Seek(0xc, SeekOrigin.Current); // seek to offset to base pathname
- uint fileOffset = fileReader.ReadUInt32(); // read offset to base pathname
- // the offset is from the beginning of the file info struct (fileInfoStartsAt)
- fileStream.Seek((fileInfoStartsAt + fileOffset), SeekOrigin.Begin); // Seek to beginning of
- // base pathname (target)
- long pathLength = (totalStructLength + fileInfoStartsAt) - fileStream.Position - 2; // read
- // the base pathname. I don't need the 2 terminating nulls.
- char[] linkTarget = fileReader.ReadChars((int)pathLength); // should be unicode safe
- var link = new string(linkTarget);
-
- int begin = link.IndexOf("\0\0");
- if (begin > -1)
- {
- int end = link.IndexOf("\\\\", begin + 2) + 2;
- end = link.IndexOf('\0', end) + 1;
-
- string firstPart = link.Substring(0, begin);
- string secondPart = link.Substring(end);
-
- return firstPart + secondPart;
- }
- else
- {
- return link;
- }
- }
- }
- catch
- {
- return "";
- }
- }
- }
-
- class Program
- {
- static void Main(string[] args)
- {
- if (args.Length == 0)
- {
- System.Console.WriteLine("Please try again with a file path");
- }
- else
- {
- System.Console.WriteLine("LNK File: " + args[0]);
- System.Console.WriteLine("LNK Path: " + Functions.GetShortcutTarget(args[0]));
- }
- }
- }
-}
\ No newline at end of file
diff --git a/Util/GlobalHotKey.cs b/Util/GlobalHotKey.cs
index 34bcb48..b8f5ca9 100644
--- a/Util/GlobalHotKey.cs
+++ b/Util/GlobalHotKey.cs
@@ -53,9 +53,10 @@ namespace GeekDesk.Util
UnregisterHotKey(handleTemp[id].Handle, id);
GlobalHotKey.handleTemp[id].Dispose();
GlobalHotKey.handleTemp.Remove(id);
- } catch
+ } catch (Exception e)
{
//nothing
+ LogUtil.WriteErrorLog(e, "取消注册热键异常!");
}
diff --git a/Util/ImageUtil.cs b/Util/ImageUtil.cs
index 25ac354..40cca2c 100644
--- a/Util/ImageUtil.cs
+++ b/Util/ImageUtil.cs
@@ -202,8 +202,9 @@ namespace GeekDesk.Util
return bm;
}
}
- catch (Exception)
+ catch (Exception e)
{
+ LogUtil.WriteErrorLog(e, "获取文件缩略图失败!filePath="+filePath);
return Base64ToBitmapImage(Constants.DEFAULT_IMG_IMAGE_BASE64);
}
@@ -302,8 +303,9 @@ namespace GeekDesk.Util
ms.Close();
return Convert.ToBase64String(arr);
}
- catch (Exception)
+ catch (Exception e)
{
+ LogUtil.WriteErrorLog(e, "图片文件转base64失败!Imagefilename=" + Imagefilename + ",ImageFormat="+format);
return null;
}
}
diff --git a/Util/LogUtil.cs b/Util/LogUtil.cs
new file mode 100644
index 0000000..4fc397b
--- /dev/null
+++ b/Util/LogUtil.cs
@@ -0,0 +1,76 @@
+using GeekDesk.Constant;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace GeekDesk.Util
+{
+ public class LogUtil
+ {
+ public static void WriteErrorLog(object exception, string msg = "")
+ {
+ try
+ {
+ Exception ex = exception as Exception;
+
+ using (FileStream fs = File.Open(Constants.ERROR_FILE_PATH, FileMode.OpenOrCreate, FileAccess.ReadWrite))
+ {
+ fs.Seek(0, SeekOrigin.End);
+ byte[] buffer = Encoding.Default.GetBytes("-------------------------------------------------------\r\n");
+ fs.Write(buffer, 0, buffer.Length);
+
+ buffer = Encoding.Default.GetBytes(DateTime.Now.ToString() + msg + "\r\n");
+ fs.Write(buffer, 0, buffer.Length);
+
+ if (ex != null)
+ {
+ buffer = Encoding.Default.GetBytes("成员名: " + ex.TargetSite + "\r\n");
+ fs.Write(buffer, 0, buffer.Length);
+
+ buffer = Encoding.Default.GetBytes("引发异常的类: " + ex.TargetSite.DeclaringType + "\r\n");
+ fs.Write(buffer, 0, buffer.Length);
+
+ buffer = Encoding.Default.GetBytes("异常信息: " + ex.Message + "\r\n");
+ fs.Write(buffer, 0, buffer.Length);
+
+ buffer = Encoding.Default.GetBytes("引发异常的程序集或对象: " + ex.Source + "\r\n");
+ fs.Write(buffer, 0, buffer.Length);
+
+ buffer = Encoding.Default.GetBytes("栈:" + ex.StackTrace + "\r\n");
+ fs.Write(buffer, 0, buffer.Length);
+ }
+ else
+ {
+ buffer = Encoding.Default.GetBytes("应用程序错误: " + exception.ToString() + "\r\n");
+ fs.Write(buffer, 0, buffer.Length);
+ }
+ }
+ } catch
+ {
+
+ }
+
+ }
+
+
+ public static void WriteLog(string msg)
+ {
+ try {
+ using (FileStream fs = File.Open(Constants.LOG_FILE_PATH, FileMode.OpenOrCreate, FileAccess.ReadWrite))
+ {
+ fs.Seek(0, SeekOrigin.End);
+ byte[] buffer = Encoding.Default.GetBytes("-------------------------------------------------------\r\n");
+ fs.Write(buffer, 0, buffer.Length);
+
+ buffer = Encoding.Default.GetBytes(DateTime.Now.ToString() + msg + "\r\n" );
+ fs.Write(buffer, 0, buffer.Length);
+ }
+ } catch { }
+ }
+
+
+ }
+}
diff --git a/Util/RegisterUtil.cs b/Util/RegisterUtil.cs
index d6f723c..bb66d34 100644
--- a/Util/RegisterUtil.cs
+++ b/Util/RegisterUtil.cs
@@ -52,6 +52,7 @@ namespace GeekDesk.Util
catch (Exception ex)
#pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过
{
+ LogUtil.WriteErrorLog(ex, "注册启动Error1!");
return false;
}
}
@@ -66,6 +67,7 @@ namespace GeekDesk.Util
catch (Exception ex)
#pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过
{
+ LogUtil.WriteErrorLog(ex, "注册启动Error2!");
return false;
}
}
@@ -79,6 +81,7 @@ namespace GeekDesk.Util
{
key.Close();
}
+ LogUtil.WriteErrorLog(ex, "注册启动Error3!");
return false;
}
}
diff --git a/ViewModel/AppConfig.cs b/ViewModel/AppConfig.cs
index 122f2d8..5e7bdeb 100644
--- a/ViewModel/AppConfig.cs
+++ b/ViewModel/AppConfig.cs
@@ -1,6 +1,7 @@
using GeekDesk.Constant;
using GeekDesk.Util;
+using Newtonsoft.Json;
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
@@ -722,5 +723,9 @@ namespace GeekDesk.ViewModel
#endregion
+ public override String ToString()
+ {
+ return JsonConvert.SerializeObject(this);
+ }
}
}
diff --git a/ViewModel/AppData.cs b/ViewModel/AppData.cs
index e3d06da..db30b07 100644
--- a/ViewModel/AppData.cs
+++ b/ViewModel/AppData.cs
@@ -1,4 +1,5 @@
using GeekDesk.Util;
+using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -84,6 +85,11 @@ namespace GeekDesk.ViewModel
}
}
+ public override String ToString()
+ {
+ return JsonConvert.SerializeObject(this);
+ }
+
[field: NonSerializedAttribute()]
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged(string propertyName)
diff --git a/ViewModel/IconInfo.cs b/ViewModel/IconInfo.cs
index c5c1943..94656dd 100644
--- a/ViewModel/IconInfo.cs
+++ b/ViewModel/IconInfo.cs
@@ -1,8 +1,11 @@
using GeekDesk.Constant;
using GeekDesk.Util;
+using Newtonsoft.Json;
using System;
using System.ComponentModel;
using System.IO;
+using System.Reflection;
+using System.Text;
using System.Windows.Media.Imaging;
///
@@ -150,10 +153,10 @@ namespace GeekDesk.ViewModel
}
}
-
-
-
-
+ public override String ToString()
+ {
+ return JsonConvert.SerializeObject(this);
+ }
[field: NonSerializedAttribute()]
diff --git a/ViewModel/IconfontInfo.cs b/ViewModel/IconfontInfo.cs
index b5428f7..cf2aa17 100644
--- a/ViewModel/IconfontInfo.cs
+++ b/ViewModel/IconfontInfo.cs
@@ -1,4 +1,5 @@
-using System;
+using Newtonsoft.Json;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -36,5 +37,11 @@ namespace GeekDesk.ViewModel
name = value;
}
}
+
+ public override String ToString()
+ {
+ return JsonConvert.SerializeObject(this);
+ }
+
}
}
diff --git a/ViewModel/MenuInfo.cs b/ViewModel/MenuInfo.cs
index 691e577..a5a706f 100644
--- a/ViewModel/MenuInfo.cs
+++ b/ViewModel/MenuInfo.cs
@@ -1,5 +1,6 @@
using GeekDesk.Constant;
using GeekDesk.Util;
+using Newtonsoft.Json;
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
@@ -142,6 +143,11 @@ namespace GeekDesk.ViewModel
}
}
+ public override String ToString()
+ {
+ return JsonConvert.SerializeObject(this);
+ }
+
[field: NonSerializedAttribute()]
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged(string propertyName)
diff --git a/ViewModel/ToDoInfo.cs b/ViewModel/ToDoInfo.cs
index 1491dcd..298b439 100644
--- a/ViewModel/ToDoInfo.cs
+++ b/ViewModel/ToDoInfo.cs
@@ -1,5 +1,6 @@
using GeekDesk.Constant;
using GeekDesk.Util;
+using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -129,7 +130,10 @@ namespace GeekDesk.ViewModel
// }
//}
-
+ public override String ToString()
+ {
+ return JsonConvert.SerializeObject(this);
+ }
[field: NonSerializedAttribute()]