コード例 #1
0
ファイル: Log.cs プロジェクト: mkopadev/salesapp
        public void Error(string e, [CallerMemberName] string memberName = "",
                          [CallerFilePath] string sourceFilePath         = "",
                          [CallerLineNumber] int sourceLineNumber        = 0)
        {
            if (e == null)
            {
                e = _defaultLogString;
            }

            AndroidLog.Error(_target, e);
            CrashlyticsLog(e);
            Writer.Write(e);

            if (_xamarinInsights)
            {
                Dictionary <string, string> additionalInfo = new Dictionary <string, string>
                {
                    { "Member Name", memberName },
                    { "Source Filepath", sourceFilePath },
                    { "Source Line Number", sourceLineNumber.ToString() },
                    { "CallStack", _traceEventCache.Callstack }
                };

                Insights.Report(new Exception(e), additionalInfo);
            }
        }
コード例 #2
0
        public override bool IsEnabled(LogLevel logLevel)
        {
            var priority = logLevel.ToLogPriority();
            var result   = DroidLog.IsLoggable(tag, priority);

            return(result);
        }
コード例 #3
0
 public void OnDisconnected()
 {
     Log.WriteLine(Andr.Util.LogPriority.Info, this.Class.SimpleName, "disconnected");
     Toast.MakeText(this, "Disconnected", ToastLength.Long).Show();
     audioButton.Text = "Disable Audio";
     videoButton.Text = "Disable Video";
 }
コード例 #4
0
        public async Task SendMessageAsync(string data)
        {
            if (!Connected)
            {
                return;
            }

            try
            {
                _outStream = _btSocket.OutputStream;
            }
            catch (Exception ex)
            {
                Log.Error(_tag, $"Cannot get OutputStream from BT device: {ex.Message}, {ex.StackTrace}.");
            }

            byte[] buffer = Encoding.UTF8.GetBytes(data);

            try
            {
                await _outStream.WriteAsync(buffer, 0, buffer.Length);
            }
            catch (Exception ex)
            {
                Log.Error(_tag, $"Cannot write data to BT device: {ex.Message}, {ex.StackTrace}.");
            }
        }
コード例 #5
0
ファイル: Log.cs プロジェクト: mkopadev/salesapp
        public void Warning(string w, [CallerMemberName] string memberName = "",
                            [CallerFilePath] string sourceFilePath         = "",
                            [CallerLineNumber] int sourceLineNumber        = 0)
        {
            if (w == null)
            {
                w = _defaultLogString;
            }

            AndroidLog.Warn(_target, w);
            CrashlyticsLog(w);

            if (FileExtensiveLogs)
            {
                Writer.Write(w);
            }

            if (_xamarinInsights)
            {
                Dictionary <string, string> additionalInfo = new Dictionary <string, string>
                {
                    { "Member Name", memberName },
                    { "Source Filepath", sourceFilePath },
                    { "Source Line Number", sourceLineNumber.ToString() },
                    { "CallStack", _traceEventCache.Callstack }
                };

                Insights.Report(new Exception(w), additionalInfo);
            }
        }
コード例 #6
0
 public static void w(string tag, string msg)
 {
     if (LOG_ENABLE)
     {
         Log.Warn(tag, msg);
     }
 }
コード例 #7
0
 public static void e(string tag, string msg)
 {
     if (LOG_ENABLE)
     {
         Log.Error(tag, msg);
     }
 }
コード例 #8
0
 public static void v(string tag, string msg)
 {
     if (LOG_ENABLE)
     {
         Log.Verbose(tag, msg);
     }
 }
コード例 #9
0
 public static void d(string tag, string msg)
 {
     if (LOG_ENABLE)
     {
         Log.Debug(tag, msg);
     }
 }
コード例 #10
0
        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;
            }
        }
コード例 #11
0
 public static void i(string tag, string msg)
 {
     if (LOG_ENABLE)
     {
         Log.Info(tag, msg);
     }
 }
コード例 #12
0
            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();
            }
コード例 #13
0
 public void OnPlayStarted()
 {
     Log.WriteLine(Andr.Util.LogPriority.Info, this.Class.SimpleName, "onPlayStarted");
     Toast.MakeText(this, "Play started", ToastLength.Long).Show();
     webRTCClient.SwitchVideoScaling(RendererCommon.ScalingType.ScaleAspectFit);
     RefreshButtons();
 }
