public ConfigViewModel(AgentConfig agentConfig)
 {
     m_AgentConfig = agentConfig;
     m_Nodes = new ObservableCollection<NodeConfig>(agentConfig.Nodes);
     m_Nodes.Add(new NewNodeConfig());
     SelectedNode = m_Nodes.First();
 }
        public MainViewModel(AgentConfig config)
        {
            AgentConfig = config;
            var nodes = config.Nodes;

            if (nodes != null)
                Nodes = new ObservableCollection<NodeMasterViewModel>(nodes.Select(n => new NodeMasterViewModel(n)));
            else
                Nodes = new ObservableCollection<NodeMasterViewModel>();
        }
        public static AgentConfig Load()
        {
            if (!File.Exists(SAVE_PATH))
            {
                var config = new AgentConfig();
                config.Nodes = new List<NodeConfig>();
                config.Save();
                return config;
            }

            return File.ReadAllText(SAVE_PATH, Encoding.UTF8).XmlDeserialize<AgentConfig>();
        }
        public static AgentConfig Load()
        {
            if (!File.Exists(SAVE_PATH))
            {
                var config = new AgentConfig();
                config.Nodes = new List <NodeConfig>();
                config.Save();
                return(config);
            }

            return(File.ReadAllText(SAVE_PATH, Encoding.UTF8).XmlDeserialize <AgentConfig>());
        }