/// <summary> /// OLV Double Click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void olvFiles_DoubleClick(object sender, EventArgs e) { if (olvFiles.SelectedIndex >= 0) // If selected Item { // ----- Objects ----- if (objectForm) { frmEditObjects form = new frmEditObjects(); form.ShowDialog(((Objects)olvFiles.SelectedObject).ID); form.Dispose(); UpdateOLVObject(); // Update OLV } // ----- Files ----- else { FInfo info = (FInfo)olvFiles.SelectedObject; try { if (File.Exists(info.Path) || Directory.Exists(info.Path)) { Process.Start(info.Path); } else { Process.Start(RelativePath + Path.DirectorySeparatorChar + info.Path); } } catch (Exception Err) { Dialogs.ShowErr(Err.Message, Lng.Get("Error")); } } } }
/// <summary> /// New Item /// </summary> private void NewItemObjects() { frmEditObjects form = new frmEditObjects(); var res = form.ShowDialog(); // Show Edit form while (res == DialogResult.Yes) // If New item request { form.Dispose(); form = new frmEditObjects(); // New Form res = form.ShowDialog(); // Show new Edit form } UpdateObjOLV(); // Update Items OLV }
/// <summary> /// Edit Item /// </summary> private void EditItemObjects() { if (olvObjects.SelectedIndex >= 0) // If selected Item { frmEditObjects form = new frmEditObjects(); // Show Edit form var res = form.ShowDialog(((Objects)olvObjects.SelectedObject).ID); while (res == DialogResult.Yes) // If New item request { form.Dispose(); form = new frmEditObjects(); // New Form res = form.ShowDialog(); // Show new Edit form } UpdateObjOLV(); // Update Items OLV } }