Exemplo n.º 1
0
 private Task <byte[]> OnListen(MethodCall call)
 {
     if (_activeSink != null)
     {
         try
         {
             _handler.OnCancel(null);
         }
         catch (Exception e)
         {
             TizenLog.Error($"{_channel.Name}: Failed to close existing event stream. {e.Message}");
         }
     }
     try
     {
         _activeSink = new EventSinkImpl(this);
         _handler.OnListen(call.Arguments, _activeSink);
         return(Task.FromResult(_channel.Codec.EncodeSuccessEnvelope(null)));
     }
     catch (Exception e)
     {
         _activeSink = null;
         TizenLog.Error($"{_channel.Name}: Failed to open event stream. {e.Message}");
         return(Task.FromResult(_channel.Codec.EncodeErrorEnvelope("error", e.Message, null)));
     }
 }
Exemplo n.º 2
0
        public override void Run(string[] args)
        {
            // Log any unhandled exception.
            AppDomain.CurrentDomain.UnhandledException += (s, e) =>
            {
                var exception = e.ExceptionObject as Exception;
                TizenLog.Error($"Unhandled exception: {exception}");
            };

            base.Run(args);
        }
Exemplo n.º 3
0
 private Task <byte[]> OnCancel(MethodCall call)
 {
     if (_activeSink != null)
     {
         try
         {
             _handler.OnCancel(call.Arguments);
             return(Task.FromResult(_channel.Codec.EncodeSuccessEnvelope(null)));
         }
         catch (Exception e)
         {
             TizenLog.Error($"{_channel.Name}: Failed to close event stream. {e.Message}");
             return(Task.FromResult(_channel.Codec.EncodeErrorEnvelope("error", e.Message, null)));
         }
     }
     else
     {
         return(Task.FromResult(_channel.Codec.EncodeErrorEnvelope("error", "No active stream to cancel.", null)));
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Reads engine arguments passed from the flutter-tizen tool and adds to <paramref name="list"/>.
        /// </summary>
        public static void ParseEngineArgs(IList <string> list)
        {
            string appId    = Application.Current.ApplicationInfo.ApplicationId;
            string tempPath = $"/home/owner/share/tmp/sdk_tools/{appId}.rpm";

            if (!File.Exists(tempPath))
            {
                return;
            }
            try
            {
                var lines = File.ReadAllText(tempPath).Trim().Split('\n');
                foreach (string line in lines)
                {
                    TizenLog.Info($"Enabled: {line}");
                    list.Add(line);
                }
                File.Delete(tempPath);
            }
            catch (Exception ex)
            {
                TizenLog.Warn($"Error while processing a file: {ex}");
            }
        }