/// <summary>
    /// initializes the annotation box
    /// assigns all buttons
    /// fills it with the text of the annotation
    /// </summary>
    void Start()
    {
        buttonEdit   = editButton.GetComponent <GaMRButton>();
        buttonDelete = deleteButton.GetComponent <GaMRButton>();
        buttonClose  = closeButton.GetComponent <GaMRButton>();
        caption      = textField.GetComponent <Caption>();

        // necessary since caption has not yet called Start() but is needed immediately
        caption.Init();
        caption.Text = container.Annotation.Text;

        buttonEdit.OnPressed   = EditText;
        buttonDelete.OnPressed = DeleteAnnotation;
        buttonClose.OnPressed  = Close;
    }
Esempio n. 2
0
    private void InitializeUI()
    {
        InitializeButtons();
        label   = transform.Find("Label").GetComponent <TextMesh>();
        caption = transform.Find("TextField").GetComponent <Caption>();
        caption.Init();

        // initialize audio progress bar
        Transform audioProgressBarTransform = transform.Find("Audio Progress Bar");

        if (audioProgressBarTransform != null)
        {
            audioProgressBar = audioProgressBarTransform.GetComponent <AudioProgressBar>();
            if (audioProgressBar != null && container != null)
            {
                audioProgressBar.Source = container.AnnotationAudioSource;
            }
        }
    }
Esempio n. 3
0
        private Bitmap GetImageByPage(float sizePerUnit, int pageIndex)
        {
            try
            {
                #region 计算皮试行最大高度
                int maxPeauTestRecCount = 0;
                int colFrom             = pageIndex * this.ColumnsPerPage;
                int colTo = (pageIndex + 1) * this.ColumnsPerPage - 1;
                for (int i = colFrom; i <= colTo; i++)
                {
                    if (this.Columns[i].Value != null && this.Columns[i].Value.PeauTestValues.Count > maxPeauTestRecCount)
                    {
                        maxPeauTestRecCount = this.Columns[i].Value.PeauTestValues.Count;
                    }
                }

                if (maxPeauTestRecCount > 1)
                {
                    this.FooterHeight_PiShi = maxPeauTestRecCount * 1.5f;
                }
                else
                {
                    this.FooterHeight_PiShi = 2f;
                }
                #endregion

                #region 计算其它行最大高度
                int maxOtherCount = 0;
                int intOtherCount = 0;
                for (int i = colFrom; i <= colTo; i++)
                {
                    intOtherCount = 0;
                    if (this.Columns[i].Value != null && this.Columns[i].Value.Other2Values.Count > 0)
                    {
                        string        strText  = string.Empty;
                        List <string> lstValue = null;
                        foreach (EntityEmrTemperatureMonitorData objTemp in this.Columns[i].Value.Other2Values)
                        {
                            lstValue = new List <string>();
                            strText  = objTemp.measureValue + " " + objTemp.measureValue2;
                            if (System.Text.Encoding.Default.GetBytes(strText).Length > 14)
                            {
                                int pos = 0;
                                for (int k = 1; k <= strText.Length; k++)
                                {
                                    if (System.Text.Encoding.Default.GetBytes(strText.Substring(pos, k - pos)).Length == 14)
                                    {
                                        lstValue.Add(strText.Substring(pos, k - pos));
                                        pos = k;
                                        if (k < strText.Length && System.Text.Encoding.Default.GetBytes(strText.Substring(pos)).Length < 14)
                                        {
                                            lstValue.Add(strText.Substring(k));
                                            pos = strText.Length;
                                        }
                                        if (pos == strText.Length)
                                        {
                                            break;
                                        }
                                    }
                                }
                            }
                            else
                            {
                                lstValue.Add(strText);
                            }
                            intOtherCount += lstValue.Count;
                        }

                        if (intOtherCount > maxOtherCount)
                        {
                            maxOtherCount = intOtherCount;
                        }
                    }
                }

                if (maxOtherCount > 1)
                {
                    this.m_fltOtherFooterHeigth = maxOtherCount * 1.5f;
                }
                else
                {
                    this.m_fltOtherFooterHeigth = 2f;
                }
                #endregion

                #region 计算每页宽度,高度

                bool recreate = false;
                if (this.SizePerUnit != sizePerUnit || pageIndex != 0)
                {
                    this.SizePerUnit = sizePerUnit;
                    recreate         = true;
                }

                //计算每页宽度,高度
                float colsWidth = 0;
                if (this.ColumnsPerPage > 0)
                {
                    colsWidth = this.ColumnsPerPage * (this.Columns[0].WidthUnit * this.SizePerUnit);
                }

                float imgWidth  = this.LeftOffset + this.RowHeader.WidthUnit * this.SizePerUnit + colsWidth;
                float imgHeight = this.TopOffset * 2 + (this.Caption.HeightUnit + ThreeItemConstValue.HeaderTotalHeight + this.FooterTotalHeight + (ThreeItemConstValue.MaxTemp - ThreeItemConstValue.MinTemp) * ThreeItemConstValue.RowsPerTempUnit) * this.SizePerUnit;

                #endregion

                #region 根据当前页计算显示的记录
                string RegID = this.PatInfo.RegID;


                this.VisibleColumns.Clear();
                for (int i = 0; i < this.Columns.Count; i++)
                {
                    this.Columns[i].InitCells(RegID, pageIndex);

                    if (i >= pageIndex * this.ColumnsPerPage && i <= ((pageIndex + 1) * this.ColumnsPerPage) - 1)
                    {
                        this.Columns[i].m_mthSetVisible(RegID, pageIndex, true);
                        this.VisibleColumns.Add(this.Columns[i]);
                    }
                    else
                    {
                        this.Columns[i].m_mthSetVisible(RegID, pageIndex, false);
                    }
                }

                #endregion

                Bitmap img = new Bitmap((int)imgWidth + 1, (int)imgHeight + 1);
                graphics = Graphics.FromImage(img);
                graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;

                this.graphics.Clear(Color.White);
                this.SizePerUnit = sizePerUnit;

                if (recreate)
                {
                    Caption.Init();
                }
                Caption.Paint(this.PatInfo, pageIndex, pageIndex + 1 == PageCount);

                RowHeader.InitCells(RegID, pageIndex);
                RowHeader.Paint();

                bool blnTemp = false;
                foreach (DrawingDataColumn col in this.Columns)
                {
                    col.BlnLastUp = blnTemp;
                    if (recreate)
                    {
                        col.InitCells(RegID, pageIndex);
                    }
                    col.Paint();
                    blnTemp = col.BlnLastUp;
                }

                return(img);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.ToString());
                throw;
            }
        }