public sealed class CommandLineArgumentsNotifier : INotifyPropertyChanged
Public NotInheritable Class CommandLineArgumentsNotifier
Implements INotifyPropertyChanged
Dim instance As CommandLineArgumentsNotifier
public ref class CommandLineArgumentsNotifier sealed : INotifyPropertyChanged
[<SealedAttribute>]
type CommandLineArgumentsNotifier =
class
interface INotifyPropertyChanged
end
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
' ----------------------------------------------------------------------------------------------------
' ApplicationEvents.vb
' ----------------------------------------------------------------------------------------------------
Imports Microsoft.VisualBasic.ApplicationServices
Namespace My
Partial Friend Class MyApplication
''' <summary>
''' The <see cref="CommandLineArgumentsNotifier"/>.
''' </summary>
Public Shared Notifier As CommandLineArgumentsNotifier
''' <summary>
''' Handles the <see cref="WindowsFormsApplicationBase.StartupNextInstance"/> event of <see cref="MyApplication"/>.
''' </summary>
''' <param name="sender">
''' The source of the event.
''' </param>
''' <param name="e">
''' The <see cref="StartupNextInstanceEventArgs"/> instance containing the event data.
''' </param>
Public Sub MyApplication_StartupNextInstance(sender As Object, e As StartupNextInstanceEventArgs) Handles Me.StartupNextInstance
' If there are new command-line arguments, notify them.
If (e.CommandLine.Any()) Then
My.MyApplication.Notifier.Arguments = e.CommandLine
End If
End Sub
End Class
End Namespace
' ----------------------------------------------------------------------------------------------------
' Form1.vb
' ----------------------------------------------------------------------------------------------------
Imports System.Collections.ObjectModel
Public Class Form1
Public Sub New()
MyClass.InitializeComponent()
' Associate the event before creating the instance, because we want to notify the current arguments of the application.
AddHandler CommandLineArgumentsNotifier.ArgumentsReceived, AddressOf Me.CommandLineArgumentsNotifier_ArgumentsReceived
' Create an instance of CommandLineArgumentsNotifier and notify the current arguments of the application.
My.MyApplication.Notifier = New CommandLineArgumentsNotifier(notifyCurrentArguments:=True)
End Sub
''' <summary>
''' Handles the <see cref="CommandLineArgumentsNotifier.ArgumentsReceived"/> event of <see cref="My.MyApplication.Notifier"/>.
''' </summary>
''' <param name="sender">
''' The source of the event.
''' </param>
''' <param name="e">
''' The <see cref="CommandLineArgumentsEventArgs"/> instance containing the event data.
''' </param>
Public Sub CommandLineArgumentsNotifier_ArgumentsReceived(sender As Object, e As CommandLineArgumentsEventArgs)
' In this example we add the new received command-line arguments to a existing ListBox control.
Me.ListBox1.Items.AddRange(e.Arguments.ToArray())
End Sub
End Class
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
CommandLineArgumentsNotifier | Initializes a new instance of the CommandLineArgumentsNotifier class. |
Arguments | Gets or sets the command-line arguments of the current application. |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object) |
GetHashCode | Serves as the default hash function. (Inherited from Object) |
GetType | Gets the Type of the current instance. (Inherited from Object) |
ToString | Returns a string that represents the current object. (Inherited from Object) |
ArgumentsReceived | Occurs when the application receives new command-line arguments. |
CanConvertTo |
Determines whether the source object can be converted to the specified target type.
(Defined by ObjectExtensions) |
CanConvertToT |
Determines whether the source object can be converted to the specified target type.
(Defined by ObjectExtensions) |
ConvertToT |
Converts an object to the specified target type.
If the conversion fails, an exception is thrown.
(Defined by ObjectExtensions) |
ConvertToT |
Converts an object to the specified target type.
If the conversion fails, returns the specified default value.
(Defined by ObjectExtensions) |
IsDisposable |
Determines whether the specified object is a disposable type
(i.e., it implements IDisposable interface).
(Defined by ObjectExtensions) |
Speak |
Speaks the string representation of the source object by using the
operating system integrated text-to-speech synthesizer.
(Defined by ObjectExtensions) |
Speak |
Speaks the string representation of the source object by using the
operating system integrated text-to-speech synthesizer.
(Defined by ObjectExtensions) |
ThrowIfNullTException |
Throws the specified exception if the source object is null.
(Defined by ObjectExtensions) |