コード例 #1
0
        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();
        }
コード例 #2
0
        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);
            });
        }
コード例 #3
0
        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);
            });
        }
コード例 #4
0
 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;
     });
 }
コード例 #5
0
ファイル: UserSoundClient.cs プロジェクト: madguy/CaveTalk
 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();
     };
 }
コード例 #6
0
        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();
            });
        }
コード例 #7
0
		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();
		}
コード例 #8
0
ファイル: Config.cs プロジェクト: madguy/CaveTalk
        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;
        }
コード例 #9
0
 public BouyomiClientWrapper()
     : base()
 {
     this.client = new BouyomiChanClient();
     this.config = Config.GetConfig();
 }