private static void Main() { string picture = "telerik-academy.jpg"; PictureWindow pictureWindow = new PictureWindow(picture); UseWindow(pictureWindow); string someLongText = "some long text"; TextWindow textWindow = new TextWindow(someLongText); UseWindow(textWindow); string question = "How are you, dude?"; string[] answers = new string[] { "I feeeeeeeel good...!", "Gonna jump around!", "Not bad, really!" }; DialogWindow dialogWindow = new DialogWindow(question, answers); UseWindow(dialogWindow); }
private void Awake() { _instance = this; DontDestroyOnLoad(this.gameObject); // Assign all the UI slides _background = GameObject.Find("Background"); _note = GameObject.Find("Note"); _instructions = new GameObject[5]; _instructions[0] = GameObject.Find("Instruction Assign Controller"); _instructions[1] = GameObject.Find("Instruction Bottom Left"); _instructions[2] = GameObject.Find("Instruction Bottom Right"); _instructions[3] = GameObject.Find("Instruction Top Left"); _instructions[4] = GameObject.Find("Instruction Cover"); ShowInstruction(INSTRUCTION.AssignController); }
private void SetParentTransform() { PictureWindow pic = PictureWindow.Instance; if (pic == null || pic.PictureWindowUI == null) { return; } GameObject uiT = pic.PictureWindowUI; if (DevSubsystemManage.IsRoamState) { Transform parentRoam = RoamFollowMange.Instance == null ? transform : RoamFollowMange.Instance.gameObject.transform; uiT.transform.SetParent(parentRoam); uiT.transform.localScale = new Vector3(0.8f, 0.8f, 0.8f); uiT.transform.localPosition = Vector3.zero; } else { uiT.transform.SetParent(pic.transform); uiT.transform.localPosition = Vector3.zero; uiT.transform.localScale = Vector3.one; } }
/// <summary> /// 消息改变时 /// </summary> /// <param name="d">母控件</param> /// <param name="e">更改相关值</param> private static void OnBubbleMsgChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { AsyncImageControl imagecontrol = (AsyncImageControl)d; if (e.NewValue != null) { #region Download Image File string uri = (string)e.NewValue; try { if (uri.Contains("http"))//if it's Web url { //get info about the path string localpath = Applicate.LocalConfigData.ChatDownloadPath; ChatBubbleItemModel msg = imagecontrol.Tag as ChatBubbleItemModel; string filename = msg.fileName.Substring( msg.fileName.LastIndexOf('/') + 1, msg.fileName.Length - msg.fileName.LastIndexOf('/') - 1 ); var localfile = localpath + filename; if (File.Exists(localfile))//if file exists, fill the image of the border { try { var imguri = new Uri(localfile); imagecontrol.Imgborder.Source = new BitmapImage(imguri); imagecontrol.transitioner.SelectedIndex = 1; imagecontrol.MouseLeftButtonUp += (sen, res) => { var photoView = new PictureWindow().GetPhotoView(localfile); photoView.Show(); //photoView.Activate(); //photoView.Focus(); }; } catch (Exception ex) { ConsoleLog.Output("显示图片cc" + ex.Message); } } else//if not exists { using (WebClient web = new WebClient()) { try { //when the progress changed , set the value of the progressbar web.DownloadProgressChanged += (s, ev) => { imagecontrol.ImageProgress.Value = ev.ProgressPercentage; }; //When download completed, fill the image of the border web.DownloadFileCompleted += (s, ev) => { if (ev.Error == null) { var imguri = new Uri(localfile); imagecontrol.Imgborder.Source = new BitmapImage(imguri); imagecontrol.transitioner.SelectedIndex = 1; imagecontrol.BtnDownload.Visibility = Visibility.Collapsed;//隐藏下载按钮 imagecontrol.MouseLeftButtonUp += (sen, res) => { var photoView = new PictureWindow().GetPhotoView(localfile); photoView.Show(); photoView.Activate(); photoView.Focus(); }; web.Dispose();//Dispose the WebClient } else { ConsoleLog.Output("图片下载失败"); } }; //Start download image async web.DownloadFileAsync(new Uri(uri), localfile); } catch (Exception ex) { ConsoleLog.Output("AsyncImageControl--GetImage--Error" + ex.Message); imagecontrol.Dispatcher.Invoke(() => { imagecontrol.BtnDownload.Visibility = Visibility.Visible;//显示下载按钮 }); } } } } #endregion else//if it's local path { if (File.Exists(uri)) { imagecontrol.Imgborder.Source = new BitmapImage(new Uri(uri)); imagecontrol.transitioner.SelectedIndex = 1; imagecontrol.MouseLeftButtonUp += (sen, res) => { var photoView = new PictureWindow().GetPhotoView(uri); photoView.Show(); photoView.Activate(); photoView.Focus(); }; } } } catch (Exception ex) { ConsoleLog.Output("Download Aaudio Error:;;", ex); } } else { return; } }
private void Awake() { Instance = this; }