public StartBroadcastViewModel()
        {
            this.config = Model.Config.GetConfig();

            this.FrontLayerVisibility = Visibility.Hidden;
            this.IdVisible = BooleanType.False;
            this.AnonymousOnly = BooleanType.False;

            this.StartBroadcastCommand = new RelayCommand(p => {
                this.StartEntry(false);
            });
            this.StartTestBroadcastCommand = new RelayCommand(p => {
                var message = "テスト配信を開始します。よろしいですか?\n\nテスト配信は画質のチェックや音量の確認などを行うための機能です。\n配信通知は行われませんが、配信は10分程度で強制的に終了します。URLを教えれば他の人に見てもらうことも可能です。なお、録画は残ります。";
                var result = MessageBox.Show(message, "確認", MessageBoxButton.OKCancel, MessageBoxImage.Question, MessageBoxResult.OK, MessageBoxOptions.DefaultDesktopOnly);
                if (result != MessageBoxResult.OK) {
                    return;
                }
                this.StartEntry(true);
            });
            this.LoadPreviousSettingCommand = new RelayCommand(p => {
                this.LoadPreviousSetting();
            });

            this.client = new CaveTubeClientWrapper();
            client.Connect();
        }
        public GeneralOptionViewModel()
        {
            this.config = Config.GetConfig();

            this.FontSizeList = new SafeObservable<Int32>();
            new[] { 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 20, 22, 24, 26, 28, 30, 36, 42 }.ForEach(size => {
                this.FontSizeList.Add(size);
            });
        }
        public GeneralOptionViewModel()
        {
            this.config = Config.GetConfig();

            this.FontSizeList = new ObservableCollection<Int32>();
            BindingOperations.EnableCollectionSynchronization(this.FontSizeList, new Object());
            new[] { 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 20, 22, 24, 26, 28, 30, 36, 42 }.ForEach(size => {
                this.FontSizeList.Add(size);
            });
        }
 public CommentOptionViewModel()
 {
     this.config = Config.GetConfig();
     this.FindFlashCommentGeneratorDatCommand = new RelayCommand(p => {
         var dialog = new OpenFileDialog {
             Filter = "DATファイル|*.dat",
             CheckFileExists = false,
             CheckPathExists = false,
             Title = "DATファイルの選択",
         };
         var result = dialog.ShowDialog();
         result.GetValueOrDefault();
         if (result.GetValueOrDefault() == false) {
             return;
         }
         this.FlashCommentGeneratorDatFilePath = dialog.FileName;
     });
 }
Exemple #5
0
 public UserSoundClient()
 {
     this.config = Config.GetConfig();
     this.soundFilePath = this.config.UserSoundFilePath;
     this.player = new MediaPlayer();
     this.player.Volume = this.config.UserSoundVolume;
     this.dispatcher = Dispatcher.CurrentDispatcher;
     if (File.Exists(this.soundFilePath)) {
         this.player.Open(new Uri(this.soundFilePath, UriKind.Absolute));
     }
     this.timer = new DispatcherTimer(DispatcherPriority.Normal, dispatcher) {
         Interval = TimeSpan.FromSeconds(Decimal.ToDouble(config.UserSoundTimeout)),
     };
     this.timer.Tick += (e, sender) => {
         this.player.Stop();
         this.timer.Stop();
     };
     this.player.MediaEnded += (e, sender) => {
         this.timer.Stop();
     };
 }
        public CommentOptionViewModel()
        {
            this.player = new MediaPlayer();

            this.config = Config.GetConfig();
            this.SoftalkFilePath = config.SofTalkPath;
            this.UserSoundFilePath = config.UserSoundFilePath;
            this.timer = new DispatcherTimer(DispatcherPriority.Normal, Dispatcher.CurrentDispatcher) {
                Interval = TimeSpan.FromSeconds(Decimal.ToDouble(this.UserSoundTimeout)),
            };
            this.timer.Tick += (e, sender) => {
                this.player.Stop();
                this.timer.Stop();
            };
            this.player.MediaEnded += (e, sender) => {
                this.timer.Stop();
            };

            this.FindSoftalkExeCommand = new RelayCommand(p => {
                var dialog = new OpenFileDialog {
                    Filter = "実行ファイル|*.exe",
                    CheckFileExists = true,
                    CheckPathExists = true,
                    Title = "Softalkの選択",
                };
                var result = dialog.ShowDialog();
                result.GetValueOrDefault();
                if (result.GetValueOrDefault() == false) {
                    return;
                }
                this.SoftalkFilePath = dialog.FileName;
            });

            this.FindSoundFileCommand = new RelayCommand(p => {
                var dialog = new OpenFileDialog {
                    Filter = "サウンドファイル|*.wav;*.mp3|全てのファイル|*.*",
                    CheckFileExists = true,
                    CheckPathExists = true,
                    Title = "サウンドファイルの選択",
                };
                var result = dialog.ShowDialog();
                result.GetValueOrDefault();
                if (result.GetValueOrDefault() == false) {
                    return;
                }
                this.UserSoundFilePath = dialog.FileName;
            });

            this.PlaySoundFileCommand = new RelayCommand(p => {
                if (File.Exists(this.UserSoundFilePath) == false) {
                    return;
                }
                this.player.Stop();
                this.player.Play();
                if (this.timer.Interval > TimeSpan.Zero) {
                    this.timer.Start();
                }
            });

            this.StopSoundFileCommand = new RelayCommand(p => {
                if (this.player.Source == null) {
                    return;
                }
                this.player.Stop();
            });
        }
		private async Task Init() {
			this.config = Model.Config.GetConfig();

			this.FrontLayerVisibility = Visibility.Hidden;
			this.IdVisible = BooleanType.False;
			this.AnonymousOnly = BooleanType.False;
			this.LoginOnly = BooleanType.False;

			this.StartBroadcastCommand = new RelayCommand(p => {
				this.StartEntry(false);
			});
			this.StartTestBroadcastCommand = new RelayCommand(p => {
				var message = "テスト配信を開始します。よろしいですか?\n\nテスト配信は配信通知が行われません。\nただし、配信は10分で自動終了します。\nそれ以外は通常の配信と同等です。";
				var result = MessageBox.Show(message, "確認", MessageBoxButton.OKCancel, MessageBoxImage.Question, MessageBoxResult.OK, MessageBoxOptions.DefaultDesktopOnly);
				if (result != MessageBoxResult.OK) {
					return;
				}
				this.StartEntry(true);
			});
			this.LoadPreviousSettingCommand = new RelayCommand(p => {
				this.LoadPreviousSetting();
			});

			var accessKey = await CavetubeAuth.GetAccessKeyAsync(config.AccessKey);
			config.AccessKey = accessKey;
			config.Save();
			this.client = new CaveTubeClientWrapper(accessKey);
			this.client.Connect();

			this.genres = await this.RequestGenreAsync(this.config.ApiKey);
			this.Genre = this.genres.First();

			this.thumbnails = await this.RequestThumbnailsAsync(this.config.ApiKey);
			this.Thumbnail = this.thumbnails.First();
		}
Exemple #8
0
        public static Config GetConfig()
        {
            if (config != null) {
                return config;
            }

            config = new Config();
            var dict = DapperUtil.Query<dynamic>(@"
                SELECT
                    ConfigKey
                    ,Value
                FROM
                    Config
                ;
            ").ToDictionary(row => (String)row.ConfigKey, row => (String)row.Value);
            config.configDictionary = dict;

            return config;
        }
 public BouyomiClientWrapper()
     : base()
 {
     this.client = new BouyomiChanClient();
     this.config = Config.GetConfig();
 }