CaveTube.CaveTalk.ViewModel.StartBroadcastViewModel.Init C# (CSharp) Method

Init() private method

private Init ( ) : Task
return Task
		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();
		}

Usage Example

		public static async Task<StartBroadcastViewModel> CreateInstance() {
			var instance = new StartBroadcastViewModel();
			await instance.Init();
			return instance;
		}