protected void OnRemoveFile(object sender, EventArgs e) { if (selectedFile != null) { String consoleOut; exportSettingsController.RemoveFile(selectedFile.FilePath, out consoleOut); selectedFile = null; WriteLine(consoleOut); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_createshp_Click(object sender, EventArgs e) { string sPath = this.txt_ShpPath.Text; if (sPath.Equals("")) { MessageBox.Show("请选择输出路径!"); return; } VectorFile.WriteVectorFile(sPath); }
protected void RowSelected(object sender, EventArgs e) { TreeSelection selection = (sender as NodeView).Selection; NodeStore ns = (sender as NodeView).NodeStore; VectorFile vf = ((VectorFile)ns.GetNode(selection.GetSelectedRows() [0])); selectedFile = vf; Console.WriteLine("SELECTED"); /* * MergedCheck.Toggled -= MergeActivateAction; * MergedCheck.Active = vf.ExportMerged; * MergeActivateAction = ((object innerSender, EventArgs e2) => * { * vf.ExportMerged = (innerSender as CheckButton).Active; * }); * MergedCheck.Toggled+= MergeActivateAction; * * ColorArtCheck.Toggled -= ColorArtActivateAction; * ColorArtCheck.Active = vf.ExportColorArt; * ColorArtActivateAction = ((object innerSender, EventArgs e2) => * { * vf.ExportColorArt = (innerSender as CheckButton).Active; * }); * ColorArtCheck.Toggled+= ColorArtActivateAction; * * LineArtCheck.Toggled -= LineArtActivateAction; * LineArtCheck.Active = vf.ExportLineArt; * LineArtActivateAction = ((object innerSender, EventArgs e2) => * { * vf.ExportLineArt = (innerSender as CheckButton).Active; * }); * LineArtCheck.Toggled+= LineArtActivateAction; * * * * OptionsEntry.Buffer.Text = vf.Options; */ }
private void _initNodeStore() { CellRendererToggle colorToggle = new Gtk.CellRendererToggle(); colorToggle.Toggled += (object o, ToggledArgs args) => { VectorFile vf = (VectorFile)(NodeFileList.NodeStore.GetNode(new TreePath(args.Path))); vf.ExportColorArt = !vf.ExportColorArt; }; CellRendererToggle lineToggle = new Gtk.CellRendererToggle(); lineToggle.Toggled += (object o, ToggledArgs args) => { VectorFile vf = (VectorFile)(NodeFileList.NodeStore.GetNode(new TreePath(args.Path))); vf.ExportLineArt = !vf.ExportLineArt; }; CellRendererToggle mergedToggle = new Gtk.CellRendererToggle(); mergedToggle.Toggled += (object o, ToggledArgs args) => { VectorFile vf = (VectorFile)(NodeFileList.NodeStore.GetNode(new TreePath(args.Path))); vf.ExportMerged = !vf.ExportMerged; }; CellRendererText optionsRenderer = new CellRendererText(); optionsRenderer.Editable = true; optionsRenderer.Edited += (object o, EditedArgs args) => { VectorFile vf = (VectorFile)(NodeFileList.NodeStore.GetNode(new TreePath(args.Path))); vf.Options = args.NewText; }; CellRendererText nameRenderer = new CellRendererText(); nameRenderer.Editable = true; nameRenderer.Edited += (object o, EditedArgs args) => { VectorFile vf = (VectorFile)(NodeFileList.NodeStore.GetNode(new TreePath(args.Path))); vf.Name = args.NewText; }; TreeViewColumn nameCol = NodeFileList.AppendColumn("Name", nameRenderer, "text", 5); nameCol.Resizable = true; NodeFileList.AppendColumn("Color", colorToggle, "active", 3); NodeFileList.AppendColumn("Line", lineToggle, "active", 2); NodeFileList.AppendColumn("Merged", mergedToggle, "active", 1); TreeViewColumn optionsCol = NodeFileList.AppendColumn("Options", optionsRenderer, "text", 4); optionsCol.Resizable = true; NodeFileList.AppendColumn("Path", new Gtk.CellRendererText(), "text", 0); NodeFileList.NodeStore = exportSettingsController.GetListStore(); NodeFileList.CursorChanged += RowSelected; }