public static IRunner BuildRunner(Action<IConfigurationHelper> configurator) { var configPlan = new ConfigurationPlan(); if (configurator != null) { configurator(configPlan); } configPlan.Validate(); var routingInfo = GetRoutingInfo(configPlan); routingInfo.Validate(); var router = new CommandRouter(routingInfo); var argsHelper = new ArgsHelper(configPlan.SwitchDelimiter); var argsHelpProvider = new ArgsParameterHelpProvider(argsHelper); var argsParameterBinder = new ArgsParameterBinder(argsHelper); var helpProvider = new HelpProvider(router, argsHelpProvider); var cmdProcessor = new CommandProcessor(router, configPlan.TypeInstantiationStrategy, argsParameterBinder); return new RunnerInternal(helpProvider, cmdProcessor); }
public void VerifyHelpData() { var config = Configuration.Configure<HelpClassTest>(); var help = new HelpProvider(); var result = help.GenerateModelHelp(config); result.SwitchDelimiter.Should().Be.EqualTo("//"); result.Members.Count().Should().Be.EqualTo(4); result.HelpText.Should().Be.EqualTo("This is my console application"); var m = result.Members.Where(h => h.Name == "Id").Single(); m.HelpText.Should().Be.EqualTo("This is the Id"); m.OrdinalIndex.Should().Be.EqualTo(default(int?)); m.Switches.Should().Have.SameSequenceAs(new[] { "Id", "I" }); m = result.Members.Where(h => h.Name == "Name").Single(); m.HelpText.Should().Be.EqualTo("This is the name you should put in."); m.OrdinalIndex.Should().Be.EqualTo(default(int?)); m.Switches.Should().Have.SameSequenceAs(new[] { "Name", "N" }); m = result.Members.Where(h => h.Name == "Switch").Single(); m.HelpText.Should().Be.EqualTo("Force it!"); m.OrdinalIndex.Should().Be.EqualTo(default(int?)); m.Switches.Should().Have.SameSequenceAs(new[] { "Switch", "S" }); m = result.Members.Where(h => h.Name == "Date").Single(); m.HelpText.Should().Be.EqualTo("Effective date"); m.OrdinalIndex.Should().Be.EqualTo(0); m.Switches.Should().Be.Empty(); }
internal static void Main(string[] args) { try { // Expand fist and then bind to Args var expanded = args.Select(a => parser.ParseArguments(a)).ToArray(); var config = Args.Configuration.Configure<CommandArgs>(); var cmds = config.AsFluent() .UsingStringComparer(StringComparer.InvariantCultureIgnoreCase) .Initialize() .CreateAndBind(expanded); if (args.Length < 1 || args.Length == 1 && cmds.ShowHelp) { var help = new HelpProvider(); var commandsHelp = help.GenerateModelHelp<CommandArgs>(config); var formatter = new Args.Help.Formatters.ConsoleHelpFormatter(); formatter.WriteHelp(commandsHelp, Console.Out); return; } // TODO: Research for a better way to validate parameters with Args try { ValidateArgs(cmds); } catch (Exception ex) { Console.WriteLine(ex.Message); Console.WriteLine(); Console.WriteLine("Try bootstrapper -help for more information"); } Mapper.CreateMap<CommandArgs, BootStrapperArgs>() .ForMember(dest => dest.Unzip, opt => opt.MapFrom(src => !String.IsNullOrEmpty(src.Unzip))) .ForMember(dest => dest.UnzipTarget, opt => opt.MapFrom(src => parser.ParseArguments(src.Unzip))); var bootArgs = Mapper.Map<CommandArgs, BootStrapperArgs>(cmds); var builder = BuildContainer(); using (var container = builder.Build()) { container.Resolve<BootStrapperManager>().Start(bootArgs); } } catch (Exception ex) { Console.WriteLine(ex.ToString()); // TODO: Push error to blob storage? } }
private static void ShowHelp(IModelBindingDefinition<CmdLine> definition) { var help = new HelpProvider().GenerateModelHelp(definition); var helpFormatter = new ConsoleHelpFormatter(System.Console.WindowWidth, 1, 5); help.HelpText = Assembly.GetExecutingAssembly().FullName + Environment.NewLine; var helpString = helpFormatter.GetHelp(help); System.Console.Error.WriteLine(helpString); }
public static void WriteHelp(Type modelType, TextWriter writer) { var definition = CreateDefinitionForType(modelType); var helpProvider = new HelpProvider(); var generateHelpMethod = typeof (HelpProvider).GetMethod("GenerateModelHelp").MakeGenericMethod(modelType); var modelHelp = (ModelHelp) generateHelpMethod.Invoke(helpProvider, new[] {definition}); var formatter = new ConsoleHelpFormatter(80, 1, 5); formatter.WriteHelp(modelHelp, writer); }
public static void Main(string[] args) { AppLaunchingCommandLine commandLine; IModelBindingDefinition<AppLaunchingCommandLine> modelBindingDefinition = null; try { modelBindingDefinition = Configuration.Configure<AppLaunchingCommandLine>(); commandLine = modelBindingDefinition.CreateAndBind(args); /* if (commandLine.ProductId == Guid.Empty) { Console.WriteLine(""); Console.WriteLine("***Warning*** - no productId supplied"); Console.WriteLine(""); } */ } catch (Exception /*exception*/) { if (modelBindingDefinition != null) { var help = new HelpProvider(); var formatter = new ConsoleHelpFormatter(); var sw = new StringWriter(); var text = help.GenerateModelHelp(modelBindingDefinition); formatter.WriteHelp(text, sw); Console.Write(sw.ToString()); } else { Console.Write("Sorry - no help available!"); } return; } try { Console.WriteLine("AutomationHost starting"); using (var program = new Program(commandLine)) { Console.WriteLine("To show help, enter 'help'"); program.Run(); } } catch (QuitNowPleaseException) { Console.WriteLine("Goodbye"); } catch (Exception exception) { Console.WriteLine(string.Format("Exception seen {0} {1}", exception.GetType().FullName, exception.Message)); } }
public override void Execute() { base.Execute(); var helpProvider = new HelpProvider(); var modelHelp = helpProvider.GenerateModelHelp(_modelBindingDefinition); var helpFormatter = new HelpFormatter(); helpFormatter.WriteHelp(modelHelp, System.Console.Out); }
static int Main(string[] args) { GitReleaseNotesEnvironment.Log = new ConsoleLog(); var modelBindingDefinition = Configuration.Configure<GitReleaseNotesArguments>(); if (args.Any(a => a == "/?" || a == "?" || a.Equals("/help", StringComparison.InvariantCultureIgnoreCase))) { var help = new HelpProvider().GenerateModelHelp(modelBindingDefinition); var f = new ConsoleHelpFormatter(); f.WriteHelp(help, Console.Out); return 0; } var exitCode = 0; var arguments = modelBindingDefinition.CreateAndBind(args); // TODO: Convert to context verification (we need the context to be valid, not the arguments) if (!ArgumentVerifier.VerifyArguments(arguments)) { return 1; } var context = arguments.ToContext(); try { var releaseNotesGenerator = new ReleaseNotesGenerator(context, new FileSystem.FileSystem()); releaseNotesGenerator.GenerateReleaseNotes(); Log.WriteLine("Done"); } catch (GitReleaseNotesException ex) { exitCode = -1; Log.WriteLine("An expected error occurred: {0}", ex.Message); } catch (Exception ex) { exitCode = -2; Log.WriteLine("An unexpected error occurred: {0}", ex.Message); } if (Debugger.IsAttached) { Console.WriteLine("Press any key to continue"); Console.ReadKey(); } return exitCode; }
static void Main(string[] args) { var modelBindingDefinition = Args.Configuration.Configure<RunnerCommands>(); var command = modelBindingDefinition.CreateAndBind(args); var helpProvider = new HelpProvider(); var generateModelHelp = helpProvider.GenerateModelHelp(modelBindingDefinition); var formatter = new ConsoleHelpFormatter(); formatter.WriteHelp(generateModelHelp, Console.Out); Console.WriteLine(); //Console.WriteLine("RunProblem: {0}", command.RunProblem.HasValue ? command.RunProblem.Value.ToString() : "No value" ); //Console.WriteLine("Page: {0}", command.Page.HasValue ? command.Page.Value.ToString() : "No value"); }
private static string FormatHelp(IModelBindingDefinition<MigrationParameters> commandLineParser) { var helpData = new HelpProvider().GenerateModelHelp(commandLineParser); var message = new StringBuilder(); message.AppendLine(); message.AppendLine(helpData.HelpText); message.AppendLine(); foreach (var member in helpData.Members) { message.AppendFormat("{0} (--{1})\r\n", member.Name, member.Switches.Aggregate((lhs, rhs) => String.Join(", --", lhs, rhs)). ToLowerInvariant()); message.AppendFormat(" {0}\r\n\r\n", member.HelpText); } return message.ToString(); }
public void HelpProvider_SetHelpString_WithShowHelpTrue_ReturnsExpected(string helpString) { using var provider = new HelpProvider(); using var control = new Control(); provider.SetShowHelp(control, true); provider.SetHelpString(control, helpString); Assert.Same(helpString, provider.GetHelpString(control)); Assert.True(provider.GetShowHelp(control)); Assert.Equal(helpString, control.AccessibilityObject.Help); // Set same. provider.SetHelpString(control, helpString); Assert.Same(helpString, provider.GetHelpString(control)); Assert.True(provider.GetShowHelp(control)); Assert.Equal(helpString, control.AccessibilityObject.Help); }
public static void Bind(HelpProvider localHelpProvider, Control control) { IHelpProviderContext context = control.FindForm() as IHelpProviderContext; if (context != null) { if (localHelpProvider.GetShowHelp(control)) { string helpString = localHelpProvider.GetHelpString(control); if (helpString != null) { context.HelpProvider.SetShowHelp(control, true); context.HelpProvider.SetHelpString(control, helpString); } } } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="T:DictionaryConfigMgrDlg"/> class. /// </summary> /// ------------------------------------------------------------------------------------ public DictionaryConfigMgrDlg(Mediator mediator, string objType, List <XmlNode> configViews, XmlNode current) { InitializeComponent(); m_mediator = mediator; m_presenter = new DictionaryConfigManager(this, configViews, current); m_objType = objType; // Make a help topic ID m_helpTopicId = generateChooserHelpTopicID(m_objType); m_helpProvider = new HelpProvider { HelpNamespace = m_mediator.HelpTopicProvider.HelpFile }; m_helpProvider.SetHelpKeyword(this, m_mediator.HelpTopicProvider.GetHelpString(m_helpTopicId)); m_helpProvider.SetHelpNavigator(this, HelpNavigator.Topic); m_helpProvider.SetShowHelp(this, true); }
public Form1() { String Directorio = Directory.GetCurrentDirectory(); HelpProvider ayuda = new HelpProvider(); //ayuda.HelpNamespace = @"C:/Users/Curro/source/repos/Examen29-01-2021/ayuda/Examen.chm"; ayuda.HelpNamespace = @Directorio + "/Examen.chm"; ayuda.SetShowHelp(this, true); InitializeComponent(); videojuegos.Add(new Videojuego(1, "Assassins creed Valhala", "Accion")); videojuegos.Add(new Videojuego(2, "Zelda Breath of the Wild", "Aventura")); videojuegos.Add(new Videojuego(3, "Spiderman", "Accion")); videojuegos.Add(new Videojuego(4, "The forest", "Terror")); videojuegos.Add(new Videojuego(5, "Fifa 21", "Simulacion")); videojuegos.Add(new Videojuego(6, "Pokemon oro", "Simulacion")); }
public void HelpProvider_SetHelpString_WithShowHelpFalse_ReturnsExpected(string helpString) { var provider = new HelpProvider(); var control = new Control(); provider.SetShowHelp(control, false); provider.SetHelpString(control, helpString); Assert.Same(helpString, provider.GetHelpString(control)); Assert.Equal(!string.IsNullOrEmpty(helpString), provider.GetShowHelp(control)); Assert.Equal(string.IsNullOrEmpty(helpString) ? null : helpString, control.AccessibilityObject.Help); // Set same. provider.SetHelpString(control, helpString); Assert.Same(helpString, provider.GetHelpString(control)); Assert.Equal(!string.IsNullOrEmpty(helpString), provider.GetShowHelp(control)); Assert.Equal(string.IsNullOrEmpty(helpString) ? null : helpString, control.AccessibilityObject.Help); }
private void tipoviLokala_PreviewKeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { SelectedType = (Model.LokalType)tipoviLokala.SelectedItem; Prikaz.SelectedItem = SelectedType; Prikaz.ScrollIntoView(Prikaz.SelectedItem); oznakaTip.Text = SelectedType.key; imeTip.Text = SelectedType.name; opisTip.Text = SelectedType.description; BitmapSource i = new BitmapImage(SelectedType.image_uri); ikonicaTip.Source = i; } else if (e.Key == Key.F1) { HelpProvider.ShowHelp("TipoviPretraga", this); } }
private void CommandBinding_Executed(object sender, ExecutedRoutedEventArgs e) { IInputElement focusedControl = null; if (currentMainElement == null) { focusedControl = this; } else { focusedControl = currentMainElement; } if (focusedControl is DependencyObject) { string str = HelpProvider.GetHelpKey((DependencyObject)focusedControl); HelpProvider.ShowHelp(str, this); } }
private void InitializeComponent() { this.components = (IContainer) new Container(); this.ToolTip1 = new ToolTip(this.components); this.cboInspectors = new ComboBox(); this.OKButton = new Button(); this.HelpProvider = new HelpProvider(); this.SuspendLayout(); this.cboInspectors.Cursor = Cursors.Default; this.cboInspectors.DropDownStyle = ComboBoxStyle.DropDownList; this.cboInspectors.Location = new Point(8, 8); this.cboInspectors.Name = "cboInspectors"; this.cboInspectors.RightToLeft = RightToLeft.No; this.cboInspectors.Size = new Size(289, 21); this.cboInspectors.TabIndex = 1; this.OKButton.Cursor = Cursors.Default; this.OKButton.Enabled = false; this.OKButton.FlatStyle = FlatStyle.System; this.OKButton.Location = new Point(304, 8); this.OKButton.Name = "OKButton"; this.OKButton.RightToLeft = RightToLeft.No; this.OKButton.Size = new Size(81, 23); this.OKButton.TabIndex = 0; this.OKButton.Text = "OK"; this.AutoScaleBaseSize = new Size(5, 13); this.BackColor = SystemColors.Control; this.ClientSize = new Size(394, 36); this.ControlBox = false; this.Controls.Add((Control)this.cboInspectors); this.Controls.Add((Control)this.OKButton); this.Cursor = Cursors.Default; this.FormBorderStyle = FormBorderStyle.FixedDialog; this.Location = new Point(184, 250); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = nameof(frmChooseInspector); this.RightToLeft = RightToLeft.No; this.ShowIcon = false; this.ShowInTaskbar = false; this.StartPosition = FormStartPosition.CenterParent; this.Text = "Choose the Inspector for this session"; this.TopMost = true; this.ResumeLayout(false); }
public TestResultForm(testresult tstresult, int humanid, pBaseEntities ge, fBaseEntities fe) { InitializeComponent(); _ge = ge; _fe = fe; _testresult = tstresult; _humanid = humanid; RemarkToolTip = new ToolTip(); RemarkToolTip.ToolTipIcon = ToolTipIcon.Info; RemarkToolTip.ToolTipTitle = "Вопрос:"; RemarkToolTip.IsBalloon = true; HelpProvider help = new HelpProvider(); help.HelpNamespace = "Recog_help.chm"; help.SetHelpNavigator(this, HelpNavigator.Topic); help.SetHelpKeyword(this, "result_character.htm#test_view"); }
public void NoArgumentsShouldOutputHelp() { using (var programWriter = new StringWriter()) { Console.SetOut(programWriter); Program.Main(new string[0]); var modelBindingDefinition = Configuration.Configure <GitReleaseNotesArguments>(); var help = new HelpProvider().GenerateModelHelp(modelBindingDefinition); var f = new ConsoleHelpFormatter(80, 1, 5); using (var helpWriter = new StringWriter()) { f.WriteHelp(help, helpWriter); programWriter.ToString().ShouldContain(helpWriter.ToString()); } } }
public void SetHelpKeywordOnTextBoxes(HelpProvider helpProvider, Control.ControlCollection controls, string keyword) { if (controls == null) { return; } foreach (Control control in controls) { helpProvider.SetHelpNavigator(control, System.Windows.Forms.HelpNavigator.KeywordIndex); helpProvider.SetHelpKeyword(control, keyword); helpProvider.SetShowHelp(control, true); if (control.Controls != null && control.Controls.Count > 0) { SetHelpKeywordOnTextBoxes(helpProvider, control.Controls, keyword); } } }
public static int Main(string[] args) { var modelBindingDefinition = Args.Configuration.Configure <GitHubFlowArguments>(); var arguments = modelBindingDefinition.CreateAndBind(args); if (args.Any(a => a == "/?" || a == "?" || a.Equals("/help", StringComparison.InvariantCultureIgnoreCase))) { var help = new HelpProvider().GenerateModelHelp(modelBindingDefinition); var f = new ConsoleHelpFormatter(); f.WriteHelp(help, Console.Out); return(0); } var context = CreateContext(arguments); try { Run(context); using (var assemblyInfoUpdate = new AssemblyInfoUpdate(new FileSystem(), context)) { var execRun = RunExecCommandIfNeeded(context); var msbuildRun = RunMsBuildIfNeeded(context); if (!(execRun || msbuildRun)) { assemblyInfoUpdate.DoNotRestoreAssemblyInfo(); if (!context.CurrentBuildServer.IsRunningInBuildAgent()) { Console.WriteLine("WARNING: Not running in build server and /ProjectFile or /Exec arguments not passed"); Console.WriteLine(); Console.WriteLine("Run GitHubFlowVersion.exe /? for help"); } } } } catch (Exception ex) { Console.Error.WriteLine(ex); return(1); } return(0); }
public void NoArgumentsShouldOutputHelp() { using (var programWriter = new StringWriter()) { Console.SetOut(programWriter); Program.Main(new string[0]); var modelBindingDefinition = Configuration.Configure<GitReleaseNotesArguments>(); var help = new HelpProvider().GenerateModelHelp(modelBindingDefinition); var f = new ConsoleHelpFormatter(80, 1, 5); using (var helpWriter = new StringWriter()) { f.WriteHelp(help, helpWriter); programWriter.ToString().ShouldContain(helpWriter.ToString()); } } }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.Windows.Forms.ColumnHeader columnHeader1; System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AdvancedEncProps)); System.Windows.Forms.ColumnHeader columnHeader2; System.Windows.Forms.HelpProvider helpProvider1; this.lvConverterInfo = new System.Windows.Forms.ListView(); columnHeader1 = new System.Windows.Forms.ColumnHeader(); columnHeader2 = new System.Windows.Forms.ColumnHeader(); helpProvider1 = new HelpProvider(); this.SuspendLayout(); // // lvConverterInfo // this.lvConverterInfo.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { columnHeader1, columnHeader2 }); resources.ApplyResources(this.lvConverterInfo, "lvConverterInfo"); this.lvConverterInfo.FullRowSelect = true; helpProvider1.SetHelpString(this.lvConverterInfo, resources.GetString("lvConverterInfo.HelpString")); this.lvConverterInfo.MultiSelect = false; this.lvConverterInfo.Name = "lvConverterInfo"; helpProvider1.SetShowHelp(this.lvConverterInfo, ((bool)(resources.GetObject("lvConverterInfo.ShowHelp")))); this.lvConverterInfo.UseCompatibleStateImageBehavior = false; this.lvConverterInfo.View = System.Windows.Forms.View.Details; // // columnHeader1 // resources.ApplyResources(columnHeader1, "columnHeader1"); // // columnHeader2 // resources.ApplyResources(columnHeader2, "columnHeader2"); // // AdvancedEncProps // this.Controls.Add(this.lvConverterInfo); this.Name = "AdvancedEncProps"; helpProvider1.SetShowHelp(this, ((bool)(resources.GetObject("$this.ShowHelp")))); resources.ApplyResources(this, "$this"); this.ResumeLayout(false); }
private void InitHelp() { // Only enable the Help button if we have a help topic for the fieldName if (m_helpTopicProvider != null) { string keyword; m_btnHelp.Enabled = HelpTopicIsValid(m_helpTopic, out keyword); if (m_btnHelp.Enabled) { if (m_helpProvider == null) { m_helpProvider = new HelpProvider(); } m_helpProvider.HelpNamespace = m_helpTopicProvider.HelpFile; m_helpProvider.SetHelpKeyword(this, keyword); m_helpProvider.SetHelpNavigator(this, HelpNavigator.Topic); } } }
public void HelpProvider_SetShowHelp_GetShowHelp_ReturnsExpected(bool value) { using var provider = new HelpProvider(); using var control = new Control(); provider.SetShowHelp(control, value); Assert.Equal(value, provider.GetShowHelp(control)); Assert.True(provider.ShouldSerializeShowHelp(control)); // Set same. provider.SetShowHelp(control, value); Assert.Equal(value, provider.GetShowHelp(control)); Assert.True(provider.ShouldSerializeShowHelp(control)); // Set opposite. provider.SetShowHelp(control, !value); Assert.Equal(!value, provider.GetShowHelp(control)); Assert.True(provider.ShouldSerializeShowHelp(control)); }
private void Window_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Escape) { MainWindow w = this.Owner as MainWindow; if (w.cts != null) { w.cts.Cancel(); w.cts = null; w.WindowBorder.BorderThickness = w.windowThickness; w.WindowBorder.BorderBrush = w.windowBrush; } (this as Window).Close(); } else if (e.Key == Key.F1) { HelpProvider.ShowHelp("newType", this); } }
public ChartForm() { InitializeComponent(); _mainForm = new MainForm(); _res_man = new ResourceManager("PlantaPiloto.Resources.Res", typeof(MainForm).Assembly); _variables = new List <Variable>(); _db_services = new DB_services(_cul); _proyect = new Proyect(); _sqlData = new List <List <Variable> >(); _sqlTime = new List <float>(); _timer = new System.Timers.Timer(2000); _timer.Enabled = false; _timer.Elapsed += new ElapsedEventHandler(this.LoadChartsTimer); _chartAmount = 100; _helpProvider = new HelpProvider(); _filesPath = GlobalParameters.FilesPath; _helpProvider.HelpNamespace = Path.Combine(_filesPath, "helpProyect.chm"); _exMg = new ExceptionManagement(_cul); }
private void CommandBinding_Executed(object sender, ExecutedRoutedEventArgs e) { if (this.contentControl.Content.Equals(resursUC)) { HelpProvider.ShowHelp("noviResurs", this); } else if (this.contentControl.Content.Equals(tipUC)) { HelpProvider.ShowHelp("noviTip", this); } else if (this.contentControl.Content.Equals(etiketaUC)) { HelpProvider.ShowHelp("novaEtiketa", this); } else if (this.contentControl.Content.Equals(prikaziResurseUC)) { HelpProvider.ShowHelp("tabelaResursa", this); } else if (this.contentControl.Content.Equals(prikaziTipoveUC)) { HelpProvider.ShowHelp("tabelaTipova", this); } else if (this.contentControl.Content.Equals(prikaziEtiketeUC)) { HelpProvider.ShowHelp("tabelaEtiketa", this); } else if (this.contentControl.Content.Equals(ieUC)) { HelpProvider.ShowHelp("izmijeniEtiketu", this); } else if (this.contentControl.Content.Equals(itUC)) { HelpProvider.ShowHelp("izmijeniTip", this); } else if (this.contentControl.Content.Equals(irUC)) { HelpProvider.ShowHelp("izmijeniResurs", this); } else { HelpProvider.ShowHelp("pomoc", this); } }
// завершение DATA // // КОНСТРУКТОР of - CLASS FORM1 : FORM !!! // public Form1() { InitializeComponent(); //this.StartPosition = FormStartPosition.CenterScreen; - это уже есть в InitializeComponent() form2 = new Form2(); // создание второй формы form2.form1 = this; form2.cb = checkBoxShowForm2; mThreadList_Length = tbl.mThreadList.GetLength(0); // т.к. не получается foreach с двухмерным массивом int i = 0; // подсчет циклов // инициализация listBoxThread while (i < mThreadList_Length) { listBoxThread.Items.Add(tbl.mThreadList[i++, 0]); } listBoxThread.SelectedIndex = 0; // выделяем первую строку в listBoxThread // // Добавление лебелов lblOnPic на пикчебокс формы !!! // this.pictureBox2.Controls.AddRange(new System.Windows.Forms.Control[] { this.onPic_A, this.onPic_E, this.onPic_S, this.onPic_S1 } ); // // Tip1 // Tip1 = new ToolTip(); Tip1.InitialDelay = 600; Tip1.ToolTipIcon = ToolTipIcon.Info; Tip1.ToolTipTitle = "Just Do It !"; Tip1.SetToolTip(this.aLabel1, "Click LEFT button to copy\ndiameter into The Clipboard."); Tip1.IsBalloon = true; // инициализация listBoxPitch происходит в listBoxPitch_SelectedIndexChanged() // // HelpProvider // hlP1 = new HelpProvider(); hlP1.SetShowHelp(this, true); hlpFile = this.Text + ".txt"; hlP1.HelpNamespace = hlpFile; // "Thread solution.txt" // this.hlP1.SetShowHelp(this.checkBoxShowForm2, true); // this.hlP1.SetHelpString(this.checkBoxShowForm2, "Press for stress solution"); } // завершение КОНСТРУКТОР of - CLASS FORM1 : FORM !!!
private void RealizarRestore_Load(object sender, EventArgs e) { ToolTip toolTip1 = new ToolTip(); toolTip1.AutoPopDelay = 5000; toolTip1.InitialDelay = 500; toolTip1.ReshowDelay = 500; toolTip1.ShowAlways = true; toolTip1.SetToolTip(this.seleccionarArchivo, Genesis.Recursos_localizables.StringResources.SeleccionarArchivoTooltip); toolTip1.SetToolTip(this.importarButton, Genesis.Recursos_localizables.StringResources.ImportarButtonTooltip); System.Windows.Forms.HelpProvider helpProvider1 = new HelpProvider(); var applicationFolder = Application.StartupPath + "\\Benefix_mu.chm"; helpProvider1.HelpNamespace = applicationFolder; helpProvider1.SetHelpNavigator(this, System.Windows.Forms.HelpNavigator.Topic); helpProvider1.SetShowHelp(this, true); helpProvider1.SetHelpKeyword(this, "25_Realizarrestore.htm"); }
protected override void OnClosing(CancelEventArgs e) { this._settings["SearchWindowLocation"] = this.Location; // save replace mode size, since we will shink the size next time findOnly is set. this._settings["SearchSize"] = this.ClientSize; this._settings["FindMode"] = this._findOnly; this._settings["SearchXPath"] = this.checkBoxXPath.Checked; this._settings["SearchWholeWord"] = this.checkBoxWholeWord.Checked; this._settings["SearchRegex"] = this.checkBoxRegex.Checked; this._settings["SearchMatchCase"] = this.checkBoxMatchCase.Checked; HelpProvider hp = this.Site.GetService(typeof(HelpProvider)) as HelpProvider; if (hp != null && Utilities.DynamicHelpEnabled) { hp.HelpNamespace = Utilities.DefaultHelp; } base.OnClosing(e); }
private void CommandBinding_Executed(object sender, ExecutedRoutedEventArgs e) { int indeks = 0; for (int i = 0; i < Application.Current.Windows.Count; i++) { if (Application.Current.Windows[i].Title.Equals("Add Software")) { indeks = i; } } IInputElement focusedControl = FocusManager.GetFocusedElement(Application.Current.Windows[indeks]); if (focusedControl is DependencyObject) { string str = HelpProvider.GetHelpKey((DependencyObject)focusedControl); HelpProvider.ShowHelp(str, this); } }
public RForm(int TestID, int HumanID, pBaseEntities ge, fBaseEntities fe) { InitializeComponent(); _ge = ge; _fe = fe; _testid = TestID; _humanid = HumanID; _sm = new ScanerManager(_ge, new WinFormsWindowMessageHook(this)); RemarkToolTip = new ToolTip(); RemarkToolTip.ToolTipIcon = ToolTipIcon.Info; RemarkToolTip.ToolTipTitle = "Вопрос:"; RemarkToolTip.IsBalloon = true; HelpProvider help = new HelpProvider(); help.HelpNamespace = "Recog_help.chm"; help.SetHelpNavigator(this, HelpNavigator.Topic); help.SetHelpKeyword(this, "test_blank.htm"); }
private void Init( ) { try { _helpProvider = new HelpProvider( ); __LoadingDataSetState = new ClientQueryDataSet( ); _buttonsFeatures.Add(UIElementKeys.MediaBurningManagerView, MediaBurningButton); _buttonsFeatures.Add(UIElementKeys.QueueManager, QueueManagerButton); _buttonsFeatures.Add(UIElementKeys.SearchStudies, SearchButton); _buttonsFeatures.Add(UIElementKeys.StorageListenerService, StorageServiceButton); _buttonsFeatures.Add(UIElementKeys.UsersAccounts, UserAccessButton); _buttonsFeatures.Add(UIElementKeys.WorkstationConfiguration, WorkstationConfigurationButton); _buttonsFeatures.Add(UIElementKeys.WorkstationViewer, WorkstationViewerButton); } catch (Exception) { throw; } }
static void Main(string[] args) { var model = Args.Configuration.Configure <ArgumentsModel>(); var command = model.CreateAndBind(args); if (command.Help) { var help = new HelpProvider().GenerateModelHelp(model); var cfmt = new ConsoleHelpFormatter(); Console.WriteLine(cfmt.GetHelp(help)); return; } var context = new InformationSchemaDbContext(); foreach (Table table in context.Set <Table>()) { Console.WriteLine($"{table.Catalog}.{table.Schema}.{table.Name}"); } }
private void LokalInput_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) { if (e.Key == Key.Escape) { MainWindow w = this.Owner as MainWindow; if (w.cts != null) { w.cts.Cancel(); w.cts = null; w.WindowBorder.BorderThickness = w.windowThickness; w.WindowBorder.BorderBrush = w.windowBrush; w.demopopup.IsOpen = false; } (this as Window).Close(); } else if (e.Key == Key.F1) { HelpProvider.ShowHelp("NoviLokal", this); } }
// Token: 0x060001CF RID: 463 RVA: 0x0000A9E0 File Offset: 0x00008BE0 public SetupWizard(SetupBase theApp, bool updates, bool isExchangeInstalled) { base.Name = "SetupWizard"; this.Text = Strings.SetupWizardCaption; this.InitializeComponent(); base.SetBtnNextText(Strings.btnNext); base.SetBtnPreviousText(Strings.btnPrevious); base.SetCancelMessageBoxMessage(Strings.CancelMessageBoxMessage); base.SetPrintErrorMessageBoxMessage(Strings.SetupFailedPrintDocument); base.SetBrowserLaunchErrorMessage(Strings.BrowserLaunchError); int num = 23; if (num > 0) { base.SetExchangeServerLabel(Strings.MESICumulativeUpdate(Strings.MicrosoftExchangeServer, num)); } else { base.SetExchangeServerLabel(Strings.MESI(Strings.MicrosoftExchangeServer)); } HelpProvider.Initialize(HelpProvider.HelpAppName.Setup); base.HelpUrlGenerator = this; SetupWizard.IsPartiallyConfigured = this.IsRolesPartiallyConfigured(isExchangeInstalled); if (SetupWizard.IsPartiallyConfigured && ((SetupOperations)theApp.ParsedArguments["mode"] == SetupOperations.Install || (SetupOperations)theApp.ParsedArguments["mode"] == SetupOperations.Upgrade)) { SetupWizard.PopulateWizard(base.Pages, theApp); return; } if (theApp.ParsedArguments.ContainsKey("mode") && (((SetupOperations)theApp.ParsedArguments["mode"] == SetupOperations.Install && !isExchangeInstalled) || (SetupOperations)theApp.ParsedArguments["mode"] == SetupOperations.Upgrade)) { if (updates) { base.Pages.Add(new CheckForUpdatesPage()); base.Pages.Add(new UpdatesDownloadsPage(theApp)); } base.Pages.Add(new CopyFilesPage(theApp)); base.Pages.Add(new InitializingSetupPage(base.Pages, theApp)); return; } SetupWizard.PopulateWizard(base.Pages, theApp); }
public EditMorphBreaksDlg(IHelpTopicProvider helpTopicProvider) { m_helpTopicProvider = helpTopicProvider; // // Required for Windows Form Designer support // InitializeComponent(); AccessibleNameCreator.AddNames(this); AccessibleName = GetType().Name; if (!Application.RenderWithVisualStyles) { m_txtMorphs.BorderStyle = BorderStyle.FixedSingle; } m_helpProvider = new HelpProvider { HelpNamespace = helpTopicProvider.HelpFile }; m_helpProvider.SetHelpKeyword(this, helpTopicProvider.GetHelpString(ksHelpTopic)); m_helpProvider.SetHelpNavigator(this, HelpNavigator.Topic); }
public EMSLoadFlowReportView(IShellView shellView) { InitializeComponent(); SetHeader(); InitSummaryConfig(null, new ReportDocumentConfig(SummaryType.BaseSummary, PersistFilterMode.PersistFilters, null, true, true)); HelpProvider.SetContextHelpId(this, "EMSLoadFlow Report"); this.shellView = shellView; this.reportViewModel = new EMSLoadFlowReportViewModel(this); moduleEnvironment = ServiceLocator.Current.GetInstance <IModuleEnvironment>(); DataContext = reportViewModel; tabControl.SelectionChanged += TabControl_SelectionChanged; ShuntTabControl.SelectionChanged += ShuntTabControl_SelectionChanged; CommonHtv.SelectedItemChanged += HTV_SelectedItemChanged; CommonHtv.ExpandedCollapsed += HTV_SelectedItemChanged; Title = "EMSLoadFlow Report"; InfoTip = "EMSLoadFlow Report"; this.workspaceManager = moduleEnvironment.WorkspaceManager; }
public void HelpProvider_SetHelpKeyword_WithShowHelpFalse_ReturnsExpected(string keyword, int expectedHelpTopic, string expectedFileName) { using var provider = new HelpProvider { HelpNamespace = "HelpNamespace" }; using var control = new Control(); provider.SetShowHelp(control, false); provider.SetHelpKeyword(control, keyword); Assert.Same(keyword, provider.GetHelpKeyword(control)); Assert.Equal(!string.IsNullOrEmpty(keyword), provider.GetShowHelp(control)); Assert.Equal(expectedHelpTopic, control.AccessibilityObject.GetHelpTopic(out string fileName)); Assert.Equal(expectedFileName, fileName); // Set same. provider.SetHelpKeyword(control, keyword); Assert.Same(keyword, provider.GetHelpKeyword(control)); Assert.Equal(!string.IsNullOrEmpty(keyword), provider.GetShowHelp(control)); Assert.Equal(expectedFileName, fileName); }
private static void ShowHelp(IModelBindingDefinition<GitReleaseNotesArguments> modelBindingDefinition, string reason = null) { var help = new HelpProvider().GenerateModelHelp(modelBindingDefinition); var f = new ConsoleHelpFormatter(); f.WriteHelp(help, Console.Out); if (reason != null) { Console.WriteLine(); Console.WriteLine(reason); } }
static int Main(string[] args) { var modelBindingDefinition = Args.Configuration.Configure<GitReleaseNotesArguments>(); if (args.Any(a => a == "/?")) { var help = new HelpProvider().GenerateModelHelp(modelBindingDefinition); var f = new ConsoleHelpFormatter(); f.WriteHelp(help, Console.Out); return 0; } var arguments = modelBindingDefinition.CreateAndBind(args); if (arguments.IssueTracker == null) { Console.WriteLine("The IssueTracker argument must be provided, see help (/?) for possible options"); return 1; } if (string.IsNullOrEmpty(arguments.OutputFile) || !arguments.OutputFile.EndsWith(".md")) { Console.WriteLine("Specify an output file (*.md)"); return 1; } CreateIssueTrackers(arguments); var issueTracker = IssueTrackers[arguments.IssueTracker.Value]; if (!issueTracker.VerifyArgumentsAndWriteErrorsToConsole(arguments)) return 1; var workingDirectory = arguments.WorkingDirectory ?? Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); var gitDirectory = GitDirFinder.TreeWalkForGitDir(workingDirectory); if (string.IsNullOrEmpty(gitDirectory)) { throw new Exception("Failed to find .git directory."); } Console.WriteLine("Git directory found at {0}", gitDirectory); var repositoryRoot = Directory.GetParent(gitDirectory).FullName; var gitHelper = new GitHelper(); var gitRepo = new Repository(gitDirectory); var taggedCommitFinder = new TaggedCommitFinder(gitRepo, gitHelper); var tagToStartFrom = string.IsNullOrEmpty(arguments.FromTag) ? taggedCommitFinder.GetLastTaggedCommit() : taggedCommitFinder.GetTag(arguments.FromTag); var commitsToScan = gitRepo.Commits.TakeWhile(c => c != tagToStartFrom.Commit).ToArray(); if (arguments.Verbose) { Console.WriteLine("Scanning the following commits for issue numbers"); foreach (var commit in commitsToScan) { Console.WriteLine(commit.Message); } } var releaseNotes = issueTracker.ScanCommitMessagesForReleaseNotes(arguments, commitsToScan); new ReleaseNotesWriter(new FileSystem(), repositoryRoot).WriteReleaseNotes(arguments, releaseNotes); return 0; }
/// <summary> /// The main. /// </summary> /// <param name="args"> /// The args. /// </param> private static void Main(string[] args) { Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine(new string('*', 60)); Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine("Exclude Me! Copy - Copyright 2013 Jaben Cargman"); Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine(new string('*', 60)); Console.ResetColor(); try { var definition = Configuration.Configure<CopyArguments>(); CopyArguments copy = null; try { copy = definition.CreateAndBind(args); } catch { var help = new HelpProvider().GenerateModelHelp(definition); var f = new ConsoleHelpFormatter(80, 1, 5); f.WriteHelp(help, Console.Error); return; } var excludeLike = new HashSet<string>(); if (copy.IgnoreFile.IsSet()) { Console.WriteLine(@" - Loading Ignore File ""{0}""...", copy.IgnoreFile); foreach (var line in File.ReadAllLines(copy.IgnoreFile).Where(x => x.IsSet())) { excludeLike.Add(line); } } if (copy.Exclusions != null) { foreach (var line in copy.Exclusions.Where(x => x.IsSet())) { excludeLike.Add(line); } } if (!Path.IsPathRooted(copy.SourceDirectory)) { copy.SourceDirectory = Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, copy.SourceDirectory)); } if (!Path.IsPathRooted(copy.DestinationDirectory)) { copy.DestinationDirectory = Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, copy.DestinationDirectory)); } Console.WriteLine(@" - Source Directory is ""{0}""", copy.SourceDirectory); Console.WriteLine(@" - Destination Directory is ""{0}""", copy.DestinationDirectory); Console.WriteLine(@" - Directory Recursion is {0}", copy.Recurse ? "ON" : "OFF"); if (!Directory.Exists(copy.SourceDirectory)) { Console.Beep(); Console.Error.WriteLine(@" ! Failure: Source directory ""{0}"" does not exist!", copy.SourceDirectory); Console.WriteLine(); return; } Console.WriteLine(); bool isCancelled = false; Console.CancelKeyPress += (sender, eventArgs) => { isCancelled = true; }; var cancelSource = new CancellationTokenSource(); var cancellationToken = cancelSource.Token; Task<int> copyTask = Task.Factory.StartNew(() => CopyStructure(copy, excludeLike.ToList(), token: cancellationToken), cancellationToken); while (!(copyTask.IsCompleted || copyTask.IsCanceled || copyTask.IsFaulted)) { if (isCancelled) { Console.WriteLine(" * Control-C Pressed. Cancelling!"); cancelSource.Cancel(); } Thread.Sleep(50); } if (copyTask.Result > 0) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(); Console.WriteLine(@" * {0} File(s) Copied!", copyTask.Result); } } catch (Exception ex) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("!! Exception: " + ex); } finally { Console.ResetColor(); } Console.WriteLine(); Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine(new string('*', 60)); Console.ResetColor(); }
private static void ShowHelp(IModelBindingDefinition<GitReleaseNotesArguments> modelBindingDefinition, string reason = null) { var help = new HelpProvider().GenerateModelHelp(modelBindingDefinition); var bufferWidth = Console.IsOutputRedirected ? 80 : Console.BufferWidth; var f = new ConsoleHelpFormatter(bufferWidth, 1, 5); f.WriteHelp(help, Console.Out); if (reason != null) { Console.WriteLine(); Console.WriteLine(reason); } }
public static void WriteHelp() { var help = new HelpProvider().GenerateModelHelp(Configuration.Configure<Arguments>()); var f = new ConsoleHelpFormatter(Console.BufferWidth, 1, 5); Console.WriteLine(f.GetHelp(help)); }
internal static void Main(string[] args) { try { // Expand first and then bind to Args var expanded = args.Select(a => parser.ParseArguments(a)).ToArray(); var config = Args.Configuration.Configure<CommandArgs>(); var cmds = config.AsFluent() .UsingStringComparer(StringComparer.InvariantCultureIgnoreCase) .UsingSwitchDelimiter("/") .Initialize() .CreateAndBind(expanded); if (args.Length < 1 || args.Length == 1 && cmds.ShowHelp) { var help = new HelpProvider(); var commandsHelp = help.GenerateModelHelp<CommandArgs>(config); var formatter = new Args.Help.Formatters.ConsoleHelpFormatter(); formatter.WriteHelp(commandsHelp, Console.Out); return; } // TODO: Research for a better way to validate parameters with Args try { ValidateArgs(cmds); } catch (Exception ex) { Console.WriteLine(ex.Message); Console.WriteLine(); Console.WriteLine("Try bootstrapper -help for more information"); } //simple mapping var bootArgs = new BootStrapperArgs { Args = cmds.Args, Block = cmds.Block, EnableSystemProfile = cmds.EnableSystemProfile, Get = cmds.Get, LocalResource = cmds.LocalResource, Overwrite = cmds.Overwrite, Put = cmds.Put, Run = cmds.Run, RunAlways = cmds.RunAlways, StorageConnection = cmds.StorageConnection, Unzip = !String.IsNullOrWhiteSpace(cmds.Unzip), UnzipTarget = cmds.Unzip }; //default to trace logger var logger = new TraceLogger(); var manager = new BootStrapperManager(logger, new PackageDownloader(logger), new PackageRunner(logger), new PackageUnzipper(logger), new PackageUploader(logger), new PackageZipper(logger)); manager.Start(bootArgs); } catch (Exception ex) { Console.WriteLine(ex.ToString()); // TODO: Push error to blob storage? } }
private static void OutputHelp(IModelBindingDefinition<ProgramOptions> configuration) { var help = new HelpProvider(); var helpProvider = help.GenerateModelHelp(configuration); var consoleFormatter = new ConsoleHelpFormatter(80, 1, 5); Console.WriteLine(consoleFormatter.GetHelp(helpProvider)); }
private static void ShowHelp(IModelBindingDefinition<Options> argsConfig) { var helpProvider = new HelpProvider(); var help = helpProvider.GenerateModelHelp(argsConfig); var helpFormatter = new ConsoleHelpFormatter(); Console.WriteLine(helpFormatter.GetHelp(help)); Console.ReadKey(); }
private static int GenerateReleaseNotes(string[] args) { var modelBindingDefinition = Args.Configuration.Configure<GitReleaseNotesArguments>(); if (args.Any(a => a == "/?" || a == "?" || a.Equals("/help", StringComparison.InvariantCultureIgnoreCase))) { var help = new HelpProvider().GenerateModelHelp(modelBindingDefinition); var f = new ConsoleHelpFormatter(); f.WriteHelp(help, Console.Out); return 0; } var arguments = modelBindingDefinition.CreateAndBind(args); if (!ArgumentVerifier.VerifyArguments(arguments)) { return 1; } var workingDirectory = arguments.WorkingDirectory ?? Directory.GetCurrentDirectory(); var gitDirectory = GitDirFinder.TreeWalkForGitDir(workingDirectory); if (string.IsNullOrEmpty(gitDirectory)) { throw new Exception("Failed to find .git directory."); } Console.WriteLine("Git directory found at {0}", gitDirectory); var repositoryRoot = Directory.GetParent(gitDirectory).FullName; var gitRepo = new Repository(gitDirectory); CreateIssueTrackers(gitRepo, arguments); IIssueTracker issueTracker = null; if (arguments.IssueTracker == null) { var firstOrDefault = _issueTrackers.FirstOrDefault(i => i.Value.RemotePresentWhichMatches); if (firstOrDefault.Value != null) issueTracker = firstOrDefault.Value; } if (issueTracker == null) { if (!_issueTrackers.ContainsKey(arguments.IssueTracker.Value)) throw new Exception(string.Format("{0} is not a known issue tracker", arguments.IssueTracker.Value)); issueTracker = _issueTrackers[arguments.IssueTracker.Value]; } if (!issueTracker.VerifyArgumentsAndWriteErrorsToConsole()) { return 1; } var fileSystem = new FileSystem.FileSystem(); var releaseFileWriter = new ReleaseFileWriter(fileSystem); string outputFile = null; var previousReleaseNotes = new SemanticReleaseNotes(); if (!string.IsNullOrEmpty(arguments.OutputFile)) { outputFile = Path.IsPathRooted(arguments.OutputFile) ? arguments.OutputFile : Path.Combine(repositoryRoot, arguments.OutputFile); previousReleaseNotes = new ReleaseNotesFileReader(fileSystem, repositoryRoot).ReadPreviousReleaseNotes(outputFile); } var categories = arguments.Categories == null ? Categories : Categories.Concat(arguments.Categories.Split(',')).ToArray(); TaggedCommit tagToStartFrom = arguments.AllTags ? GitRepositoryInfoFinder.GetFirstCommit(gitRepo) : GitRepositoryInfoFinder.GetLastTaggedCommit(gitRepo) ?? GitRepositoryInfoFinder.GetFirstCommit(gitRepo); var currentReleaseInfo = GitRepositoryInfoFinder.GetCurrentReleaseInfo(gitRepo); if (!string.IsNullOrEmpty(arguments.Version)) { currentReleaseInfo.Name = arguments.Version; currentReleaseInfo.When = DateTimeOffset.Now; } var releaseNotes = ReleaseNotesGenerator.GenerateReleaseNotes( gitRepo, issueTracker, previousReleaseNotes, categories, tagToStartFrom, currentReleaseInfo, issueTracker.DiffUrlFormat); var releaseNotesOutput = releaseNotes.ToString(); releaseFileWriter.OutputReleaseNotesFile(releaseNotesOutput, outputFile); PublishReleaseIfNeeded(releaseNotesOutput, arguments, issueTracker); return 0; }