コード例 #1
0
        public void openClick(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openDlg = new OpenFileDialog();

            openDlg.Filter           = "AVS Panel files (*.avsp)|*.avsp|All files (*.*)|*.*";
            openDlg.FilterIndex      = 0;
            openDlg.RestoreDirectory = true;

            Nullable <bool> result = openDlg.ShowDialog();

            if (result == true)
            {
                System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(AllPanelData));

                using (Stream reader = new FileStream(openDlg.FileName, FileMode.Open))
                {
                    AllPanelData panelData;

                    // Call the Deserialize method to restore the object's state.
                    panelData = (AllPanelData)serializer.Deserialize(reader);
                    if (panelData.panelList.Count == 2)
                    {
                        m_panels = panelData.panelList[0];
                        LayoutControl.Load(panelData.panelList[1], panelData.panelLayout);
                    }
                }
            }
        }