コード例 #1
1
 public void Run(IBackgroundTaskInstance taskInstance)
 {
     //
     // TODO: Insert code to start one or more asynchronous methods
     //
     broker = new MqttBroker();
     deferral = taskInstance.GetDeferral();
     taskInstance.Canceled += TaskInstance_Canceled;
     broker.UserAuth = (name, pwd) =>
     {
         return true;//every one can access
     };
     broker.Start();
 }
コード例 #2
0
ファイル: MainPage.xaml.cs プロジェクト: allvie/gnatmq
        public MainPage()
        {
            this.InitializeComponent();

            this.NavigationCacheMode = NavigationCacheMode.Required;

            this.broker = new MqttBroker();
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: allvie/gnatmq
        static void Main(string[] args)
        {
#if TRACE
            //MqttUtility.Trace.TraceLevel = MqttUtility.TraceLevel.Verbose | MqttUtility.TraceLevel.Frame;
            //MqttUtility.Trace.TraceListener = (f, a) => System.Diagnostics.Trace.WriteLine(System.String.Format(f, a));
#endif

            // create and start broker
            MqttBroker broker = new MqttBroker();
            broker.Start();

            Console.ReadLine();

            broker.Stop();
        }
コード例 #4
0
 public bool Connect()
 {
     bool success = false;
     //
     try
     {
         mqttService = new MqttBroker();
         mqttService.Start();
         success = true;
     }
     catch (Exception e)
     {
         Console.WriteLine("MQTT Broker could not be started: " + e.Message);
         Disconnect();
     }
     if (InterfaceModulesChangedAction != null) InterfaceModulesChangedAction(new InterfaceModulesChangedAction() { Domain = this.Domain });
     //
     return success;
 }
コード例 #5
0
 public void Disconnect()
 {
     try
     {
         mqttService.Stop();
     } catch { }
     mqttService = null;
 }
コード例 #6
0
ファイル: MainPage.xaml.cs プロジェクト: allvie/gnatmq
        public MainPage()
        {
            this.InitializeComponent();

            this.broker = new MqttBroker();
        }