protected virtual void OnEditActionActivated(object sender, System.EventArgs e) { ResponseType result; TreeIter iter; treeviewref.Selection.GetSelected(out iter); SelectedID = Convert.ToInt32(filter.GetValue(iter, 0)); string NameOfNode = filter.GetValue(iter, 1).ToString(); string DiscriptionOfNode; if (DescriptionField) { DiscriptionOfNode = filter.GetValue(iter, 2).ToString(); } else { DiscriptionOfNode = ""; } if (SimpleMode) { NewNode = false; editNode = new Dialog("Редактирование " + nameNode, this, Gtk.DialogFlags.DestroyWithParent); BuildSimpleEditorDialog(); inputNameEntry.Text = NameOfNode; inputDiscriptionEntry.Text = DiscriptionOfNode; editNode.ShowAll(); result = (ResponseType)editNode.Run(); inputNameEntry.Destroy(); editNode.Destroy(); } else { //Вызываем событие в основном приложении для запуска диалога элемента справочника result = OnRunReferenceItemDlg(TableRef, false, SelectedID, ParentId); } if (result == ResponseType.Ok) { UpdateList(); RefChanged = true; } }
private void OnTomboyTrayMenuShown (object sender, EventArgs args) { // Add in the top tasks // TODO: Read the number of todo items to show from Preferences int max_size = 5; int list_size = 0; Gtk.MenuItem item; // Filter the tasks to the ones that are incomplete Gtk.TreeModelFilter store_filter = new Gtk.TreeModelFilter (TasksApplicationAddin.DefaultTaskManager.Tasks, null); store_filter.VisibleFunc = FilterTasks; // TODO: Sort the tasks to order by due date and priority // store_sort = new Gtk.TreeModelSort (store_filter); // store_sort.DefaultSortFunc = // new Gtk.TreeIterCompareFunc (TaskSortFunc); // tree.Model = store_sort; // int cnt = tree.Model.IterNChildren (); // task_count.Text = string.Format ( // Catalog.GetPluralString("Total: {0} task", // "Total: {0} tasks", // cnt), // cnt); // List the top "max_size" tasks Gtk.TreeIter iter; Gtk.SeparatorMenuItem separator; // Determine whether the icon is near the top/bottom of the screen int position; if (!Tomboy.Tray.MenuOpensUpward ()) position = 2; else position = tomboy_tray_menu.Children.Length - 7; separator = new Gtk.SeparatorMenuItem (); tomboy_tray_menu.Insert (separator, position++); separator.Show (); top_tasks.Add (separator); item = new Gtk.MenuItem (Catalog.GetString ("To Do List")); tomboy_tray_menu.Insert (item, position++); item.ShowAll (); top_tasks.Add (item); item.Activated += OnOpenTodoList; if (store_filter.GetIterFirst (out iter)) { do { Task task = store_filter.GetValue (iter, 0) as Task; item = new TomboyTaskMenuItem (task); tomboy_tray_menu.Insert (item, list_size + position); item.ShowAll (); top_tasks.Add (item); list_size++; } while (store_filter.IterNext (ref iter) && list_size < max_size); } }
private void OnTomboyTrayMenuShown(object sender, EventArgs args) { // Add in the top tasks // TODO: Read the number of todo items to show from Preferences int max_size = 5; int list_size = 0; Gtk.MenuItem item; // Filter the tasks to the ones that are incomplete Gtk.TreeModelFilter store_filter = new Gtk.TreeModelFilter(TasksApplicationAddin.DefaultTaskManager.Tasks, null); store_filter.VisibleFunc = FilterTasks; // TODO: Sort the tasks to order by due date and priority // store_sort = new Gtk.TreeModelSort (store_filter); // store_sort.DefaultSortFunc = // new Gtk.TreeIterCompareFunc (TaskSortFunc); // tree.Model = store_sort; // int cnt = tree.Model.IterNChildren (); // task_count.Text = string.Format ( // Catalog.GetPluralString("Total: {0} task", // "Total: {0} tasks", // cnt), // cnt); // List the top "max_size" tasks Gtk.TreeIter iter; Gtk.SeparatorMenuItem separator; // Determine whether the icon is near the top/bottom of the screen int position; //if (!Tomboy.Tray.MenuOpensUpward ()) position = 0; //else // position = tomboy_tray_menu.Children.Length - 7; separator = new Gtk.SeparatorMenuItem(); tomboy_tray_menu.Insert(separator, position++); separator.Show(); top_tasks.Add(separator); item = new Gtk.MenuItem(Catalog.GetString("To Do List")); tomboy_tray_menu.Insert(item, position++); item.ShowAll(); top_tasks.Add(item); item.Activated += OnOpenTodoList; if (store_filter.GetIterFirst(out iter)) { do { Task task = store_filter.GetValue(iter, 0) as Task; item = new TomboyTaskMenuItem(task); tomboy_tray_menu.Insert(item, list_size + position); item.ShowAll(); top_tasks.Add(item); list_size++; } while (store_filter.IterNext(ref iter) && list_size < max_size); } }