예제 #1
0
        public void LoadGateSet()
        {
            GateManager    gateManager = new GateManager();
            OpenFileDialog dialog      = new OpenFileDialog();

            dialog.Filter = "xml gate set|*.xml";
            dialog.Title  = "Open gate set";
            dialog.ShowDialog();
            if (dialog.FileName != "")
            {
                System.IO.FileStream fs =
                    (System.IO.FileStream)dialog.OpenFile();
                gateManager.LoadGateSetFromXml(fs);
                fs.Close();
            }

            GatedDemodulationConfigSet gateConfigSet = new GatedDemodulationConfigSet();

            gateConfigSet = gateManager.GateSet;
            List <string> gateConfigNames = new List <string>();

            currentGateSetDictionary.Clear();
            log("Gate configs loaded:");
            foreach (GatedDemodulationConfig config in gateConfigSet.GatedDemodulationConfigs)
            {
                gateConfigNames.Add(config.Name);
                log(config.Name);
                currentGateSetDictionary.Add(config.Name, config);
            }
            mainWindow.PopulateGateConfigList(gateConfigNames);
        }
예제 #2
0
        public void SaveGateSet()
        {
            GateManager gateManager = new GateManager();
            GatedDemodulationConfigSet gateConfigSet = new GatedDemodulationConfigSet();

            foreach (string key in currentGateSetDictionary.Keys)
            {
                gateConfigSet.AddGatedDemodulationConfig(currentGateSetDictionary[key]);
            }
            gateManager.GateSet = gateConfigSet;
            SaveFileDialog dialog = new SaveFileDialog();

            dialog.Filter = "xml gate set|*.xml";
            dialog.Title  = "Save gate set";
            dialog.ShowDialog();
            if (dialog.FileName != "")
            {
                System.IO.FileStream fs =
                    (System.IO.FileStream)dialog.OpenFile();
                gateManager.SaveGateSetAsXml(fs);
                fs.Close();
            }
            log("Saved gate config to " + dialog.FileName.ToString());
        }