예제 #1
0
        public void CreateScene()
        {
            NameItemDialog dialog = new NameItemDialog(DialogOwner, "New Scene");
            bool?          result = dialog.ShowDialog();

            if (result.HasValue && result.Value)
            {
                FlowDocument doc = new FlowDocument(Model.Connection);
                doc.UniverseId = StoryVm.Model.UniverseId;
                doc.WordCount  = 0;
                doc.PlainText  = "";
                doc.Xml        = FlowDocumentViewModel.GetEmptyFlowDocXml();
                doc.Create();

                Scene scene = new Scene(Model.Connection);
                scene.ChapterId = Model.id;
                scene.Name      = dialog.UserInput;
                if (Scenes.Count == 0)
                {
                    scene.SortIndex = 0;
                }
                else
                {
                    scene.SortIndex = Scenes.Max(i => i.Model.SortIndex) + 1;
                }
                scene.FlowDocumentId = doc.id;
                scene.Create();
                SceneViewModel sceneVm = new SceneViewModel(scene);
                sceneVm.ChapterVm = this;
                Scenes.Add(sceneVm);
            }
        }
예제 #2
0
        public void EditCopyrightPage()
        {
            if (!Model.FlowDocumentId.HasValue)
            {
                FlowDocument doc = new FlowDocument(Model.Connection);
                doc.UniverseId  = Model.UniverseId;
                doc.IsEncrypted = false;
                doc.WordCount   = 0;
                doc.PlainText   = "";
                doc.Xml         = FlowDocumentViewModel.GetEmptyFlowDocXml();
                doc.Create();

                Model.FlowDocumentId = doc.id;
                Model.Save();
            }
            if (Model.FlowDocumentId.HasValue)
            {
                FlowDocumentEditorWindow.ShowEditorWindow(Model.FlowDocumentId.Value, Model.Connection, UniverseVm.SpellcheckDictionary, string.Format("Copyright Page: {0}", Model.Name));
            }
        }