Skip to content

Commit

Permalink
fix: 修复CA1050警告
Browse files Browse the repository at this point in the history
  • Loading branch information
leven99 committed Oct 6, 2019
1 parent 7811a82 commit 08ed5c6
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 109 deletions.
58 changes: 7 additions & 51 deletions Models/HelpM.cs
Original file line number Diff line number Diff line change
@@ -1,31 +1,20 @@
using OSDA.ViewModels;
using System;
using System.Net.Http;
using System.Web.Script.Serialization;

namespace OSDA.Models
{
public class HelpModel : MainWindowBase, IDisposable
public class HelpModel : MainWindowBase
{
/* 可以获取json内容的两个地址 */
public readonly Uri gitee_uri = new Uri("https://gitee.com/api/v5/repos/leven9/OSDA/releases/latest");
public readonly Uri github_cri = new Uri("https://api.github.com/repos/leven99/OSDA/releases/latest");

/* json中获取到的标签名称 */
public struct UpdateJson
{
public string Tag_name { get; set; }
}

public UpdateJson updateJson;

public HttpClient httpClient = null;
public readonly JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer();

/// <summary>
/// 本地软件的版本号
/// </summary>
public string _VerInfoNumber;
private string _VerInfoNumber;
public string VerInfoNumber
{
get
Expand All @@ -45,7 +34,7 @@ public string VerInfoNumber
/// <summary>
/// 本地软件的版本信息
/// </summary>
public string _VerInfo;
private string _VerInfo;
public string VerInfo
{
get
Expand All @@ -65,7 +54,7 @@ public string VerInfo
/// <summary>
/// 服务器软件的版本号
/// </summary>
public string _UpdateVerInfoNumber;
private string _UpdateVerInfoNumber;
public string UpdateVerInfoNumber
{
get
Expand All @@ -85,7 +74,7 @@ public string UpdateVerInfoNumber
/// <summary>
/// 服务器软件的版本信息
/// </summary>
public string _UpdateInfo;
private string _UpdateInfo;
public string UpdateInfo
{
get
Expand All @@ -105,7 +94,7 @@ public string UpdateInfo
/// <summary>
/// 精简视图
/// </summary>
public bool _Reduced_Enable;
private bool _Reduced_Enable;
public bool Reduced_Enable
{
get
Expand All @@ -125,7 +114,7 @@ public bool Reduced_Enable
/// <summary>
/// 视图可见性
/// </summary>
public string _View_Visibility;
private string _View_Visibility;
public string View_Visibility
{
get
Expand All @@ -152,38 +141,5 @@ public void HelpDataContext()
Reduced_Enable = false;
View_Visibility = "Visible";
}

#region IDisposable Support
private bool disposedValue = false;

/// <summary>
/// 受保护的 Dispose 方法实现
/// </summary>
/// <param name="disposing"></param>
protected virtual void Dispose(bool disposing)
{
if (!disposedValue)
{
if (disposing)
{
/* 释放托管资源(如果需要) */
}

httpClient.Dispose();
httpClient = null;

disposedValue = true;
}
}

/// <summary>
/// httpClient 字段 IDisposable 接口的 Dispose 方法实现(无参数)
/// </summary>
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
#endregion
}
}
41 changes: 8 additions & 33 deletions Models/RecvM.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
using Microsoft.Win32;
using OSDA.Interface;
using OSDA.Interface;
using OSDA.ViewModels;
using System;
using System.IO;
using System.IO.Ports;

namespace OSDA.Models
{
public class RecvModel : MainWindowBase
{
public string DataRecePath = null;
/// <summary>
/// 实现接收区数据超过32MB时,自动清空接收控件中的数据
/// </summary>
public int RecvDataDeleteCount = 1;

public int _RecvDataCount;
private int _RecvDataCount;
public int RecvDataCount
{
get
Expand All @@ -35,7 +25,7 @@ public int RecvDataCount
/// <summary>
/// 接收区Header中的 [保存中/已停止] 字符串
/// </summary>
public string _RecvAutoSave;
private string _RecvAutoSave;
public string RecvAutoSave
{
get
Expand All @@ -55,7 +45,7 @@ public string RecvAutoSave
/// <summary>
/// 接收区Header中的 [允许/暂停] 字符串
/// </summary>
public string _EnableRecv;
private string _EnableRecv;
public string EnableRecv
{
get
Expand All @@ -75,7 +65,7 @@ public string EnableRecv
/// <summary>
/// 接收区Header字符串
/// </summary>
public string _RecvHeader;
private string _RecvHeader;
public string RecvHeader
{
get
Expand All @@ -95,7 +85,7 @@ public string RecvHeader
/// <summary>
/// 接收区 - 允许/暂停接收数据
/// </summary>
public bool _Enable_Recv;
private bool _Enable_Recv;
public bool Enable_Recv
{
get
Expand All @@ -112,7 +102,7 @@ public bool Enable_Recv
}
}

public ITextBoxAppend _RecvData;
private ITextBoxAppend _RecvData;
public ITextBoxAppend RecvData
{
get
Expand All @@ -132,7 +122,7 @@ public ITextBoxAppend RecvData
/// <summary>
/// 辅助区 - 十六进制接收
/// </summary>
public bool _HexRecv;
private bool _HexRecv;
public bool HexRecv
{
get
Expand All @@ -149,21 +139,6 @@ public bool HexRecv
}
}

public void RecvPath()
{
SaveFileDialog ReceDataSaveFileDialog = new SaveFileDialog
{
Title = "接收数据路径选择",
FileName = string.Format("{0}", DateTime.Now.ToString("yyyyMMdd")),
Filter = "文本文件|*.txt"
};

if (ReceDataSaveFileDialog.ShowDialog() == true)
{
DataRecePath = ReceDataSaveFileDialog.FileName;
}
}

public void RecvDataContext()
{
RecvData = new IClassTextBoxAppend();
Expand Down
17 changes: 8 additions & 9 deletions Models/SendM.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
using OSDA.ViewModels;
using System;

namespace OSDA.Models
{
public class SendModel : MainWindowBase
{
public int _SendDataCount;
private int _SendDataCount;
public int SendDataCount
{
get
Expand All @@ -25,7 +24,7 @@ public int SendDataCount
/// <summary>
/// 发送区Header字符串
/// </summary>
public string _SendHeader;
private string _SendHeader;
public string SendHeader
{
get
Expand All @@ -42,7 +41,7 @@ public string SendHeader
}
}

public string _SendData;
private string _SendData;
public string SendData
{
get
Expand All @@ -62,7 +61,7 @@ public string SendData
/// <summary>
/// 辅助区 - 自送发送的时间间隔
/// </summary>
public int _AutoSendNum;
private int _AutoSendNum;
public int AutoSendNum
{
get
Expand All @@ -80,7 +79,7 @@ public int AutoSendNum
}

#region 发送换行
public bool _NonesEnable;
private bool _NonesEnable;
public bool NonesEnable
{
get
Expand All @@ -97,7 +96,7 @@ public bool NonesEnable
}
}

public bool _CrEnable;
private bool _CrEnable;
public bool CrEnable
{
get
Expand All @@ -114,7 +113,7 @@ public bool CrEnable
}
}

public bool _LfEnable;
private bool _LfEnable;
public bool LfEnable
{
get
Expand All @@ -131,7 +130,7 @@ public bool LfEnable
}
}

public bool _CrLfEnable;
private bool _CrLfEnable;
public bool CrLfEnable
{
get
Expand Down
2 changes: 1 addition & 1 deletion Models/TimerM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class TimerModel : MainWindowBase
/// <summary>
/// 状态栏 - 系统时间
/// </summary>
string _SystemTime;
private string _SystemTime;
public string SystemTime
{
get
Expand Down
Loading

0 comments on commit 08ed5c6

Please sign in to comment.