Пример #1
0
        public static string SaveStorySuiteProject(StorySuiteProject ssProj, string filePath = null)
        {
            var file = filePath;
            if (!File.Exists(filePath))
            {
                var dialog = new SaveFileDialog {DefaultExt = "ssproj", Filter = "StorySuite Project|*.ssproj"};

                if (dialog.ShowDialog() != DialogResult.OK)
                    return null;

                file = dialog.FileName;
            }

            if (file != null)
            {
                using (var writer = new StreamWriter(file))
                {
                    var serializer = new XmlSerializer(typeof (StorySuiteProject));
                    serializer.Serialize(writer, ssProj);
                    writer.Flush();
                }
            }

            ssProj.FileName = File.Exists(file) ? file : ssProj.FileName;
            return ssProj.FileName;
        }
Пример #2
0
        public static bool AskToSave(StorySuiteProject ssProj, string fileName)
        {
            var returnValue = MessageBox.Show("Would you like to save the current project?", "Save?",
                                              MessageBoxButtons.YesNoCancel);

            switch (returnValue)
            {
                case DialogResult.Cancel:
                    return false;
                case DialogResult.No:
                    return true;
                default:
                    return !string.IsNullOrWhiteSpace(SaveLoad.SaveStorySuiteProject(ssProj, fileName));
            }
        }
 public void NewStory()
 {
     SSProj = new StorySuiteProject();
     RefreshProperties();
 }
 public MapEditorViewModel(StorySuiteProject ssproj)
 {
     _ssproj = ssproj;
 }
 public CharacterListViewModel(StorySuiteProject ssproj, IWindowManager windowManager)
 {
     _ssproj = ssproj;
     _windowManager = windowManager;
 }
Пример #6
0
 public FactionViewModel(StorySuiteProject ssproj, IWindowManager manager)
 {
     _ssproj = ssproj;
     _manager = manager;
     Factions = new ObservableCollection<string>(ssproj.Factions);
 }
 public NewFactionCharacterSelectorViewModel(StorySuiteProject ssproj)
 {
     _ssproj = ssproj;
     Characters = new ObservableCollection<Character>(ssproj.Characters);
 }
        public MainWindowViewModel(IWindowManager windowManager)
        {
            //NewStory();

            var args = Environment.GetCommandLineArgs();

            if (args.Any())
            {
                foreach (var ssproj in args.Where(File.Exists).Select(SaveLoad.LoadStorySuiteProject).Where(ssproj => ssproj != null))
                {
                    SSProj = ssproj;

                    if (SSProj.Chapters.Count > 0)
                        CurrentChapterAndNumber = ChapterList[0];

                    break;
                }
            }

            if(SSProj ==null)
                SSProj = new StorySuiteProject();

            NotifyOfPropertyChange("");

            _windowManager = windowManager;
        }
 public void NewStory()
 {
     CurrentChapterAndNumber = null;
     SSProj = new StorySuiteProject();
     NotifyOfPropertyChange("");
 }