Ejemplo n.º 1
0
        private void butAddNote_Click(object sender, System.EventArgs e)
        {
            if (listCat.SelectedIndex == -1)
            {
                MessageBox.Show(Lan.g(this, "Please select a category first."));
                return;
            }
            QuickPasteNote quickNote = new QuickPasteNote();

            quickNote.QuickPasteCatNum = _listCats[listCat.SelectedIndex].QuickPasteCatNum;
            FormQuickPasteNoteEdit FormQ = new FormQuickPasteNoteEdit(quickNote);

            FormQ.ShowDialog();
            if (FormQ.DialogResult != DialogResult.OK || FormQ.QuickNote == null)         //Deleted
            {
                return;
            }
            if (gridMain.GetSelectedIndex() == -1)
            {
                _listNotes.Add(FormQ.QuickNote);
            }
            else
            {
                int selectedIdx = _listNotes.IndexOf((QuickPasteNote)gridMain.ListGridRows[gridMain.GetSelectedIndex()].Tag);
                _listNotes.Insert(selectedIdx, FormQ.QuickNote);               //Insert the new note at the selected index.
            }
            FillMain();
        }
Ejemplo n.º 2
0
        private void butEditNote_Click(object sender, System.EventArgs e)
        {
            if (gridMain.GetSelectedIndex() == -1)
            {
                MessageBox.Show(Lan.g(this, "Please select a note first."));
                return;
            }
            QuickPasteNote         quickNote = (QuickPasteNote)gridMain.Rows[gridMain.GetSelectedIndex()].Tag;
            FormQuickPasteNoteEdit FormQ     = new FormQuickPasteNoteEdit((QuickPasteNote)gridMain.Rows[gridMain.GetSelectedIndex()].Tag);

            FormQ.ShowDialog();
            if (FormQ.DialogResult != DialogResult.OK)
            {
                return;
            }
            if (FormQ.QuickNote == null)           //deleted
            {
                _listNotes.Remove(quickNote);
            }
            else
            {
                _listNotes[_listNotes.IndexOf(quickNote)] = FormQ.QuickNote;
            }
            FillMain();
        }
Ejemplo n.º 3
0
        private void ShowEditWindow(QuickPasteNote quickNote)
        {
            FormQuickPasteNoteEdit FormQ = new FormQuickPasteNoteEdit((QuickPasteNote)gridMain.ListGridRows[gridMain.GetSelectedIndex()].Tag);

            FormQ.ShowDialog();
            if (FormQ.DialogResult != DialogResult.OK)
            {
                return;
            }
            if (FormQ.QuickNote == null)           //deleted
            {
                _listNotes.Remove(quickNote);
            }
            else
            {
                _listNotes[_listNotes.IndexOf(quickNote)] = FormQ.QuickNote;
            }
            FillMain();
        }
Ejemplo n.º 4
0
        private void butEditNote_Click(object sender, System.EventArgs e)
        {
            if (listNote.SelectedIndex == -1)
            {
                MessageBox.Show(Lan.g(this, "Please select a note first."));
                return;
            }
            FormQuickPasteNoteEdit FormQ = new FormQuickPasteNoteEdit(notesForCat[listNote.SelectedIndex]);

            FormQ.ShowDialog();
            if (notesForCat[listNote.SelectedIndex].QuickPasteNoteNum == 0)          //deleted
            {
                for (int i = listNote.SelectedIndex; i < notesForCat.Length; i++)
                {
                    notesForCat[i].ItemOrder--;
                    QuickPasteNotes.Update(notesForCat[i]);
                }
            }
            QuickPasteNotes.Refresh();
            FillNotes();
            localChanged = true;          //?
        }
Ejemplo n.º 5
0
        private void butAddNote_Click(object sender, System.EventArgs e)
        {
            if (listCat.SelectedIndex == -1)
            {
                MessageBox.Show(Lan.g(this, "Please select a category first."));
                return;
            }
            QuickPasteNote quickNote = new QuickPasteNote();

            quickNote.QuickPasteCatNum = QuickPasteCats.List[listCat.SelectedIndex].QuickPasteCatNum;
            if (listNote.SelectedIndex == -1)
            {
                quickNote.ItemOrder = notesForCat.Length;              //one more than list will hold.
            }
            else
            {
                quickNote.ItemOrder = listNote.SelectedIndex;
            }
            FormQuickPasteNoteEdit FormQ = new FormQuickPasteNoteEdit(quickNote);

            FormQ.IsNew = true;
            FormQ.ShowDialog();
            if (FormQ.DialogResult == DialogResult.OK)
            {
                if (listNote.SelectedIndex != -1)
                {
                    //move other items down in list to make room for new one.
                    for (int i = quickNote.ItemOrder; i < notesForCat.Length; i++)
                    {
                        notesForCat[i].ItemOrder++;
                        QuickPasteNotes.Update(notesForCat[i]);
                    }
                }
                localChanged = true;
            }
            QuickPasteNotes.Refresh();
            FillNotes();
        }
Ejemplo n.º 6
0
		private void butEditNote_Click(object sender,System.EventArgs e) {
			if(listNote.SelectedIndex==-1){
				MessageBox.Show(Lan.g(this,"Please select a note first."));
				return;
			}
			FormQuickPasteNoteEdit FormQ=new FormQuickPasteNoteEdit(notesForCat[listNote.SelectedIndex]);
			FormQ.ShowDialog();
			if(notesForCat[listNote.SelectedIndex].QuickPasteNoteNum==0){//deleted
				for(int i=listNote.SelectedIndex;i<notesForCat.Length;i++){
					notesForCat[i].ItemOrder--;
					QuickPasteNotes.Update(notesForCat[i]);
				}
			}
			QuickPasteNotes.RefreshCache();
			FillNotes();
			localChanged=true;//?
		}
Ejemplo n.º 7
0
		private void butAddNote_Click(object sender,System.EventArgs e) {
			if(listCat.SelectedIndex==-1){
				MessageBox.Show(Lan.g(this,"Please select a category first."));
				return;
			}
			QuickPasteNote quickNote=new QuickPasteNote();
			quickNote.QuickPasteCatNum=QuickPasteCats.List[listCat.SelectedIndex].QuickPasteCatNum;
			if(listNote.SelectedIndex==-1){
				quickNote.ItemOrder=notesForCat.Length;//one more than list will hold.
			}
			else{
				quickNote.ItemOrder=listNote.SelectedIndex;
			}
			FormQuickPasteNoteEdit FormQ=new FormQuickPasteNoteEdit(quickNote);
			FormQ.IsNew=true;
			FormQ.ShowDialog();
			if(FormQ.DialogResult==DialogResult.OK){
				if(listNote.SelectedIndex!=-1){
					//move other items down in list to make room for new one.
					for(int i=quickNote.ItemOrder;i<notesForCat.Length;i++){
						notesForCat[i].ItemOrder++;
						QuickPasteNotes.Update(notesForCat[i]);
					}
				}
				localChanged=true;
			}
			QuickPasteNotes.RefreshCache();
			FillNotes();
		}