| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- using System.IO;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Documents;
- using System.Windows.Input;
- using Muchinfo.MTPClient.Infrastructure.Utilities;
- using Muchinfo.MTPClient.Resources;
- using Muchinfo.WPF.Controls.Windows;
- namespace Muchinfo.MTPClient.UI.Views
- {
- /// <summary>
- /// 关于
- /// </summary>
- public partial class AboutView : Window
- {
- /// <summary>
- /// 显示免责声明和关于我们 1-显示免责声明 2-显示关于我们
- /// </summary>
- /// <param name="type">1-显示免责声明 2-显示关于我们</param>
- public AboutView(int type)
- {
- InitializeComponent();
-
- if (type == 1)
- {
- Title = Client_Resource.UI2014_DisclaimerClause;
- sp.Visibility = Visibility.Hidden;
- grid.Visibility = Visibility.Visible;
- string content = string.Empty;
- try
- {
- //加载rtf文档
- var read = new StreamReader(ApplicationParameter.EscapeClauseFilePath);
- content = read.ReadToEnd();
- read.Close();
- }
- catch
- {
- }
- LoadFromRTF(txt, content);
- this.Width = 500;
- this.Height = 600;
- }
- else
- {
- comTitle.Visibility = UserManager.IsAccountLogin ? Visibility.Visible : Visibility.Collapsed;
- Title = Client_Resource.UI2014_AboutUs;
- proName.Text = ApplicationParameter.TradeSystemName;
- proCompName.Text = ApplicationParameter.ExchangeName;
- proVersion.Text = ApplicationParameter.Version;
- sp.Visibility = Visibility.Visible;
- grid.Visibility = Visibility.Hidden;
- proCopyright.Text = ApplicationParameter.Copyright;
- }
- }
- public static void LoadFromRTF(RichTextBox richTextBox, string rtf)
- {
- if (string.IsNullOrEmpty(rtf))
- {
- rtf = Client_Resource.UI2014_FailedToLoad;
- }
- TextRange textRange = new TextRange(richTextBox.Document.ContentStart, richTextBox.Document.ContentEnd);
- using (MemoryStream ms = new MemoryStream())
- {
- using (StreamWriter sw = new StreamWriter(ms))
- {
- sw.Write(rtf);
- sw.Flush();
- ms.Seek(0, SeekOrigin.Begin);
- textRange.Load(ms, DataFormats.Rtf);
- }
- }
- }
- private void view_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)
- {
- if (e.Key == Key.Escape)
- this.DialogResult = false;
- }
- }
- }
|