public virtual bool OnLeftMouseClick(Point p) { if (id == "debugger") { } LastMouseClickedPostion = p; WinFormControler.TriggerComponateClicked(this); if (OnLeftClick != null) { OnLeftClick(this, p); return(true); } return(false); }
private void FileList_OnItemClicked(ListBox.ListBoxItem item, int selection) { TextBox tb = (TextBox)WinFormControler.FindComponateById("txtfile"); Button bntOk = (Button)WinFormControler.FindComponateById("ok"); if (_fileSystemEntrys[selection].Name == "..\\") //if go up one directory { string tmp = CurrentDirectory; if (tmp.Length < 3) { return; } int ld = tmp.LastIndexOf("\\"); if (ld == -1) { return; } if (ld <= 2) { tmp = tmp.Substring(0, 3); } else { tmp = tmp.Substring(0, ld); } BuildDirectoryListing(tmp); tb.Text = string.Empty; _selectedFile = null; bntOk.Active = false; return; } if (_fileSystemEntrys[selection].Type == FileSystemType.Folder) //if folder { BuildDirectoryListing(_fileSystemEntrys[selection].Path); tb.Text = string.Empty; _selectedFile = null; bntOk.Active = false; } else { //if file tb.Text = _fileSystemEntrys[selection].Name; _selectedFile = _fileSystemEntrys[selection].Path; bntOk.Active = true; // DeActivate(); //close dialog } }
private void Bnt_On_Ok_Clicked(object sender, Point p) { TextBox tb = (TextBox)WinFormControler.FindComponateById("txtfile"); if (_selectedFile == null || _selectedFile == string.Empty) { if (tb.Text.Length == 0) { return; } else { _selectedFile = CurrentDirectory + "\\" + tb.Text; } } if (_type == FileDialogType.Load || _type == FileDialogType.Picker) //if load dialog box { //now make sure that the file exists if (!File.Exists(_selectedFile)) { WinFormControler.MessageBox.ShowErrorDialog("File Not Found", "The file does not exist"); return; //exit because file does not exits } } if (OnFileSelected != null) { OnFileSelected(_selectedFile, _type); } if (_type == FileDialogType.Picker) { if (_returnFunction != null) { _returnFunction(this, _selectedFile); } } DeActivate(); }
/// <summary> /// /// </summary> /// <param name="isfocuse">if its in focuse or not</param> public void ShowFilePicker(bool isfocuse, string currentFile, Action <Componate, string> returnFunction = null) { _returnFunction = returnFunction; if (currentFile == null) { currentFile = string.Empty; } TextBox tb = (TextBox)WinFormControler.FindComponateById("txtfile"); tb.Visible = false; tb.Active = false; _type = FileDialogType.Picker; Button bnt = FindComponateById("ok") as Button; bnt.Text = "Select"; BuildDirectoryTree(); base.Activate(isfocuse); }
/// <summary> /// /// </summary> /// <param name="isfocuse">if its in focuse or not</param> public void ShowLoadDialog(bool isfocuse, string currentFile) { if (currentFile == null) { currentFile = string.Empty; } TextBox tb = (TextBox)WinFormControler.FindComponateById("txtfile"); tb.Text = currentFile; tb.Visible = true; _type = FileDialogType.Load; Button bnt = FindComponateById("ok") as Button; bnt.Text = "Load"; BuildDirectoryTree(); base.Activate(isfocuse); }