Adroit.Gui.PlanningView.OnRemoveAttachmentButtonClicked C# (CSharp) Метод

OnRemoveAttachmentButtonClicked() защищенный Метод

protected OnRemoveAttachmentButtonClicked ( object sender, System e ) : void
sender object
e System
Результат void
        protected virtual void OnRemoveAttachmentButtonClicked(object sender, System.EventArgs e)
        {
            var paths = m_tasksIconView.SelectedItems;
            var model = m_tasksIconView.Model as ListStore;

            TreeIter iter;
            Array.Reverse (paths);

            foreach (TreePath path in paths) {
                if (model.GetIter (out iter, path)) {
                    model.Remove (ref iter);
                }
            }

            List<string> filenames = new List<string> ();

            if (model.GetIterFirst (out iter)) {
                do {
                    filenames.Add ((string)model.GetValue (iter, 2));
                } while (model.IterNext (ref iter));
            }

            var command = new EditTaskCommand () {
                Property = "Attachments",
                Value = filenames.ToArray (),
                Task = SelectedTask,
                Storage = m_storage
            };

            command.Done += delegate { this.UpdateAttachments (); };
            command.Undone += delegate { this.UpdateAttachments (); };

            var commands = ServiceManager.Get<CommandService> ().Commands;
            commands.Do (command);
        }