5.1. StarNetworkManager

Class to set printer’s network settings.

  • Constructor

    Name

    Contents

    StarNetworkManager

    Creates the instance.

  • Method

    Name

    Contents

    LoadAsync

    Gets the value specified from the printer.

    ApplyAsync

    Set the specified value to the printer.

Supported Method for each models.

Model/Emulation

mC-Print2 mC-Print3
StarPRNT StarPRNT

LoadAsync

ApplyAsync

5.1.1. StarNetworkManager

Creates the instance.

  • Declaration

    public StarNetworkManager(string portName)
    
  • Parameter

    Parameter Contents Type
    portName It is the same as the portName of the ConnectAsync method. string
  • Return value

    Contents Type
    StarNetworkManager object StarNetworkManager

5.1.2. LoadAsync

Gets the value specified from the printer.

  • Declaration

    public IAsyncOperation<StarNetworkSetting> LoadAsync()
    
  • Parameter

    None

  • Return value

    Contents Type
    Network Settings StarNetworkSetting
  • Exception

    Contents Type
    When port open fails
    When an incorrect portName is passed
    when a communication failure occurs
    StarIODeviceSettingException
  • Examples

    private async void LoadButton_Click(object sender, RoutedEventArgs e)
    {
        StarNetworkManager starNetworkManager = new StarNetworkManager(PortName.Text);
        StarNetworkSetting starNetworkSetting = new StarNetworkSetting();
    
        try
        {
            starNetworkSetting = await starNetworkManager.LoadAsync();
        }
        catch (StarIODeviceSettingException ex)
        {
        }
    }
    

    Refer to StarIODeviceSettingSDK.

5.1.3. ApplyAsync

Set the specified value to the printer.

Important

The printer is reset after this method was executed.

  • Declaration

    public IAsyncAction ApplyAsync(StarNetworkSetting setting)
    
  • Parameter

    Name Contents Type
    setting Network Setting Information StarNetworkSetting
  • Return value

    None

  • Exception

    Contents Type
    When port open fails
    When an incorrect portName is passed
    when a communication failure occurs
    StarIODeviceSettingException
  • Examples

    private async void ApplyButton_Click(object sender, RoutedEventArgs e)
    {
        StarNetworkManager starNetworkManager = new StarNetworkManager(PortName.Text);
        StarNetworkSetting starNetworkSetting = new StarNetworkSetting();
    
        //Example) When setting to SteadyLanSetting to "Disable"
        starNetworkSetting.SteadyLan = SteadyLanSetting.Disable;
    
        try
        {
            await starNetworkManager.ApplyAsync(starNetworkSetting);
        }
        catch (StarIODeviceSettingException ex)
        {
        }
    }
    

    Refer to StarIODeviceSettingSDK.