예제 #1
1
        /// <summary>
        /// Create and initialize MoveScene UI.
        /// </summary>
        /// <param name="series"></param>
        /// <param name="scene"></param>
        public frmMoveItem(Series series, INotable item)
        {
            InitializeComponent();

            this.series = series;
            this.item = item;

            PopulateBookList();

            if (item is Scene)
            {
                PopulateChapterList(((Scene)item).ParentChapter.ParentBook);
            }
            else
            {
                lstChapters.Enabled = false;
            }
        }
예제 #2
0
        public override async Task Execute()
        {
            var notesQuery   = Session.Query <Notes, NoteIndex>().Where(u => u.RefId == Id).Take(1).LazilyAsync();
            var notableQuery = Session.Query <INotable, NotableIndex>().Where(c => c.Id == Id).Take(1).LazilyAsync();

            var notesResult   = await notesQuery.Value;
            var notableResult = await notableQuery.Value;

            Result        = notesResult.FirstOrDefault();
            ResultNotable = notableResult.FirstOrDefault();
        }
예제 #3
0
        /// <summary>
        /// Load another series.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void mopLoadSeries_Click(object sender, EventArgs e)
        {
            if (!CanChangeSeries() || AskSaveSeries() == DialogResult.Cancel)
                return;

            Directory.SetCurrentDirectory(exec_dir);
            Utils.CreateSetDirectory("Projects");

            DirectoryInfo thisDir = new DirectoryInfo(Directory.GetCurrentDirectory());
            DirectoryInfo[] projectList = thisDir.GetDirectories();

            DialogResult dr = new frmOpenProject(projectList).ShowDialog();

            if (dr == DialogResult.OK)
            {
                // Find the .sws file.
                Directory.SetCurrentDirectory(frmOpenProject.Result);
                DirectoryInfo di = new DirectoryInfo(Directory.GetCurrentDirectory());
                FileInfo[] fi = di.GetFiles("*" + Constant.PROJ_EXT);
                if (fi.Length > 1)
                {
                    MessageBox.Show("More than one project file found in this directory.");
                    Directory.SetCurrentDirectory((projectDir == "" ? exec_dir : projectDir));
                    return;
                }
                else if (fi.Length < 1)
                {
                    MessageBox.Show("No valid project file found.");
                    Directory.SetCurrentDirectory((projectDir == "" ? exec_dir : projectDir));
                    return;
                }

                // Load series
                projectName = fi[0].Name;

                series = new Series();
                series.LoadFromFile(projectName);

                // Set data references
                workob = series;
                selnode = treeSeries.TopNode;

                // Initialize UI
                Text = "SigmaWriter - " + series.Title;
                RepopulateTree();
                UpdateSeriesUI();
                EnableControls(true);

                treeSeries.SelectedNode = treeSeries.TopNode;

                if (Config.BackupEnabled)
                    timerBackup.Start();

                return;
            }

            Directory.SetCurrentDirectory((projectDir == "" ? exec_dir : projectDir));
        }
예제 #4
0
        private void copDeleteScene_Click(object sender, EventArgs e)
        {
            string dialog_message = "Delete scene " + ((Scene)rightob).Title + "?\n\n" +
                "This is permanent!\n" +
                "Back up  file \"" + ((Scene)rightob).Filename + "\" before deletion.";
            if (MessageBox.Show(dialog_message,
                "Delete Scene", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                // Select parent node before deletion.
                treeSeries.SelectedNode = rightnode.Parent;
                selnode = treeSeries.SelectedNode;
                workob = (INotable)selnode.Tag;
                UpdateUI(workob);

                series.DeleteScene((Scene)rightob, (Chapter)rightnode.Parent.Tag);
                treeSeries.Nodes.Remove(rightnode);
            }
            else
                treeSeries.SelectedNode = selnode;
        }
예제 #5
0
        private void copDeleteChapter_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("WARNING\nDeleting this chapter will erase all scene data within the chapter.\n" +
                "Once you save the project in the File menu, this data will be permanently lost.\n" +
                "Do you wish to proceed?",
                "Delete Chapter", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                // Select parent node before deletion.
                treeSeries.SelectedNode = rightnode.Parent;
                selnode = treeSeries.SelectedNode;
                workob = (INotable)selnode.Tag;
                UpdateUI(workob);

                series.DeleteChapter((Chapter)rightob, (Book)rightnode.Parent.Tag);
                treeSeries.Nodes.Remove(rightnode);
            }
            else
                treeSeries.SelectedNode = selnode;
        }
예제 #6
0
        private void copDeleteBook_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("WARNING\nDeleting this book will erase all chapter AND scene data within the book.\n" +
                "Once you save the project in the File menu, this data will be permanently lost.\n" +
                "Do you wish to proceed?",
                "Delete Book", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                // Select parent node before deletion.
                treeSeries.SelectedNode = rightnode.Parent;
                selnode = treeSeries.SelectedNode;
                workob = (INotable)selnode.Tag;
                UpdateUI(workob);

                series.DeleteBook((Book)rightob);
                treeSeries.Nodes.Remove(rightnode);

                UpdateBookFilterList();
                PopulateCharacterList(bookAppearanceFilter, importFilter);
            }
            else
                treeSeries.SelectedNode = selnode;
        }
예제 #7
0
 private void UpdateUI(INotable ob)
 {
     if (ob is Series)
         UpdateSeriesUI();
     else if (ob is Book)
         UpdateBookUI();
     else if (ob is Chapter)
         UpdateChapterUI();
     else if (ob is Scene)
         UpdateSceneUI();
 }
예제 #8
0
        /// <summary>
        /// When a user left-clicks on a tree node, bring that node into focus
        /// with the editing UI.  When a user right-clicks on a node,
        /// bring up a context menu to 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void treeSeries_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                // To account for fact that click event is one click behind
                // selnode = treeSeries.SelectedNode;
                selnode = e.Node;
                treeSeries.SelectedNode = selnode;
                workob = (INotable)selnode.Tag;

                UpdateUI(workob);
            }

            else if (e.Button == MouseButtons.Right)
            {
                rightnode = e.Node;
                rightob = (INotable)rightnode.Tag;
                // This line is commented out b/c:
                // Right-clicking shouldn't move focus of control to that node
                //
                // ...control is temporarily moved to node, moved back
                // after context menu methods
                treeSeries.SelectedNode = rightnode;

                // Choose type of node
                if (rightob is Series)
                {
                    cmenSeries.Show(MousePosition);
                }
                else if (rightob is Book)
                {
                    cmenBook.Show(MousePosition);
                }
                else if (rightob is Chapter)
                {
                    cmenChapter.Show(MousePosition);
                }
                else if (rightob is Scene)
                {
                    cmenScene.Show(MousePosition);
                }
            }
        }
예제 #9
0
 public NoteInstruction(INotable target, bool noteOn)
 {
     this.target = target;
     this.noteOn = noteOn;
 }