public BandwidthCheckDialog() { InitializeComponent(); this.DataContext = this; Uri target_uri; if (AppSettingsReader.TryGetUri("BandwidthChecker", out target_uri)) { this.checker = new BandwidthChecker(target_uri); this.checker.BandwidthCheckCompleted += checker_BandwidthCheckCompleted; this.checker.RunAsync(); this.Status = "帯域測定中"; } else { this.IsChecking = false; this.Status = "接続先設定が取得できません"; } }
public int? CheckBandWidth() { int? result = null; Uri target_uri; if (AppSettingsReader.TryGetUri("BandwidthChecker", out target_uri)) { var checker = new BandwidthChecker(target_uri); checker.BandwidthCheckCompleted += (sender, args) => { if (args.Success) { result = (int)args.Bitrate/1000; } }; checker.Run(); } return result; }
public CheckBandwidthCommand(SettingViewModel owner) { this.owner = owner; Uri target_uri; if (AppSettingsReader.TryGetUri("BandwidthChecker", out target_uri)) { this.checker = new BandwidthChecker(target_uri); this.checker.BandwidthCheckCompleted += checker_BandwidthCheckCompleted; } else { canExecute = false; } }