/// <summary>
        /// 删除所有的书签
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deleteAllToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (Utility.Warn2("Delete all bookmarks?") != DialogResult.Yes)
            {
                return;
            }

            //删除当前页的书签
            ProjectItem item = ProjectManager.GetProjectItemByFile(NPP.GetCurrentFile());

            foreach (var bk in item.Bookmarks)
            {
                NPP.DeleteBookmark(bk.LineNo);
            }

            int index = (int)tddiProjects.Tag;

            if (index == -1 || index == 0)
            {
                foreach (var proj in ProjectManager.Projects)
                {
                    _DeleteBookmarks(proj.Root);
                }
            }
            else
            {
                _DeleteBookmarks(ProjectManager.Projects[index - 1].Root);
            }
            lviewBookmarkList.Items.Clear();
        }
Exemple #2
0
        public ActionResult Index(int nppId)
        {
            NPP npp = ctx.NPPs.Where(x => x.Id == nppId)
                      .Include(x => x.Odsjek.Fakultet)
                      .Include(x => x.AkademskaGodina)
                      .Single();


            List <PredmetIndexVM.PredmetInfo> predmeti = (ctx.Predmets
                                                          .Where(x => x.NppId == nppId)
                                                          .Select(x => new PredmetIndexVM.PredmetInfo
            {
                Id = x.Id,
                Naziv = x.Naziv,
                Ects = x.Ects,
                GodinaStudija = x.GodinaStudija,
                NppId = x.NppId
            }))
                                                         .ToList();

            PredmetIndexVM model = new PredmetIndexVM
            {
                TabelaPodaci  = predmeti,
                FakultetNaziv = npp.Odsjek.Fakultet.Naziv,
                OdsjekNaziv   = npp.Odsjek.Naziv,
                NppNaziv      = npp.AkademskaGodina.Opis + ": " + npp.Naziv,
                NppId         = nppId,
            };

            return(View(model));
        }
        /// <summary>
        /// 删除选中的书签
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tbtnDelete_Click(object sender, EventArgs e)
        {
            List <Bookmark> lst   = new List <Bookmark>();
            var             items = lviewBookmarkList.Items;

            for (int i = items.Count - 1; i >= 0; --i)
            {
                if (items[i].Checked)
                {
                    lst.Add(items[i].Tag as Bookmark);
                    items.RemoveAt(i);
                }
            }

            string curFile = NPP.GetCurrentFile();

            foreach (var bk in lst)
            {
                if (bk.File == curFile)
                {
                    NPP.DeleteBookmark(bk.LineNo);
                }
                var i = ProjectManager.GetProjectItemByFile(bk.File);
                if (i != null)
                {
                    i.Bookmarks.Remove(bk);
                }
            }
        }
Exemple #4
0
 private void lviewFileList_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     if (lviewFileList.SelectedItems.Count > 0)
     {
         NPP.OpenFile(lviewFileList.SelectedItems[0].SubItems[2].Text);
         Hide();
     }
 }
        public ActionResult Obrisi(int id)
        {
            NPP npp = ctx.NPPs.Find(id);

            ctx.NPPs.Remove(npp);
            ctx.SaveChanges();

            return(RedirectToAction("Index", new { odsjekId = npp.OdsjekId }));
        }
Exemple #6
0
 void _OpenSelectedFile()
 {
     foreach (ListViewItem item in lviewFileList.Items)
     {
         if (item.BackColor == Color.DarkSlateBlue && item.ForeColor == Color.White)
         {
             NPP.OpenFile(item.SubItems[2].Text);
             Hide();
         }
     }
 }
        ///// <summary>
        ///// 不再使用
        ///// </summary>
        ///// <param name="sender"></param>
        ///// <param name="e"></param>
        //private void tcboxProjects_SelectedIndexChanged(object sender, EventArgs e)
        //{
        //    int sindex = tcboxProjects.SelectedIndex;
        //    if (sindex == -1 || sindex == 0)
        //    {
        //        BindBookmarks();
        //    }
        //    else
        //    {
        //        Project proj = ProjectManager.Projects[tcboxProjects.SelectedIndex - 1];
        //        lviewBookmarkList.Items.Clear();
        //        _BindBookmarks(proj);
        //    }
        //}

        private void lviewBookmarkList_DoubleClick(object sender, EventArgs e)
        {
            var items = lviewBookmarkList.SelectedItems;

            if (items.Count > 0)
            {
                items[0].Checked = !items[0].Checked;   // 双击不改变原checkbox状态
                var book = items[0].Tag as Bookmark;
                if (book != null)
                {
                    NPP.GoToLine(book.File, book.LineNo);
                }
            }
        }
        private void lviewTaskList_DoubleClick(object sender, EventArgs e)
        {
            var items = lviewTaskList.SelectedItems;

            if (items.Count > 0)
            {
                var task = items[0].Tag as Task;
                Utility.Debug("{0} == {1}, {2} == {3}", task.LineNo, NPP.GetCurrentLine(), task.File, NPP.GetCurrentFile());
                if (task != null && (task.LineNo != NPP.GetCurrentLine() || task.File != NPP.GetCurrentFile()))
                {
                    Jump.Add(task.Type.Name, task.File, task.LineNo);
                    Jump.Cursor.Go();
                }
            }
        }
 private void lviewTaskList_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         var items = lviewTaskList.SelectedItems;
         if (items.Count > 0)
         {
             var task = items[0].Tag as Task;
             if (task != null && (task.LineNo != NPP.GetCurrentLine() || task.File != NPP.GetCurrentFile()))
             {
                 Jump.Add(task.Type.Name, task.File, task.LineNo);
                 Jump.Cursor.Go();
             }
         }
     }
 }
        public ActionResult Uredi(int nppId)
        {
            NPP    npp    = ctx.NPPs.Where(x => x.Id == nppId).Include(x => x.Odsjek.Fakultet).Single();
            Odsjek odsjek = npp.Odsjek;

            NppUrediVM model = new NppUrediVM
            {
                Id                    = npp.Id,
                Naziv                 = npp.Naziv,
                AkademskaGodinaId     = npp.AkademskaGodinaId,
                AkademskaGodinaStavke = AkademskaGodinaStavke(),
                FakultetId            = npp.FakultetId,
                OdsjekId              = odsjek.Id,
            };

            return(View(model));
        }
