//키보드에 언어를 추가하고 키보드를 로드한다. private void SetKeyboardList(List <KeyboardLayoutTypes> keyboardList) { if (keyboardList == null) { keyboardList = new List <KeyboardLayoutTypes>(); } Apps.UI.Keyboard.Keyboard keybd = keybdLayer.Children[0] as Apps.UI.Keyboard.Keyboard; //키보드 로드 keybd.LoadKeyboardLayout(keyboardList); }
void loadWorker_DoWork(object sender, DoWorkEventArgs e) { LoadingArgument loadingArg = e.Argument as LoadingArgument; BackgroundWorker worker = sender as BackgroundWorker; Deployment.Current.Dispatcher.BeginInvoke(() => { switch (loadingArg.LoadingType) { case LoadingTypes.Keyboard: if (loadingArg.LoadingGrid != null) { Apps.UI.Keyboard.Keyboard keybd = keybdLayer.Children[0] as Apps.UI.Keyboard.Keyboard; keybd.RecreateKeyboard(); //로딩제거 this.LayoutRoot.Children.Remove(loadingArg.LoadingGrid); } UIUtils.SetVisibility(keybdLayer, true); Storyboard sb = new Storyboard(); sb.Children.Add(GetKeyboardAnimation(true)); sb.Completed += new EventHandler((object obj, EventArgs ev) => { UIUtils.SetVisibility(btnKeyboard, false); }); sb.Begin(); break; case LoadingTypes.Connection: ServerExtraInfo srvExtraInfo = (ServerExtraInfo)loadingArg.Result; //UI 업데이트 this.UpdateUIElements(); //키보드 리스트 적용 SetKeyboardList(srvExtraInfo.KeyboardList); //로딩제거 this.LayoutRoot.Children.Remove(loadingArg.LoadingGrid); break; } }); }
// 생성자 public MainPage() { InitializeComponent(); //기본 설정 로드 DeviceInfo.Load(); ResourceUri.Load(); // ApplicationBar를 지역화하는 샘플 코드 BuildLocalizedApplicationBar(); //터치 재사용 객체 생성 touchInfos = new TouchInfo[5]; for (int i = 0; i < touchInfos.Length; i++) { touchInfos[i] = new TouchInfo(); } Touch.FrameReported += new TouchFrameEventHandler(Touch_FrameReported); PointingControlManager.Instance.PropertyChanged += pointerCtrlMgr_PropertyChanged; PointingControlManager.Instance.ImageReceiveFailed += Instance_ImageReceiveFailed; PointingControlManager.Instance.DeviceType = SettingManager.Instance.SettingInfo.DeviceType; PointingControlManager.Instance.ImageQualityType = SettingManager.Instance.SettingInfo.ImageQualityType; //접속 체크 쓰레드 함수 생성 및 시작 new Thread(CheckConnectionThreadFn).Start(); //메세지팁 생성 msgTip = new Apps.UI.Notification.MessageTip(); msgTip.MaxWidth = DeviceInfo.ScreenWidth * 0.75; msgTip.Margin = new Thickness(15); msgTip.VerticalAlignment = System.Windows.VerticalAlignment.Bottom; LayoutRoot.Children.Add(msgTip); //로딩 팝업을 위한 백그라운드 워커 loadWorker = new BackgroundWorker(); loadWorker.DoWork += loadWorker_DoWork; loadWorker.RunWorkerCompleted += loadWorker_RunWorkerCompleted; //데이터 용량 알림 이벤트 핸들러 등록 AppLoader.CellularDataUtil.NotifyUsagePerMegaBytes += CellularDataUtil_NotifyUsagePerMegaBytes; //기본 키보드 생성 Apps.UI.Keyboard.Keyboard keybd = new Apps.UI.Keyboard.Keyboard(); keybd.Margin = new Thickness(10); keybdLayer.Children.Add(keybd); //화면상의 모든 객체를 숨김으로 처리 HideAllChildren(); //기본 셋팅 버튼만 표시 UIUtils.SetVisibility(btnMenu, true); //앱바 및 버튼 상태 업데이트 UpdateUIElements(); bool isShowGettingStart = SettingManager.Instance.SettingInfo.GettingStart; //자동 재접속 if (NetworkUtils.IsNetworkAvailable && SettingManager.Instance.SettingInfo.AutoConnect) { ServerInfo serverInfo = SettingManager.Instance.SettingInfo.ServerInfo; if (!string.IsNullOrEmpty(serverInfo.ServerIP) && serverInfo.AccessCode >= 1000 && serverInfo.TcpPort > 0 && serverInfo.UdpPort > 0) { isShowGettingStart = false; ConnectionManager.Instance.ConnectionInfo.CurrentServer = serverInfo; //접속 요청 txtInfomation.Text = I18n.GetString("ServerConnectPageConnecting"); System.Net.Sockets.SocketError result = (System.Net.Sockets.SocketError)ConnectionManager.Instance.ConnectServer( SettingManager.Instance.SettingInfo.DeviceType, new CallbackHandler(CallbackConnectServer)); } } //마우스 배경화면 backgroundTouchScreenBitmap = new WriteableBitmap(0, 0).FromContent(ResourceUri.IMG_TOUCHSCREEN_BACKGROUND); backgroundMouseBitmap = new WriteableBitmap(0, 0).FromContent(ResourceUri.IMG_MOUSE_BACKGROUND); UpdateBackgroundImage(SettingManager.Instance.SettingInfo.DeviceType == DeviceTypes.Mouse ? backgroundMouseBitmap : backgroundTouchScreenBitmap); //시작하기 UIUtils.SetVisibility(layerGettingStart, isShowGettingStart); if (!isShowGettingStart) { //광고 컨트롤 추가 VersionUtils.DecideAdControl(this.LayoutRoot, this.txtInfomation); } }