public async Task <bool> Connect(string deviceName) { if (!_bluetoothAdapter.Enable()) { return(false); } try { var device = _bluetoothAdapter.GetRemoteDevice(deviceName); _bluetoothAdapter.CancelDiscovery(); _btSocket = device.CreateRfcommSocketToServiceRecord(MyUuid); await _btSocket.ConnectAsync(); if (_btSocket.IsConnected) { Connected = true; } } catch (Exception ex) { Connected = false; var error = $"Cannot connect to bluetooth device ({deviceName}):, {ex.Message}, {ex.StackTrace}."; Log.Info(_tag, error); } return(Connected); }
protected override async Task startActionAsync() { foreach (var fx in ValidGlyphs.Select(s => GetFeedbackFX(s))) { fx.Play(0.0, true); } if (ValidGlyphs == null || ValidGlyphs.Count == 0) { await Speech.SayAllOf("Casting mistake. You don't know any spells which begin with that sequence of glyphs."); Deactivate(); } Task.Run(async() => { try { await Shaking.AwaitResult(); if (Shaking.AwaitableTask.Status != TaskStatus.RanToCompletion) { return; } abortAction(); Deactivate(); } catch (TaskCanceledException) { Log.Info("Atropos|GlyphCastStage", "Shaking monitor canceled."); } }, StopToken).LaunchAsOrphan(); }
public static void i(string tag, string msg) { if (LOG_ENABLE) { Log.Info(tag, msg); } }
protected override void Write(LogEventInfo logEvent) { var logMessage = this.Layout.Render(logEvent); if (logEvent.Level.Equals(LogLevel.Info)) { Log.Info(logEvent.LoggerName, logMessage); return; } if (logEvent.Level.Equals(LogLevel.Debug)) { Log.Debug(logEvent.LoggerName, logMessage); return; } if (logEvent.Level.Equals(LogLevel.Warn)) { Log.Warn(logEvent.LoggerName, logMessage); return; } if (logEvent.Level.Equals(LogLevel.Error)) { Log.Error(logEvent.LoggerName, logMessage); return; } }
public List <City> selectTableCities() { try { using (var connection = new SQLiteConnection(System.IO.Path.Combine(Folder, "City.db"))) { return(connection.Table <City>().ToList()); } } catch (SQLiteException ex) { Log.Info("SQLIte exception", ex.Message); return(null); } }
public List <Images> SelectTableImagesList(string name) { try { using (var connection = new SQLiteConnection(System.IO.Path.Combine(Folder, "City.db"))) { return(connection.Table <Images>().Where(x => x.PlaceName == name).ToList()); } } catch (SQLiteException ex) { Log.Info("SQLIte exception", ex.Message); return(null); } }
public City selectOneCity(string namePlace) { try { using (var connection = new SQLiteConnection(System.IO.Path.Combine(Folder, "City.db"))) { return(connection.Table <City>().FirstOrDefault(x => x.Name == namePlace)); } } catch (SQLiteException ex) { Log.Info("SQLIte exception", ex.Message); return(null); } }
public void Info(Exception e) { if (!string.IsNullOrEmpty(e.Message)) { AndroidLog.Info(_target, e.Message); } if (!string.IsNullOrEmpty(e.StackTrace)) { AndroidLog.Info(_target, e.StackTrace); } CrashlyticsLog(e); Writer.Write(e); }
public void Info(string i) { if (i == null) { i = _defaultLogString; } AndroidLog.Info(_target, i); CrashlyticsLog(i); if (FileExtensiveLogs) { Writer.Write(i); } }
public List <Place> selectTablePlaceWhere(TitleParent title) { try { using (var connection = new SQLiteConnection(System.IO.Path.Combine(Folder, "City.db"))) { return(connection.Table <Place>().Where(x => x.CityName == title.Title).ToList()); } } catch (SQLiteException ex) { Log.Info("SQLIte exception", ex.Message); return(null); } }
private void UpdateReceivedData(byte[] data) { Log.Info("SerialInputOutputManager", "Received"); // Read {data.Length} bytes:\n var message = IsHex ? $"Hex: {FormatConverter.ByteArrayToHexString(data)}\n解码: {FormatConverter.ByteArrayToString(data)}\n\n" : $"远端: {FormatConverter.ByteArrayToString(data)}\n"; RECEIVED_OUT_PUT.Append(message); _receivedDataCount++; NotifyPropertyChanged(nameof(ReceivedOutPut)); NotifyPropertyChanged(nameof(ReceivedDataCount)); MessagingCenter.Send <object>(this, "DataReceived"); }
public bool InsterIntoTableImage(Images images) { try { using (var connection = new SQLiteConnection(System.IO.Path.Combine(Folder, "City.db"))) { connection.Insert(images); return(true); } } catch (SQLiteException ex) { Log.Info("SQLIte exception", ex.Message); return(false); } }
public bool UpdateTableImages(Images images) { try { using (var connection = new SQLiteConnection(System.IO.Path.Combine(Folder, "City.db"))) { connection.Query <Images>( "UPDATE Images SET PlaceName=? WHERE ID =?", images.PlaceName, images.Id); return(true); } } catch (SQLiteException ex) { Log.Info("SQLIte exception", ex.Message); return(false); } }
public bool CreateDataBase() { try { using (var connection = new SQLiteConnection(System.IO.Path.Combine(Folder, "City.db"))) { connection.CreateTable <City>(); connection.CreateTable <Place>(); connection.CreateTable <Images>(); return(true); } } catch (SQLiteException ex) { Log.Info("SQLIte exception", ex.Message); return(false); } }
public bool DropAllTable() { try { using (var connection = new SQLiteConnection(System.IO.Path.Combine(Folder, "City.db"))) { connection.Query <City>("DROP TABLE CITY"); connection.Query <Place>("DROP TABLE PLACE"); connection.Query <Place>("DROP TABLE IMAGES"); return(true); } } catch (SQLiteException ex) { Log.Info("SQLIte exception", ex.Message); return(false); } }
public bool UpdateTablePlace(Place place) { try { using (var connection = new SQLiteConnection(Path.Combine(Folder, "City.db"))) { connection.Query <Place>( "UPDATE Place SET Name=?,Description=?,Rating=?,LocPlaceName=?,LocSecondPlaceName=? WHERE ID=?", place.Name, place.Description, place.Rating, place.LocPlaceName, place.LocSecondPlaceName, place.Id); return(true); } } catch (SQLiteException ex) { Log.Info("SQLIte exception", ex.Message); return(false); } }
public bool DeleteTablePerson(City city) { try { using (var connection = new SQLiteConnection(System.IO.Path.Combine(Folder, "City.db"))) { //connection.Query<Place>("DELETE FROM Images Where PlaceName=?", place.CityName); connection.Execute("DELETE FROM Place Where CityName=?", city.Name); connection.Execute("DELETE FROM City Where Name=?", city.Name); return(true); } } catch (SQLiteException ex) { Log.Info("SQLIte exception", ex.Message); return(false); } }
public void Log(LogLevel level, string format, object param1, object param2) { switch (level) { case LogLevel.Debug: AndroidLog.Debug(_name, format, param1, param2); break; case LogLevel.Info: AndroidLog.Info(_name, format, param1, param2); break; case LogLevel.Warn: AndroidLog.Warn(_name, format, param1, param2); break; case LogLevel.Error: AndroidLog.Error(_name, format, param1, param2); break; } }
public AsyncPlayer(SineWaveGenerator generator) { this.generator = generator; var streamType = Stream.Music; var sampleRate = AudioTrack.GetNativeOutputSampleRate(streamType); var encoding = Android.Media.Encoding.Pcm16bit; var bufferSize = AudioTrack.GetMinBufferSize(sampleRate, ChannelOut.Mono, encoding) + 2; Log.Info("AudioInit", "{0} / {1}", sampleRate, bufferSize); soundTrack = new AudioTrack(streamType, sampleRate, ChannelConfiguration.Mono, encoding, bufferSize, AudioTrackMode.Stream); soundBuffer = new short [bufferSize]; processThread = new Thread(ThreadStart); }
public bool DeleteTableImages(Place place) { try { using (var connection = new SQLiteConnection(System.IO.Path.Combine(Folder, "City.db"))) { if (place != null) { connection.Query <Images>("DELETE * FROM Images Where PlaceName=?", place.CityName); } return(true); } } catch (SQLiteException ex) { Log.Info("SQLIte exception", ex.Message); return(false); } }
public void Log(LogLevel level, object message) { var s = message.ToString(); switch (level) { case LogLevel.Debug: AndroidLog.Debug(_name, s); break; case LogLevel.Info: AndroidLog.Info(_name, s); break; case LogLevel.Warn: AndroidLog.Warn(_name, s); break; case LogLevel.Error: AndroidLog.Error(_name, s); break; } }
public bool InsterIntoTableCity(City city) { try { using (var connection = new SQLiteConnection(System.IO.Path.Combine(Folder, "City.db"))) { connection.Insert(city); //using (var conn = new SQLiteConnection(System.IO.Path.Combine(Folder, "Place.db"))) // { // conn.Insert(place); // } // city.Places = new List<Place>{place}; // connection.UpdateWithChildren(city); return(true); } } catch (SQLiteException ex) { Log.Info("SQLIte exception", ex.Message); return(false); } }
public void CrashlyticsLog(string log) { if (log == null) { return; } try { Crashlytics.Log(log); } catch (Exception e) { if (!string.IsNullOrEmpty(e.Message)) { AndroidLog.Info(_target, e.Message); } if (!string.IsNullOrEmpty(e.StackTrace)) { AndroidLog.Info(_target, e.StackTrace); } } }
protected override void Info(ILog log, string message, object extraData, LogData logData, DateTime time) { Log.Info(Tag, message); }
public void info(string tag, string text) { ALog.Info(tag, text); }