| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 | using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;using System.Windows.Shapes;using System.Diagnostics;using System.IO;namespace Aitex.UI.RecipeEditor{    /// <summary>    /// Interaction logic for RecipeHelpView.xaml    /// </summary>    public partial class RecipeHelpView : Window    {        readonly static Lazy<RecipeHelpView> _instace =        new Lazy<RecipeHelpView>(() => new RecipeHelpView(), true);        public static RecipeHelpView Instance        {            get            {                return _instace.Value;            }        }        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)        {            Hide();            e.Cancel = true;        }        RecipeHelpView()        {            InitializeComponent();            Closing += new System.ComponentModel.CancelEventHandler(Window_Closing);            IsVisibleChanged += new DependencyPropertyChangedEventHandler(RecipeHelpView_IsVisibleChanged);            try            {                var dir = new FileInfo(Process.GetCurrentProcess().MainModule.FileName).Directory;                string docFile = dir + "\\HelpDoc.rtf";                using (var swr = new System.IO.StreamReader(docFile))                {                    Notes = swr.ReadToEnd();                }            }            catch (Exception ex)            {                System.Diagnostics.Debug.WriteLine(ex.Message);            }        }        void RecipeHelpView_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)        {            DataContext = null;            DataContext = this;                    }        public string Notes { get; set; }    }}
 |