Exemple #11
0
 void _ProcessKeyDown(Keys key)
 {
     if ((key == Keys.Enter || key == Keys.Return))
     {
         int index = _GetSelectedItemIndex();
         if (index != -1)
         {
             NPP.OpenFile(lviewFileList.Items[index].SubItems[2].Text);
             Hide();
         }
     }
     else if (key == Keys.Down)
     {
         int index = 0;
         foreach (ListViewItem item in lviewFileList.Items)
         {
             if (item.BackColor == Color.DarkSlateBlue && item.ForeColor == Color.White)
             {
                 index = item.Index + 1;
                 break;
             }
         }
         if (index < lviewFileList.Items.Count)
         {
             _SetSelectedItemColor(index);
             //lviewFileList.Items[index].Selected = true;
         }
     }
     else if (key == Keys.Up)
     {
         int index = lviewFileList.Items.Count - 1;
         foreach (ListViewItem item in lviewFileList.Items)
         {
             if (item.BackColor == Color.DarkSlateBlue && item.ForeColor == Color.White)
             {
                 index = item.Index - 1;
                 break;
             }
         }
         if (index >= 0)
         {
             _SetSelectedItemColor(index);
             //lviewFileList.Items[index].Selected = true;
         }
     }
 }
        public ActionResult Dodaj(int nppId)
        {
            NPP npp = ctx.NPPs.Where(x => x.Id == nppId)
                      .Include(x => x.Smjer.Fakultet)
                      .Include(x => x.AkademskaGodina)
                      .Single();

            PredmetUrediVM model = new PredmetUrediVM
            {
                FakultetNaziv       = npp.Smjer.Fakultet.Naziv,
                SmjerNaziv          = npp.Smjer.Naziv,
                NppNaziv            = npp.AkademskaGodina.Opis + ": " + npp.Naziv,
                NppId               = npp.Id,
                GodinaStudijaStavke = GodinaStudijaStavke()
            };

            return(View("Uredi", model));
        }
 /// <summary>
 /// 删除当前选中书签
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (lviewBookmarkList.SelectedItems.Count > 0)
     {
         var item = lviewBookmarkList.SelectedItems[0];
         var bk   = item.Tag as Bookmark;
         if (bk.File == NPP.GetCurrentFile())
         {
             NPP.DeleteBookmark(bk.LineNo);
         }
         var i = ProjectManager.GetProjectItemByFile(bk.File);
         if (i != null)
         {
             i.Bookmarks.Remove(bk);
         }
         lviewBookmarkList.Items.RemoveAt(item.Index);
     }
 }
Exemple #14
0
        /// <summary>
        /// Update tree for current active document
        /// </summary>
        /// <param name="root"></param>
        /// <param name="tags"></param>
        void _InsertTags(TreeNode root, List <ITag> tags)
        {
            string  _Scope = NPP.GetCurrentFile();
            Project proj   = ProjectManager.GetProjectByItsFile(_Scope);

            if (proj == null)
            {
                return;
            }
            ModelDocument _Model = proj.Model;

            _Scope = _Model.GetRelativePath(_Scope);
            TreeNode parent = new TreeNode(_Scope);

            _InsertTagsSub(parent, _Scope, _Model);
            tvClassView.Nodes.Clear();
            tvClassView.Nodes.Add(parent);
            tvClassView.ExpandAll();
        }
Exemple #15
0
        public ActionResult Uredi(int nppId)
        {
            NPP   npp   = ctx.NPPs.Where(x => x.Id == nppId).Include(x => x.Smjer.Fakultet).Single();
            Smjer smjer = npp.Smjer;

            NppUrediVM model = new NppUrediVM
            {
                Id                    = npp.Id,
                Naziv                 = npp.Naziv,
                AkademskaGodinaId     = npp.AkademskaGodinaId,
                AkademskaGodinaStavke = AkademskaGodinaStavke(),

                FakultetNaziv = smjer.Fakultet.Naziv,
                SmjerNaziv    = smjer.Naziv,
                SmjerId       = smjer.Id,
            };

            return(View(model));
        }
Exemple #16
0
        public ActionResult Snimi(NppUrediVM input)
        {
            NPP entity;

            if (input.Id == 0)
            {
                entity = new NPP();
                ctx.NPPs.Add(entity);
            }
            else
            {
                entity = ctx.NPPs.Find(input.Id);
            }
            entity.Naziv             = input.Naziv;
            entity.SmjerId           = input.SmjerId;
            entity.AkademskaGodinaId = input.AkademskaGodinaId;

            ctx.SaveChanges();

            return(RedirectToAction("Index", new { smjerId = input.SmjerId }));
        }
Exemple #17
0
 private async Task Change3DScene(NPP newScene)
 {
     SceneLoadedTokenSource = new CancellationTokenSource();
     await Window3DVMContext.Current.LoadSceneAsync(newScene, SceneLoadedTokenSource, ProgressDialogService);
 }
Exemple #18
0
 private async Task Change3DScene(NPP newScene)
 {
     SceneLoadedTokenSource = new CancellationTokenSource();
     await Window3DVMContext.Current.LoadSceneAsync(newScene, SceneLoadedTokenSource, ProgressDialogService);
 }