5.1. SMCloudServices¶
Provides the function of SMCS service
Method
Name
Contents
It displays a view of the Star Micronics Cloud registration.
Checks whether the application is registered with the Star Micronics Cloud.
Sets the location to save the Star Micronics Cloud registration information.
Gets the location to save the Star Micronics Cloud registration information.
Gets the SMCloudServicesSolution library version.
Event
Name
Contents
Occurs when a view of Star Micronics Cloud registration is closed.
Important
Before using the SMCloudServices class methods, be sure to execute the SetRegistrationConfigFilePath method and check that the location to save the Star Micronics Cloud registration information has been set correctly.
Important
Delete the Star Micronics Cloud registration information when the application is uninstalled. After deleting, if Star Micronics Cloud will be used again, use the SetRegistrationConfigFilePath method and create the file save location.
5.1.1. ShowRegistrationView¶
It displays a view of the Star Micronics Cloud registration.
Declaration
public void ShowRegistrationView() public void ShowRegistrationView(Window ownerWindow)
Parameter
Name Contents Type ownerWindow Parent window class that displays the Star Micronics Cloud registration view System.Windows.Window Return value
None
Class | Contents |
---|---|
InvalidOperationException | Occurs when this method was executed before the location to save Star Micronics Cloud registration information was correctly set with the SetRegistrationConfigFilePath method. |
Examples
public static void ShowAllReceiptsRegistrationView() { SMCloudServices.SetRegistrationConfigFilePath(path); Window ownerWindow = Util.GetMainWindow(); SMCloudServices.ShowRegistrationView(ownerWindow); // SMCloudServices.ShowRegistrationView(); }
Refer to AllReceiptSamplePage.xaml.cs.
5.1.2. IsRegistered¶
Checks whether the application is registered with the Star Micronics Cloud.
Declaration
public static bool IsRegistered()
Parameter
None
Return value
Contents Type Resulttrue … Registeredfalse … Unregisteredbool
Examples
private static bool CheckIsDeviceRegisteredInStarCloudServices() { SMCloudServices.SetRegistrationConfigFilePath(@"C:\Users\user\AppData\Roaming\StarMicronics"); return SMCloudServices.IsRegistered(); }
Refer to AllReceiptSamplePage.xaml.cs.
5.1.3. SetRegistrationConfigFilePath¶
Sets the location to save the Star Micronics Cloud registration information.
Declaration
public static bool SetRegistrationConfigFilePath(string path)
Parameter
Name Contents Type path Location to save the Star Micronics Cloud registration information. string Return value
Contents Type true … Successfalse … Failurebool Examples
private static bool CheckIsDeviceRegisteredInStarCloudServices() { SMCloudServices.SetRegistrationConfigFilePath(@"C:\Users\user\AppData\Roaming\StarMicronics"); return SMCloudServices.IsRegistered(); }
Refer to AllReceiptsExtSamplePage.xaml.cs.
5.1.4. GetRegistrationConfigFilePath¶
Gets the location to save the Star Micronics Cloud registration information.
Declaration
public static string GetRegistrationConfigFilePath()
Parameter
None
Return value
Contents Type Location to save the Star Micronics Cloud registration information. string Examples
public static void DeleteRegistrationConfigFile() { string registratioConfignFilePath = SMCloudServices.GetRegistrationConfigFilePath(); try { File.Delete(registratioConfignFilePath); } catch (Exception) {} }
Refer to AllReceiptsExtSamplePage.xaml.cs.
5.1.5. GetSMCloudServicesVersion¶
Gets the SMCloudServicesSolution library version.
Declaration
public static string GetSMCloudServicesVersion()
Parameter
None
Return value
Contents Type SMCloudServicesSolution library version. string Examples
public static void ShowLibraryVersion() { string starIOVersion = GetStarIOVersion(); string starIOExtVersion = GetStarIOExtVersion(); string smCoudServicesVersion = GetSMCloudServicesVersion(); }
Refer to MainPage.xaml.cs.
5.1.6. RegisteredEvent¶
Occurs when a view of Star Micronics Cloud registration is closed.
Declaration
public static event EventHandler<RegisteredResult> RegisterEvent
Examples
public static void AddAllReceiptsFunctionEvent() { SMCloudServices.RegisteredEvent += AllReceiptsFunctions.SMCloudServices_RegisterResultEvent; } public static void SMCloudServices_RegisterResultEvent(object sender, RegisteredResult e) { bool isRegistered = e.IsRegistered; }
Refer to AllReceiptSamplePage.xaml.cs / AllReceiptsFunction.cs.
5.2. RegisteredResult¶
Class to get registration result
Declaration
public class RegisteredResult : EventArgs
Constructor
None
Property
Name Contents IsRegistered Gets the registration result of Star Micronics Cloud.
5.2.1. IsRegistered¶
Gets the registration result of Star Micronics Cloud.
Declaration
public bool IsRegistered { get; }