コード例 #14
0
        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);
        }
コード例 #15
0
ファイル: Log.cs プロジェクト: mkopadev/salesapp
        public void Error(Exception e, [CallerMemberName] string memberName = "",
                          [CallerFilePath] string sourceFilePath            = "",
                          [CallerLineNumber] int sourceLineNumber           = 0)
        {
            if (string.IsNullOrEmpty(e.Message))
            {
                return;
            }

            AndroidLog.Error(_target, "member name: " + memberName);
            AndroidLog.Error(_target, "source file path: " + sourceFilePath);
            AndroidLog.Error(_target, "source line number: " + sourceLineNumber);
            AndroidLog.Error(_target, e.Message);

            if (!string.IsNullOrEmpty(e.StackTrace))
            {
                AndroidLog.Error(_target, e.StackTrace);
            }

            CrashlyticsLog(e);
            Writer.Write(e);

            if (_xamarinInsights)
            {
                Dictionary <string, string> additionalInfo = new Dictionary <string, string>
                {
                    { "Member Name", memberName },
                    { "Source Filepath", sourceFilePath },
                    { "Source Line Number", sourceLineNumber.ToString() },
                    { "CallStack", _traceEventCache.Callstack }
                };

                Insights.Report(e, additionalInfo);
            }
        }
コード例 #16
0
ファイル: MainActivity.cs プロジェクト: phaufe/Similardio
 public void OnRdioUserAppApprovalNeeded(Intent authIntent)
 {
     try {
         StartActivityForResult(authIntent, 100);
     } catch (ActivityNotFoundException) {
         Log.Error("Auth", "Rdio App not found");
     }
 }
コード例 #17
0
 public void OnBitrateMeasurement(String streamId, int targetBitrate, int videoBitrate, int audioBitrate)
 {
     Log.WriteLine(Andr.Util.LogPriority.Info, this.Class.SimpleName, "st:" + streamId + " tb:" + targetBitrate + " vb:" + videoBitrate + " ab:" + audioBitrate);
     if (targetBitrate < (videoBitrate + audioBitrate))
     {
         Toast.MakeText(this, "low bandwidth", ToastLength.Short).Show();
     }
 }
コード例 #18
0
        public void OnDisconnected()
        {
            Log.WriteLine(Andr.Util.LogPriority.Info, this.Class.SimpleName, "disconnected");
            Toast.MakeText(this, "Disconnected", ToastLength.Long).Show();

            startStreamingButton.Text = "Start " + operationName;
            //finish();
        }
コード例 #19
0
        // ===========================================================
        // Methods
        // ===========================================================

        private void FlushBuilder()
        {
            if (this.mBuilder.Length() > 0)
            {
                Log.Verbose("GLSurfaceView", this.mBuilder.ToString());
                this.mBuilder.Delete(0, this.mBuilder.Length());
            }
        }
コード例 #20
0
            public override double AssessShot(SmoothedList <float> distancesDodged, List <TimeSpan> timestamps, IncomingRangedAttack incoming)
            {
                var effectiveDodge   = distancesDodged.Last() / DistanceForOneSigma / (1.0 + 0.01 * incoming.DodgeCompensationBonus);
                var bellCurveDieRoll = Accord.Statistics.Distributions.Univariate.NormalDistribution.Random();
                var resultScore      = incoming.BaseZScore - effectiveDodge - bellCurveDieRoll;

                Log.Debug("Evasion|AssessShot", $"Resolved an evasion attempt with a {((resultScore > 0) ? "hit" : "miss")} ({resultScore:f2}) based on an EffectiveDodge of {effectiveDodge:f2} and a random dodge of {bellCurveDieRoll:f2}.");
                return(resultScore);
            }
