コード例 #1
0
        public ErrorLogViewModel(ShinySqliteConnection conn,
                                 ISerializer serializer,
                                 IDialogs dialogs) : base(dialogs)
        {
            this.conn       = conn;
            this.serializer = serializer;

            Log
            .WhenExceptionLogged()
            .Select(x => new CommandItem
            {
                Text           = DateTime.Now.ToString(),
                Detail         = x.Exception.ToString(),
                PrimaryCommand = ReactiveCommand.CreateFromTask(async() =>
                {
                    var s = $"{x.Exception}{Environment.NewLine}";
                    foreach (var p in x.Parameters)
                    {
                        s += $"{Environment.NewLine}{p.Key}: {p.Value}";
                    }

                    await this.Dialogs.Alert(s);
                })
            })
            .SubOnMainThread(this.InsertItem)
            .DisposeWith(this.DestroyWith);
        }
コード例 #2
0
 public EventsViewModel(ShinySqliteConnection conn,
                        ISerializer serializer,
                        IDialogs dialogs,
                        INavigationService navigator) : base(dialogs)
 {
     this.conn       = conn;
     this.serializer = serializer;
     this.navigator  = navigator;
 }
コード例 #3
0
ファイル: EventsViewModel.cs プロジェクト: keyhooon/bike
 public EventLogViewModel(
     IUserDialogs dialogs,
     ISerializer serializer,
     ShinySqliteConnection connection) : base(dialogs)
 {
     this.connection = connection;
     this.serializer = serializer;
     Log
     .WhenEventLogged()
     //               .ObserveOn(RxApp.MainThreadScheduler)
     .Select(x => new LogStore
     {
         Description  = x.EventName,
         Detail       = x.Description,
         Parameters   = this.serializer.Serialize(x.Parameters),
         TimestampUtc = DateTime.UtcNow
     }).SubOnMainThread(Add)
     .DisposeWith(DestroyWith);
 }
コード例 #4
0
        public ErrorLogViewModel(
            IUserDialogs dialogs,
            ISerializer serializer,
            ShinySqliteConnection connection) : base(dialogs)
        {
            this.conn       = connection;
            this.serializer = serializer;

            Log
            .WhenExceptionLogged()
            .Select(x => new LogStore
            {
                Description  = x.Exception.ToString(),
                Detail       = string.Empty,
                Parameters   = this.serializer.Serialize(x.Parameters),
                IsError      = true,
                TimestampUtc = DateTime.UtcNow
            })
            .SubOnMainThread(this.Add)
            .DisposeWith(this.DestroyWith);
        }
コード例 #5
0
 public SqliteLogger(LogLevel logLevel, ShinySqliteConnection conn)
 {
     this.configLogLevel = logLevel;
     this.conn           = conn;
 }