Inheritance: ViewModelBase
Exemplo n.º 1
0
		/// <summary>
		/// 저장하기.
		/// </summary>
		public async void Save(BoardViewModel boardViewModel)
		{
			if (!EnsureUnsnapped())
				return;

			if (boardViewModel == null)
				boardViewModel = ActiveBoard;

			var savePicker = new FileSavePicker { SuggestedStartLocation = PickerLocationId.DocumentsLibrary };
			// Dropdown of file types the user can save the file as
			savePicker.FileTypeChoices.Add("LiveBoard file", new List<string>() { ".lvbd" });
			// Default file name if the user does not type one in or select a file to replace
			savePicker.SuggestedFileName = BoardViewModel.CreateNewFilename();
			savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
			StorageFile file = await savePicker.PickSaveFileAsync();
			if (file == null)
			{
				PopupMessage = "Operation cancelled.";
			}
			else
			{
				// Prevent updates to the remote version of the file until we finish making changes and call CompleteUpdatesAsync.
				CachedFileManager.DeferUpdates(file);
				// write to file
				String content = boardViewModel.Board.ToXml().ToString();

				await FileIO.WriteTextAsync(file, content, UnicodeEncoding.Utf8);
				// Let Windows know that we're finished changing the file so the other app can update the remote version of the file.
				// Completing updates may require Windows to ask for user input.
				FileUpdateStatus status = await CachedFileManager.CompleteUpdatesAsync(file);
				StorageApplicationPermissions.MostRecentlyUsedList.Add(file, file.Path);

				// TODO: 완료 팝업. 아직 안함.
				if (status == FileUpdateStatus.Complete)
				{
					PopupMessage = "File " + file.Name + " was saved.";
				}
				else
				{
					PopupMessage = "File " + file.Name + " couldn't be saved.";
				}
			}
		}
Exemplo n.º 2
0
		public void Preview(BoardViewModel board)
		{
			IsPreview = true;
			Play(board);
		}
Exemplo n.º 3
0
		/// <summary>
		/// 재생하기
		/// </summary>
		/// <param name="board"></param>
		public void Play(BoardViewModel board)
		{
			if (board == null)
				board = ActiveBoard;
			ActiveBoard = board;

			if (ActiveBoard == null || ActiveBoard.Board == null
				|| ActiveBoard.Board.Pages == null
				|| ActiveBoard.Board.Pages.Count == 0)
			{
				Messenger.Default.Send(new GenericMessage<LbMessage>(this, new LbMessage()
				{
					MessageType = LbMessageType.ERROR,
					Data = LbError.NothingToPlay
				}));
				return;
			}

			if (!IsPlaying)
				IsPlaying = true;
			else
			{
				Messenger.Default.Send(new GenericMessage<LbMessage>(this, new LbMessage()
				{
					MessageType = LbMessageType.ERROR,
					Data = LbError.IsPlayingTrue,
					Board = board.Board
				}));
				return;
			}

			Messenger.Default.Send(new GenericMessage<LbMessage>(this, new LbMessage()
			{
				MessageType = LbMessageType.EVT_SHOW_STARTING,
				Data = ActiveBoard,
				Board = board.Board
			}));

			StartTime = DateTime.Now;

		}
Exemplo n.º 4
0
		/// <summary>
		/// 종료
		/// </summary>
		/// <param name="obj"></param>
		private void Stop(BoardViewModel obj)
		{
			_timer.Stop();
			ActiveBoard.Stop();
			IsPlaying = false;
			IsPreview = false;
			Messenger.Default.Send(new GenericMessage<LbMessage>(new LbMessage()
			{
				MessageType = LbMessageType.EVT_SHOW_FINISHED
			}));
		}