コード例 #21
0
        protected async void PerformSpellSelection()
        {
            if (GlyphCastStage.CurrentGlyph != null)
            {
                GlyphCastStage.CurrentGlyph.Deactivate();
                GlyphCastStage.CurrentGlyph = null;
            }

            SpellDefinition ChosenSpell = null;

            //useVolumeTrigger = false;

            try
            {
                //Log.Debug("SpellSelection", $"Diagnostics: #sensors {Res.NumSensors}; CurrentStage {(CurrentStage as GestureRecognizerStage)?.Label}; Background stages activity: {BaseActivity.BackgroundStages?.Select(s => $"{(s as GestureRecognizerStage)?.Label}:{s.IsActive}").Join()}");
                var    MagnitudeGlyph  = await new GlyphCastStage(Glyph.MagnitudeGlyphs, Glyph.StartOfSpell, 2.0).AwaitResult();
                double timeCoefficient = (MagnitudeGlyph == Glyph.L) ? 4.0 :
                                         (MagnitudeGlyph == Glyph.M) ? 1.5 :
                                         (MagnitudeGlyph == Glyph.H) ? -2.0 :
                                         -5.0; // for Magnitude == Glyph.G
                var SpellTypeGlyph = await new GlyphCastStage(Glyph.SpellTypeGlyphs, MagnitudeGlyph, timeCoefficient).AwaitResult();

                // Now figure out what possible third "key" glyphs exist given our spell list.
                var PossibleSpells = SpellDefinition.AllSpells
                                     .Where(s => s.Magnitude == MagnitudeGlyph && s.SpellType == SpellTypeGlyph)
                                     .ToDictionary(s => s.KeyGlyph);
                var KeyGlyph = await new GlyphCastStage(PossibleSpells.Keys, SpellTypeGlyph, timeCoefficient).AwaitResult();
                ChosenSpell = PossibleSpells.GetValueOrDefault(KeyGlyph);

                // Now that we know that...
                var lastGlyph       = KeyGlyph;
                var RemainingGlyphs = ChosenSpell.Glyphs.Skip(3); // The three we already extracted above, of course.
                foreach (var glyph in RemainingGlyphs)
                {
                    await new GlyphCastStage(glyph, lastGlyph, timeCoefficient).AwaitResult();
                    lastGlyph = glyph;
                }
                Task.Run(() => ChosenSpell?.OnCast(Current)) // Passing the Activity allows us to ask it to do things (like animate properties or other UI stuff)
                .LaunchAsOrphan($"Effects of {ChosenSpell.SpellName}");
                //Finish();
            }
            catch (TaskCanceledException)
            {
                //ChosenSpell?.FailResult?.Invoke(null);
                Log.Debug("GlyphCast", $"Spell selection / casting cancelled during glyph casting.");
                //Finish();
            }
            finally
            {
                useVolumeTrigger = true;
            }
        }
コード例 #22
0
 public void JoinConference(View v)
 {
     if (!conferenceManager.IsJoined)
     {
         Log.WriteLine(Andr.Util.LogPriority.Info, this.Class.SimpleName, "Joining Conference");
         ((Button)v).Text = "Leave";
         conferenceManager.JoinTheConference();
     }
     else
     {
         ((Button)v).Text = "Join";
         conferenceManager.LeaveFromConference();
     }
 }
コード例 #23
0
 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);
     }
 }
コード例 #24
0
 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);
     }
 }
コード例 #25
0
 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);
     }
 }
コード例 #26
0
 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);
     }
 }
コード例 #27
0
ファイル: Log.cs プロジェクト: mkopadev/salesapp
        public void Info(string i)
        {
            if (i == null)
            {
                i = _defaultLogString;
            }

            AndroidLog.Info(_target, i);
            CrashlyticsLog(i);

            if (FileExtensiveLogs)
            {
                Writer.Write(i);
            }
        }
コード例 #28
0
ファイル: Log.cs プロジェクト: mkopadev/salesapp
        public void Debug(string d)
        {
            if (d == null)
            {
                d = _defaultLogString;
            }

            AndroidLog.Debug(_target, d);
            CrashlyticsLog(d);

            if (FileExtensiveLogs)
            {
                Writer.Write(d);
            }
        }
コード例 #29
0
ファイル: Log.cs プロジェクト: mkopadev/salesapp
        public void Verbose(Exception e)
        {
            if (!string.IsNullOrEmpty(e.Message))
            {
                AndroidLog.Verbose(_target, e.Message);
            }

            if (!string.IsNullOrEmpty(e.StackTrace))
            {
                AndroidLog.Verbose(_target, e.StackTrace);
            }

            CrashlyticsLog(e);
            Writer.Write(e);
        }
コード例 #30
0
ファイル: Log.cs プロジェクト: mkopadev/salesapp
        public void Verbose(string v)
        {
            if (v == null)
            {
                v = _defaultLogString;
            }

            AndroidLog.Verbose(_target, v);
            CrashlyticsLog(v);

            if (FileExtensiveLogs)
            {
                Writer.Write(v);
            }
        }