private async Task RigthOpenFolder(string Path) { SetStatus("Openning Directory...", YELLOW); var BaseDir = await Server.ParsePathB(Path); var Folders = await Server.EnumFoldersB(BaseDir?.ID, false); SetStatus("Connected", GREEN); RigthStore = new NodeStore(typeof(NameTreeNode)); if (Path.Trim(' ', '/', '\\', '\r', '\n') != string.Empty) { RigthStore.AddNode(new NameTreeNode("...", async() => { int IndexOfLast = RigthPathBox.Text.TrimEnd('\\', '/').LastIndexOfAny(new char[] { '\\', '/' }); if (IndexOfLast < 0) { return; } RigthPathBox.Text = RigthPathBox.Text.Substring(0, IndexOfLast + 1); await RigthOpenFolder(RigthPathBox.Text); })); } foreach (var Folder in Folders) { RigthStore.AddNode(new NameTreeNode(Folder?.Name, async() => { RigthPathBox.Text = Path + Folder?.Name + "/"; await RigthOpenFolder(RigthPathBox.Text); })); } RightNodeList.NodeStore = RigthStore; }
void AddFolder(NodeStore Store) { if (PlatformDetection.IsWindows) { using (Ionic.Utils.FolderBrowserDialogEx dialog = new Ionic.Utils.FolderBrowserDialogEx()) { dialog.Description = "Choose the Folder to scan."; dialog.ShowNewFolderButton = false; dialog.ShowFullPathInEditBox = true; if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (!String.IsNullOrWhiteSpace(dialog.SelectedPath)) { try { Store.AddNode(new StringNode() { Value = new System.IO.DirectoryInfo(dialog.SelectedPath).FullName }); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } } } else { using (Gtk.FileChooserDialog fc = new Gtk.FileChooserDialog("Choose the Folder to scan.", this, FileChooserAction.SelectFolder, "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept)) { fc.LocalOnly = false; if (fc.Run() == (int)ResponseType.Accept) { try { Store.AddNode(new StringNode() { Value = new System.IO.DirectoryInfo(fc.Filename).FullName }); } catch (Exception ex) { MessageBox.Show(ex.Message); } } //Don't forget to call Destroy() or the FileChooserDialog window won't get closed. fc.Destroy(); } } }
public MainWindow() : base(Gtk.WindowType.Toplevel) { Build(); store = new Gtk.NodeStore(typeof(MyTreeNode)); store.AddNode(new MyTreeNode("Item A")); store.AddNode(new MyTreeNode("Item B")); store.AddNode(new MyTreeNode("Item C")); myNodeView = new NodeView(store); myNodeView.ButtonPressEvent += new ButtonPressEventHandler(OnItemButtonPressed); myNodeView.AppendColumn("Deletable items", new Gtk.CellRendererText(), "text", 0); myNodeView.ShowAll(); Add(myNodeView); }
protected void openFileClicked(object sender, EventArgs e) { if (manager.cleanUp()) { var filechooser = new FileChooserDialog("Choose the Wad file to open", this, FileChooserAction.Open, "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept); if (filechooser.Run() == (int)ResponseType.Accept) { if (manager.openWadFile(filechooser.Filename)) { var store = new NodeStore(typeof(TableNode)); foreach (var entry in manager.mapEntries) { store.AddNode(new TableNode(entry.Key, entry.Value.Type.ToString(), "" + entry.Value.UncompressedSize, "", entry.Value)); } nodeview.NodeStore = store; } } filechooser.Destroy(); } }
/// <summary> /// Adds a node to repressent the new sequence. /// </summary> /// <param name="sender"> /// A <see cref="System.Object"/> /// </param> /// <param name="args"> /// A <see cref="SequenceAddedArgs"/> /// </param> private void OnControllerSequenceAdded(object sender, SequenceAddedArgs _args) { Application.Invoke(sender, _args, delegate(object resender, EventArgs args) { SequenceAddedArgs a = args as SequenceAddedArgs; sequencesModel.AddNode(a.Sequence); //sequencesNV.ColumnsAutosize(); sequencesNV.NodeSelection.SelectNode(a.Sequence); sequencesNV.ScrollToCell(sequencesNV.Selection.GetSelectedRows()[0], sequencesNV.Columns[0], true, 1, 0); if (currentToken != null) { sequencingStepResultLbl.Markup = String.Format("<b>El símbolo «{0}» no se pudo añadir a ninguna secuencia, se crea una nueva</b>", currentToken.Text); } sequencesNV.ColumnsAutosize(); }); }
public void Initialize(iMetaLibrary.Metadata.TvEpisodeMeta EpisodeMeta) { this.EpisodeMeta = EpisodeMeta; store.Clear(); ratingwidget1.Value = (int)EpisodeMeta.Rating; txtEpisodeName.Text = EpisodeMeta.Title ?? ""; txtStudio.Text = EpisodeMeta.Studio ?? ""; txtPlot.Buffer.Text = EpisodeMeta.Plot ?? ""; txtMpaa.Text = EpisodeMeta.Mpaa; txtWriters.Text = String.Join(", ", EpisodeMeta.Writers ?? new string[] { }); txtDirectors.Text = String.Join(", ", EpisodeMeta.Directors ?? new string[] { }); //ctrlRating.CurrentRating = (int)EpisodeMeta.Rating; txtAired.Text = EpisodeMeta.Aired < new DateTime(1850, 1, 1) ? "": EpisodeMeta.Aired.ToString("yyyy-MM-dd"); txtPremiered.Text = EpisodeMeta.Premiered < new DateTime(1850, 1, 1) ? "" : EpisodeMeta.Premiered.ToString("yyyy-MM-dd"); numEpisode.Value = EpisodeMeta.Episode.CheckRange((int)numEpisode.Adjustment.Lower, (int)numEpisode.Adjustment.Upper); numSeason.Value = EpisodeMeta.Season.CheckRange((int)numSeason.Adjustment.Lower, (int)numSeason.Adjustment.Upper); numDisplayEpisode.Value = EpisodeMeta.DisplayEpisode.CheckRange((int)numDisplayEpisode.Adjustment.Lower, (int)numDisplayEpisode.Adjustment.Upper); numDisplaySeason.Value = EpisodeMeta.DisplaySeason.CheckRange((int)numDisplaySeason.Adjustment.Lower, (int)numDisplaySeason.Adjustment.Upper); txtEpisodeStart.Text = new DateTime(new TimeSpan(0, 0, EpisodeMeta.EpBookmark).Ticks).ToString("HH:mm:ss"); if (EpisodeMeta.Actors != null) { foreach (var actor in EpisodeMeta.Actors) { store.AddNode(new ActorNode() { Name = actor.Key, Role = actor.Value }); } } }
/// <summary> /// Establece la imagen inicial para segmentar y reconocer sus /// caracteres. /// </summary> /// <param name="image"> /// La imagen inicial. /// </param> private void SetInitialImage(string filename) { imageOriginal = new Pixbuf(filename); imageAreaOriginal.Image = imageOriginal; store.Clear(); // Generamos el MaxtTextBitmap inical, y lo añadimos como // un nodo al arbol. MathTextBitmap mtb = new MathTextBitmap(imageOriginal); SegmentedNode node = new SegmentedNode(System.IO.Path.GetFileNameWithoutExtension(filename), mtb, treeview); store.AddNode(node); rootNode = node; controller.StartNode = node; Log("¡Archivo de imagen «{0}» cargado correctamente!", filename); alignNextButtons.Sensitive = true; segmentBtn.Sensitive = true; gotoTokenizerBtn.Sensitive = false; buttonsNB.Page = 0; }
protected void SelectElementTableClicked(object sender, EventArgs e) { Gtk.FileChooserDialog fc = new Gtk.FileChooserDialog("Open xstage file.", this, FileChooserAction.Open, "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept); fc.SetCurrentFolder(settings.GetSettingsFileLocationUri().AbsolutePath); FileFilter ff = new FileFilter(); ff.AddPattern("*.xstage"); fc.Filter = ff; if (fc.Run() == (int)ResponseType.Accept) { XStageProject xsp = XStageProject.Load(fc.Filename); List <XStageElement> elementTable = xsp.elements; elementTableUrl = fc.Filename; nodestore.Clear(); foreach (XStageElement element in elementTable) { Uri elementTableUri = new Uri(elementTableUrl); Uri elementTableDirectory = new Uri(elementTableUri, "."); foreach (XStageDrawing d in element.drawings) { VectorFilePath vfp = new VectorFilePath(); vfp.Path = elementTableDirectory.OriginalString + element.rootFolder + "/" + element.elementFolder + "/" + element.elementName + "-" + d.name + ".tvg"; vfp.Name = element.elementName + "-" + d.name; nodestore.AddNode(vfp); } } Console.WriteLine(xsp.GetXmlString()); } fc.Destroy(); }
private CreateReportDialog(Builder builder) : base(builder.GetObject("CreateReportDialog").Handle) { builder.Autoconnect(this); DefaultResponse = ResponseType.Cancel; Response += Dialog_Response; buttonAddParticipant.Clicked += ButtonAddParticipant_Clicked; buttonAddDecision.Clicked += ButtonAddDecision_Clicked; nodeStoreParticiapnts = new NodeStore(typeof(ParticipantModel)); nodeStoreParticiapnts.AddNode(new ParticipantModel() { Fake = true }); nodeStoreDecisions = new NodeStore(typeof(DecisionModel)); nodeStoreDecisions.AddNode(new DecisionModel() { Fake = true }); nodeViewParticiapnts = new NodeView(nodeStoreParticiapnts); nodeViewParticiapnts.AppendColumn("Name", new CellRendererText(), "text", 0); alignmentParticiapnts.Add(nodeViewParticiapnts); nodeViewParticiapnts.ShowAll(); nodeViewDecisions = new NodeView(nodeStoreDecisions); nodeViewDecisions.AppendColumn("Problem", new CellRendererText(), "text", 0); nodeViewDecisions.AppendColumn("Solution", new CellRendererText(), "text", 1); nodeViewDecisions.AppendColumn("Responsible", new CellRendererText(), "text", 2); nodeViewDecisions.AppendColumn("ControlDate", new CellRendererText(), "text", 3); alignmentDecisions.Add(nodeViewDecisions); nodeViewDecisions.ShowAll(); }
private void LoadFileList() { SpawnThread(delegate() { System.Timers.Timer timer = new System.Timers.Timer(100); ProgressBar progress = new ProgressBar(); //progress.Fraction = 0.0; progress.Orientation = ProgressBarOrientation.LeftToRight; timer.Elapsed += (obj1, obj2) => { progress.Pulse(); }; Label label = new Label("Please wait..."); //label.HeightRequest = 160; label.WidthRequest = 200; Dialog dialog = new Dialog("Retrieving file list", this, Gtk.DialogFlags.DestroyWithParent); dialog.TypeHint = WindowTypeHint.Splashscreen; dialog.Modal = true; dialog.VBox.Add(label); dialog.HasSeparator = false; dialog.VBox.Add(progress); Gtk.Application.Invoke(delegate { dialog.ShowAll(); timer.Start(); }); try{ IBrickFile[] files = brick.FileSystem.FileList(); Gtk.Application.Invoke(delegate { fileNodeStore.Clear(); if (files != null) { foreach (MonoBrick.NXT.BrickFile file in files) { fileNodeStore.AddNode(new FileNode(file)); } } EnableFileUserInput(); isFileListLoaded = true; }); } catch (Exception e) { Gtk.Application.Invoke(delegate { timer.Stop(); dialog.Destroy(); DisableFileUserInput(); isFileListLoaded = false; MessageDialog md = new MessageDialog(this, DialogFlags.Modal, MessageType.Info, ButtonsType.Close, "\nFailed to get file list"); md.Icon = global::Gdk.Pixbuf.LoadFromResource(MessageDialogIconName); md.WindowPosition = Gtk.WindowPosition.CenterOnParent; md.Run(); md.Destroy(); }); throw(e); } Gtk.Application.Invoke(delegate { timer.Stop(); dialog.Destroy(); }); }); }
private void RefreshQueueList() { mQueueNodeStore.Clear(); for (int i = 0; i < mRenderingQueue.Queue.Length; i++) { mQueueNodeStore.AddNode(new RenderingTaskTreeNode(mRenderingQueue.Queue[i])); } }
private void RefreshDataGridPlayer(List <Player> players) { NodeStore ns = new NodeStore(typeof(PlayerTreeNode)); foreach (Player p in players) { ns.AddNode(new PlayerTreeNode(p)); } DataGridOutput.NodeStore = ns; }
private void RefreshDataGridPairings(List <Pairing> pairings) { NodeStore ns = new NodeStore(typeof(PairingTreeNode)); foreach (Pairing p in pairings) { ns.AddNode(new PairingTreeNode(p)); } DataGridOutput.NodeStore = ns; }
void Env_LinkedMonitoredCode(LinkedCode obj) { dependenciesStore.Clear(); var q = obj.Types.OrderBy(x => x.Name); foreach (var t in q) { dependenciesStore.AddNode(new DependencyTreeNode(t)); } }
private NodeStore CreateModel() { NodeStore store = new NodeStore(typeof(GameInfoNode)); foreach (GameInfo info in GameData) { store.AddNode(new GameInfoNode(info)); } return(store); }
private void ButtonAddParticipant_Clicked(object sender, EventArgs e) { var models = nodeStoreParticiapnts.OfType <ParticipantModel>(); if (models.Count() == 1 && models.First().Fake == true) { nodeStoreParticiapnts.Clear(); } nodeStoreParticiapnts.AddNode(new ParticipantModel { Name = "Participant" }); }
private void RefreshDataGridPlayer(List <Player> players) { NodeStore ns = new NodeStore(typeof(PlayerTreeNode)); activeTable = new List <Player> (); foreach (Player p in players) { ns.AddNode(new PlayerTreeNode(p)); activeTable.Add(p); } dataGridPlayer.NodeStore = ns; }
private void RefreshListBoxPairings() { int nr = 0; NodeStore ns = new NodeStore(typeof(PrePairedTreeNode)); foreach (Pairing p in PremadePairing) { ns.AddNode(new PrePairedTreeNode(nr, p.Player1.DisplayName + " gegen " + p.Player2.DisplayName)); nr++; } ListboxPairings.NodeStore = ns; }
/* Interface Implementation */ /* * Cargará el proyecto. * Coge el ProjectDTO que le pasamos y asignamos la referencia al modelo * del projectDTO. Además con ese nuevo DTO crea un nuevo Nodo y * rellenará también sus componentes. */ public void LoadDataForm(IDataTransferObject dto) { if (dto is ProjectDTO) { //Refresca el proyecto. ProjectDTO projectDTO = (ProjectDTO)dto; this.projectDTO = projectDTO; ClearForm(); componentNodeStore.AddNode(new ProjectNode(this.projectDTO)); } componentNodeView.ExpandAll(); }
private void RefreshDataGridPairings(List <Pairing> pairings) { NodeStore ns = new NodeStore(typeof(PairingTreeNode)); activePairings = new List <Pairing> (); foreach (Pairing p in pairings) { ns.AddNode(new PairingTreeNode(p)); activePairings.Add(p); } dataGridPairing.NodeStore = ns; }
public EpisodeEditorGui() { this.Build(); #region setup the actors datagrid store = new NodeStore(typeof(ActorNode)); CellRendererText nameRender = new CellRendererText() { Editable = true, }; nameRender.Edited += delegate(object o, EditedArgs args) { // update the text ActorNode node = (ActorNode)store.GetNode(new Gtk.TreePath(args.Path)); node.Name = args.NewText; }; nvActors.AppendColumn("Name", nameRender, "text", 0); CellRendererText roleRender = new CellRendererText() { Editable = true, }; roleRender.Edited += delegate(object o, EditedArgs args) { // update the text ActorNode node = (ActorNode)store.GetNode(new Gtk.TreePath(args.Path)); node.Role = args.NewText; }; nvActors.AppendColumn("Role", roleRender, "text", 1); nvActors.NodeStore = store; btnActorsRemove.Clicked += delegate { ActorNode node = nvActors.NodeSelection.SelectedNode as ActorNode; if (node != null) { store.RemoveNode(node); } }; btnActorsAdd.Clicked += delegate { var node = new ActorNode(); store.AddNode(node); nvActors.NodeSelection.SelectNode(node); int _n = 0; var enumerator = store.GetEnumerator(); while (enumerator.MoveNext()) { _n++; } nvActors.ScrollToCell(new TreePath(new int[] { _n - 1 }), null, false, 0, 0); }; #endregion }
/// <summary> /// Processes The Files /// </summary> private void ProcessFilenames() { ActiveDir = (System.IO.Path.GetDirectoryName(FilesToBoop[0])); string file = ""; string name = ""; string description = ""; foreach (string item in FilesToBoop) { if (ActiveDir == System.IO.Path.GetDirectoryName(item)) { if (System.IO.Path.GetExtension(item) == ".cia") { byte[] desc = new Byte[256]; byte[] tit = new Byte[128]; using (BinaryReader b = new BinaryReader(File.Open(item, FileMode.Open))) { b.BaseStream.Seek(-14016 + 520, SeekOrigin.End); tit = b.ReadBytes(128); b.BaseStream.Seek(-14016 + 520 + 128, SeekOrigin.End); desc = b.ReadBytes(256); } file = System.IO.Path.GetFileName(item); name = Encoding.Unicode.GetString(tit).Trim(); description = Encoding.Unicode.GetString(desc).Trim(); NodeStore store = new NodeStore(typeof(CIAList)); store.AddNode(new CIAList(file, name, description)); nodeview1.NodeStore = store; } else { /*TODO:Throw an error?*/ } } else { MessageDialog md = new MessageDialog(this, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Ok, "You picked 2 files that are NOT in the same directory" + Environment.NewLine + "Cross-Directory booping would need the entire computer hosted to the network and that doesn't feel safe in my book." + Environment.NewLine + "Maybe in the future I'll find a way to do this."); md.Run(); md.Destroy(); } } }
private void ButtonAddDecision_Clicked(object sender, EventArgs e) { var models = nodeStoreDecisions.OfType <DecisionModel>(); if (models.Count() == 1 && models.First().Fake == true) { nodeStoreDecisions.Clear(); } nodeStoreDecisions.AddNode(new DecisionModel { Problem = "Problem", Solution = "Solution", Responsible = "Responsible", ControlDate = DateTime.Now.ToString() });; }
protected void txt_search_TextChanged(object sender, EventArgs e) { NodeStore searchStore = new NodeStore(typeof(Node)); string searchQuery = txt_search.Buffer.Text; foreach (Node node in Store) { if (node.EmailAddress.Contains(searchQuery) || node.FullName.Contains(searchQuery) || node.PhoneNumber1.Contains(searchQuery) || node.PhoneNumber2.Contains(searchQuery)) { searchStore.AddNode(node); } } dgv_contacts.NodeStore = searchStore; }
private void OnUnassistedProcessBtnClicked(object sender, EventArgs args) { // We try to free memory. GC.Collect(); segmentationStore.Clear(); MainRecognizerWindow.ProcessItemsSensitive = true; unassistedControlHBB.Sensitive = false; unassistedTaskNameLabel.Text = "Segmentación y OCR"; unassistedGlobalProgressBar.Fraction = 0; // We create the image to be recognized. Bitmap bitmap = handwritingArea.Bitmap; FloatBitmap floatBitmap = new FloatBitmap(bitmap.Width, bitmap.Height); for (int i = 0; i < bitmap.Width; i++) { for (int j = 0; j < bitmap.Height; j++) { floatBitmap[i, j] = bitmap.GetPixel(i, j).GetBrightness(); } } // The original image is set. originalImage = floatBitmap.CreatePixbuf(); MathTextBitmap mtb = new MathTextBitmap(originalImage); SegmentedNode node = new SegmentedNode("Raíz", mtb, null); segmentationStore.AddNode(node); ocrController.StartNode = node; ocrController.SearchDatabase = false; ocrController.Databases = Config.RecognizerConfig.Instance.Databases; ocrController.Next(ControllerStepMode.UntilEnd); }
private void AddDownload(Downloader d) { d.RestartingSegment += download_RestartingSegment; d.SegmentStoped += download_SegmentEnded; d.SegmentFailed += download_SegmentFailed; d.SegmentStarted += download_SegmentStarted; d.InfoReceived += download_InfoReceived; d.SegmentStarting += Downloader_SegmentStarting; string ext = System.IO.Path.GetExtension(d.LocalFile); DownloadListNode item = new DownloadListNode(d); mapDownloadToItem[d] = item; mapItemToDownload[item] = d; NodeStore.AddNode(item); }
public XStageListTab(XStageProject xstage, Uri fileUri, ExportListController exportListController) { this.Build(); _xstage = xstage; this.exportListController = exportListController; nodestore = new NodeStore(typeof(ElementExportSettings)); FileTree.RulesHint = true; FileTree.Selection.Mode = SelectionMode.Multiple; FileTree.AppendColumn("Name", new Gtk.CellRendererText(), "text", 1); FileTree.AppendColumn("Path", new Gtk.CellRendererText(), "text", 0); FileTree.NodeStore = nodestore; AddButton.Clicked += (sender, e) => { NodeSelection selection = FileTree.NodeSelection; foreach (ITreeNode node in selection.SelectedNodes) { //Add selected VectorFilePath to the active export list ElementExportSettings current = (ElementExportSettings)node; ElementExportSettings tvg = new ElementExportSettings(); tvg.Name = current.Name; tvg.FilePath = current.FilePath; exportListController.AddTvg(tvg); } }; foreach (XStageElement element in xstage.elements) { Uri xstageDirectory = new Uri(fileUri, "./"); foreach (XStageDrawing d in element.drawings) { ElementExportSettings vfp = new ElementExportSettings(); vfp.FilePath = new Uri(xstageDirectory.LocalPath + element.rootFolder + "/" + element.elementFolder + "/" + element.elementName + "-" + d.name + ".tvg"); vfp.Name = element.elementName + "-" + d.name; nodestore.AddNode(vfp); } } }
private void OnControllerMatching(object sender, MatchingArgs _args) { Application.Invoke(sender, _args, delegate(object resender, EventArgs a) { MatchingArgs args = a as MatchingArgs; SyntacticalCoverNode newNode = new SyntacticalCoverNode(args.Matcher, syntacticalCoverTree); if (currentNode == null) { syntacticalCoverModel.AddNode(newNode); } else { currentNode.Select(); currentNode.AddChild(newNode); syntacticalCoverTree.ExpandRow(syntacticalCoverTree.Selection.GetSelectedRows()[0], false); } currentNode = newNode; currentNode.Select(); parsingTaskLabel.Markup = String.Format("<b>Intentando encajar los elementos restantes con <i>{0}</i></b>", GLib.Markup.EscapeText(currentNode.Matcher.Label)); parsingNextButtonsAlign.Sensitive = controller.StepMode == ControllerStepMode.StepByStep; }); }
private void Refresh() { NodeStore ns = new NodeStore(typeof(StatisticsTreeNode)); foreach (Pilot p in stats.IPilots) { ns.AddNode(new StatisticsTreeNode(p.Count, p.Gername)); } DataGridPilots.NodeStore = ns; ns = new NodeStore(typeof(StatisticsTreeNode)); foreach (IUpgrade u in stats.IUpgrades) { ns.AddNode(new StatisticsTreeNode(u.Count, u.Gername)); } DataGridShips.NodeStore = ns; ns = new NodeStore(typeof(StatisticsTreeNode)); foreach (Ship s in stats.IShips) { ns.AddNode(new StatisticsTreeNode(s.Count, s.Gername)); } DataGridUpgrades.NodeStore = ns; }
/// <summary> /// Sets the image to be processed. /// </summary> /// <param name="image"> /// The initial image's path. /// </param> private void SetInitialImage(string filename) { segmentationStore.Clear(); Gdk.Pixbuf imageOriginal = new Gdk.Pixbuf(filename); originalImageArea.Image = imageOriginal; // Generamos el MaxtTextBitmap inicial, y lo añadimos como // un nodo al arbol. MathTextBitmap mtb = new MathTextBitmap(imageOriginal); SegmentedNode node = new SegmentedNode(System.IO.Path.GetFileNameWithoutExtension(filename), mtb, null); segmentationStore.AddNode(node); ocrController.StartNode = node; Log("¡Archivo de imagen «{0}» cargado correctamente!", filename); unassistedProcessBtn.Sensitive = true; }