You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the delegate must always have a sender parameter containing a reference to the object that triggered the event
The name of the delegate must end with the prefix EventHandler
The name of the event associated with the delegate must repeat the name of the delegate with the prefix Raise added at the beginning. From the EventHandler prefix from the delegate name, only Event should remain. For an example, see the section "IExampleInterface"
Events must be located in the Events region and follow immediately after the interface is declared
Specifying the scope of any interface entity is mandatory
Events in class
They must be located in the Events region and located above the constructor and the closed entities of the class
Before calling the event, it should be copied and then called from the copy. The event call follows from methods marked as protected and virtual. The naming order of such methods is: the name of the event with the addition of the prefix On.
Example:
Such methods should be located in the OnRaise events region at the bottom of the class.
Event handler methods must be located in the Events method region below the private methods of the class
Subscribing and unsubscribing from events
Subscribing and unsubscribing from events must occur in the private Subscribe and Unsubscribe methods and be located in the Subscription region
The Subscription region must be below the private methods of the class
Constructors
The constructors of the class must be located in the region ~
The order of assigning values to variables and fields of a class:
1. private service variables assigning
2. public delegate command new instance assigning
3. event handler assigning
Constans
All constant must be located in the Const region and it is located above the public constructor of the class, below the regions with public entities of the class
Constant names must begin with the prefix c
An example of the designation of string values of private class fields related to a public property should be assigned using constants:
The DelegateCommand declaration must be above the class constructor and located in region DelegateCommands
DelegateCommand must be public to read only fields, with implementation in the class constructor
The DelegateCommand name must contain the DelegateCommand at the end. For example: OpenWindowDelegateCommand
All new DelegateCommand instances must implement two methods: the one executed when the command is invoked and whether the command can be executed. The name of the methods is based on the following principle:
All methods must be located in the Delegatecommand methods region
Services
All services must be private class variables, assigned a value in constructor, i.e. readonly
All services variables must be located in the Services region, which should be below regions with public fields or methods
Public and private fields
All public fields must be located in the Public fields region, which should be located immediately after the public constructor
The private fields of the class must be located directly after the area of the open fields of the class or the constructor of the class, if there are no open fields in the Private fields region
It is allowed to place a private class field related to a public property above this property. The name of such a field should repeat the name of the public property, with a small letter. Example:
String values of class private fields related to a public property must be assigned using constants. For an example of the name assignment, see Constant
Public and private methods
Must be located in the Public methods and Private methods regions
Principles of project architecture design
IDisposableinterfaceDisposemethods of services must explicitly occur inApp.xaml.csGeneral remarks
varis allowed, but should not be preferredDelegate and event
DelegateregionEventHandlerRaiseadded at the beginning. From theEventHandlerprefix from the delegate name, onlyEventshould remain. For an example, see the section "IExampleInterface"Eventsregion and follow immediately after the interface is declaredEventsregion and located above the constructor and the closed entities of the classOn.Example:
OnRaise eventsregion at the bottom of the class.Events methodregion below the private methods of the classSubscribeandUnsubscribemethods and be located in theSubscriptionregionSubscriptionregion must be below the private methods of the classConstructors
~Constans
Constregion and it is located above the public constructor of the class, below the regions with public entities of the classcDelegate Command
DelegateCommandsDelegatecommand methodsregionServices
Servicesregion, which should be below regions with public fields or methodsPublic and private fields
Public fieldsregion, which should be located immediately after the public constructorPrivate fieldsregionConstantPublic and private methods
Public methodsandPrivate methodsregions