예제 #1
0
        private void ReceiveFileCommand(FileCommandMessage fileCommand)
        {
            switch (fileCommand.Command)
            {
            case "NEW":
                _content = new Project();
                ApplicationCommands.SaveJsonObject(fileCommand.Path, _content);
                TreeData = ConvertFromProjectToGroups();
                break;

            case "OPEN":
                _content = (Project)ApplicationCommands.ReadJsonObject(fileCommand.Path, typeof(Project));
                if (_content != null)
                {
                    TreeData = ConvertFromProjectToGroups();
                }
                break;

            case "SAVE":
                ApplicationCommands.SaveJsonObject(fileCommand.Path, _content);
                break;

            default:
                throw new Exception($"Unknnown File Menu command {fileCommand.Command}");
            }
        }