Esempio n. 1
0
        public static MainWindowState Load()
        {
            MainWindowState state    = null;
            FileStream      fs       = null;
            String          fileName = "window-state.xml";

            if (File.Exists(fileName))
            {
                try
                {
                    XmlSerializer ser = new XmlSerializer(typeof(MainWindowState));
                    fs    = new FileStream(fileName, FileMode.Open);
                    state = (MainWindowState)ser.Deserialize(fs);
                }
                catch (Exception)
                {
                }
                finally
                {
                    if (fs != null)
                    {
                        fs.Close();
                    }
                }
            }
            if (state != null)
            {
                return(state);
            }


            state = new MainWindowState();
            return(state);
        }
Esempio n. 2
0
 public MainWindow()
 {
     InitializeComponent();
     state                 = MainWindowState.Load();
     this.DataContext      = state;
     drawer                = new SineDrawer(SineCanvas, state);
     SineCanvas.MouseDown += SineCanvas_MouseDown;
 }
Esempio n. 3
0
 public SineDrawer(Canvas canvas, MainWindowState state)
 {
     this.canvas = canvas;
     this.state  = state;
 }