internal static string GetFilenameWinForms(MenuSystem console) { #if NO_APP_WINFORMS throw new NotSupportedException("NO_APP_WINFORMS"); #else string fileSource; try { EventHandler action = delegate { var d = new System.Windows.Forms.OpenFileDialog(); if (d.ShowDialog() != System.Windows.Forms.DialogResult.OK) { return; } fileSource = d.FileName; }; fileSource = null; console.UiInvoke(action); if (fileSource == null) { return(null); } } catch (NotSupportedException) { #if !NETCF Trace.Fail("Why NotSupportedException on OpenFileDialog?!?"); #endif // NETCF on Standard fileSource = console.ReadLine("Which file"); } return(fileSource); #endif }
public OptionSubMenu(string name, Action <string> changeSubMenuMethod, MenuSystem me) : base("->" + name, null, changeSubMenuMethod.Method, me, new object[] { name }) { }