Пример #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // ios7 layout
            if (RespondsToSelector(new Selector("edgesForExtendedLayout")))
            {
                EdgesForExtendedLayout = UIRectEdge.None;
            }

            // Perform any additional setup after loading the view, typically from a nib.
            var set = this.CreateBindingSet <AddView, AddViewModel>();

            set.Bind(CaptionText).To(vm => vm.Caption);
            set.Bind(NotesText).To(vm => vm.Notes);
            set.Bind(AddPictureButton).To(vm => vm.AddPictureCommand);
            set.Bind(SaveButton).To(vm => vm.SaveCommand);
            set.Bind(LocationSwitch).To(vm => vm.LocationKnown);
            set.Bind(MainImageView).To(vm => vm.PictureBytes).WithConversion("InMemoryImage");
            set.Apply();

            var g = new UITapGestureRecognizer(() =>
            {
                CaptionText.ResignFirstResponder();
                NotesText.ResignFirstResponder();
            });

            View.AddGestureRecognizer(g);
        }
Пример #2
0
 public bool Equals(ExplanationItem other)
 {
     return(isCallout == other.isCallout &&
            isCaption == other.isCaption &&
            isVoice == other.isVoice &&
            CalloutText.Equals(other.CalloutText) &&
            CaptionText.Equals(other.CaptionText) &&
            VoiceLabel.Equals(other.VoiceLabel) &&
            ClickNo == other.ClickNo);
 }
Пример #3
0
        public CaptionText GetCaptionText()
        {
            ItemPack _pack = GetIdlePackage(m_CaptionTextBuffer);

            if (_pack == null)
            {
                _pack = new ItemPack(CaptionText.GenerateItem(m_OriginalCaptionText, m_PoolLayout));
                m_CaptionTextBuffer.Add(_pack);
            }

            _pack.isUseing = true;
            return((CaptionText)_pack.m_Item);
        }
Пример #4
0
        public static CaptionText GenerateItem(GameObject originalText, Transform layout)
        {
            CaptionText _item = null;
            GameObject  _go   = InstantiateObject(originalText, layout);

            if (_go != null)
            {
                _item = new CaptionText();
                _item.m_CaptionText = _go.GetComponent <Text>();
                _item.m_SelfTrans   = _go.GetComponent <RectTransform>();
                _item.m_SelfTrans.anchoredPosition = Vector2.zero;
                _item.m_ContentSizeFitter          = _go.GetComponent <ContentSizeFitter>();
                _go.SetActive(false);
            }
            return(_item);
        }
Пример #5
0
 public ChainItemPool(int initialSize, GameObject originalStarItem, GameObject originalCaptionText, GameObject originalClickableText, Transform poolLayout)
 {
     if (originalStarItem == null || originalCaptionText == null || originalClickableText == null || poolLayout == null || initialSize < 0)
     {
         throw new Exception("参数不能为null或者小于0");
     }
     m_OriginalStarItem      = originalStarItem;
     m_OriginalCaptionText   = originalCaptionText;
     m_OriginalClickableText = originalClickableText;
     m_PoolLayout            = poolLayout;
     m_StarItemBuffer        = new List <ItemPack>();
     m_CaptionTextBuffer     = new List <ItemPack>(initialSize);
     m_ClickableTextBuffer   = new List <ItemPack>();
     for (int i = 0; i < initialSize; i++)
     {
         m_CaptionTextBuffer.Add(new ItemPack(CaptionText.GenerateItem(m_OriginalCaptionText, m_PoolLayout)));
     }
     m_StarItemBuffer.Add(new ItemPack(StarItem.GenerateItem(m_OriginalStarItem, m_PoolLayout)));
     m_ClickableTextBuffer.Add(new ItemPack(ClickableText.GenerateItem(m_OriginalClickableText, m_PoolLayout)));
 }
Пример #6
0
        public void Release(CaptionText item)
        {
            ItemPack _pack;

            if (item is ClickableText)
            {
                _pack = FindPackage(item, m_ClickableTextBuffer);
            }
            else
            {
                _pack = FindPackage(item, m_CaptionTextBuffer);
            }

            if (_pack == null)
            {
                Debug.Log("正在释放未知的CaptionText");
            }
            else
            {
                RecyclePackage(_pack);
            }
        }
Пример #7
0
        void ReleaseDesignerOutlets()
        {
            if (CaptionText != null)
            {
                CaptionText.Dispose();
                CaptionText = null;
            }

            if (NotesText != null)
            {
                NotesText.Dispose();
                NotesText = null;
            }

            if (AddPictureButton != null)
            {
                AddPictureButton.Dispose();
                AddPictureButton = null;
            }

            if (SaveButton != null)
            {
                SaveButton.Dispose();
                SaveButton = null;
            }

            if (LocationSwitch != null)
            {
                LocationSwitch.Dispose();
                LocationSwitch = null;
            }

            if (MainImageView != null)
            {
                MainImageView.Dispose();
                MainImageView = null;
            }
        }
Пример #8
0
        public override void LoadSubtitle(Subtitle subtitle, List <string> lines, string fileName)
        {
            const int startPosition = 256 * 3; // First 256 bytes block is just id, two next blocks are ProgramManagementInformation, then comes the list of PageManagementInformations

            _errorCount = 0;
            subtitle.Paragraphs.Clear();
            subtitle.Header = null;
            var    buffer = FileUtil.ReadAllBytesShared(fileName);
            int    index  = startPosition;
            string label  = Encoding.ASCII.GetString(buffer, 0, 8);

            if (label != "DCAPTION" && label != "BCAPTION" && label != "MCAPTION")
            {
                return;
            }

            var programManagementInformation = new ProgramManagement(buffer, 256 + 4);

            while (index + 255 < buffer.Length)
            {
                if (buffer[index + 4] == 0x2a) // Page management information
                {
                    int blockstart = index;
                    int length     = (buffer[index + 2] << 8) + buffer[index + 3];
                    index += 5;
                    var pageManagementInformationLength = (buffer[index++] << 8) + buffer[index++];
                    var pageManagementInformation       = new PageManagement(buffer, index);
                    index += pageManagementInformationLength;
                    if (buffer[index] == 0x3a) // Caption text page management data
                    {
                        index++;
                        var captionTextPageManagementLength = (buffer[index++] << 8) + buffer[index++];
                        var captionTextPageManagement       = new CaptionTextPageManagement(buffer, index);
                        index += captionTextPageManagementLength;

                        if (buffer[index] == 0x4a) // Caption text data
                        {
                            index++;
                            var subtitleDataLength = (buffer[index++] << 8) + buffer[index++];
                            try
                            {
                                var captionText = new CaptionText(buffer, index, captionTextPageManagement.Iso639LanguageCode);
                                var p           = new Paragraph
                                {
                                    StartTime = pageManagementInformation.GetStartTime(),
                                    EndTime   = pageManagementInformation.GetEndTime()
                                };
                                foreach (var unit in captionText.CaptionTextUnits)
                                {
                                    foreach (var text in unit.AribText.Texts)
                                    {
                                        p.Text = (p.Text + Environment.NewLine + text.Text).Trim();
                                    }
                                }
                                subtitle.Paragraphs.Add(p);
                            }
                            catch
                            {
                                _errorCount++;
                            }
                        }
                    }
                    index = RoundUp(blockstart + length, 256);
                }
                else
                {
                    index += 256;
                }
            }
            for (int i = 0; i < subtitle.Paragraphs.Count - 1; i++)
            {
                var paragraph = subtitle.Paragraphs[i];
                if (Math.Abs(paragraph.EndTime.TotalMilliseconds) < 0.001)
                {
                    var next = subtitle.Paragraphs[i + 1];
                    paragraph.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines;
                }
            }
            if (subtitle.Paragraphs.Count > 0 && Math.Abs(subtitle.Paragraphs[subtitle.Paragraphs.Count - 1].EndTime.TotalMilliseconds) < 0.001)
            {
                var p = subtitle.Paragraphs[subtitle.Paragraphs.Count - 1];
                p.EndTime.TotalMilliseconds = p.StartTime.TotalMilliseconds + Utilities.GetOptimalDisplayMilliseconds(p.Text);
            }

            subtitle.Renumber();
        }
Пример #9
0
        public override void LoadSubtitle(Subtitle subtitle, List<string> lines, string fileName)
        {
            const int startPosition = 256 * 3; // First 256 bytes block is just id, two next blocks are ProgramManagementInformation, then comes the list of PageManagementInformations
            _errorCount = 0;
            subtitle.Paragraphs.Clear();
            subtitle.Header = null;
            var buffer = FileUtil.ReadAllBytesShared(fileName);
            int index = startPosition;
            string label = Encoding.ASCII.GetString(buffer, 0, 8);
            if (label != "DCAPTION" && label != "BCAPTION" && label != "MCAPTION")
                return;

            var programManagementInformation = new ProgramManagement(buffer, 256 + 4);
            while (index + 255 < buffer.Length)
            {
                if (buffer[index + 4] == 0x2a) // Page management information
                {
                    int blockstart = index;
                    int length = (buffer[index + 2] << 8) + buffer[index + 3];
                    index += 5;
                    var pageManagementInformationLength = (buffer[index++] << 8) + buffer[index++];
                    var pageManagementInformation = new PageManagement(buffer, index);
                    index += pageManagementInformationLength;
                    if (buffer[index] == 0x3a) // Caption text page management data
                    {
                        index++;
                        var captionTextPageManagementLength = (buffer[index++] << 8) + buffer[index++];
                        var captionTextPageManagement = new CaptionTextPageManagement(buffer, index);
                        index += captionTextPageManagementLength;

                        if (buffer[index] == 0x4a) // Caption text data
                        {
                            index++;
                            var subtitleDataLength = (buffer[index++] << 8) + buffer[index++];
                            try
                            {
                                var captionText = new CaptionText(buffer, index, captionTextPageManagement.Iso639Languagecode);
                                var p = new Paragraph
                                {
                                    StartTime = pageManagementInformation.GetStartTime(),
                                    EndTime = pageManagementInformation.GetEndTime()
                                };
                                foreach (var unit in captionText.CaptionTextUnits)
                                {
                                    foreach (var text in unit.AribText.Texts)
                                    {
                                        p.Text = (p.Text + Environment.NewLine + text.Text).Trim();
                                    }
                                }
                                subtitle.Paragraphs.Add(p);
                            }
                            catch
                            {
                                _errorCount++;
                            }
                        }
                    }
                    index = RoundUp(blockstart + length, 256);
                }
                else
                {
                    index += 256;
                }
            }
            for (int i = 0; i < subtitle.Paragraphs.Count - 1; i++)
            {
                var paragraph = subtitle.Paragraphs[i];
                if (Math.Abs(paragraph.EndTime.TotalMilliseconds) < 0.001)
                {
                    var next = subtitle.Paragraphs[i + 1];
                    paragraph.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines;
                }
            }
            if (subtitle.Paragraphs.Count > 0 && Math.Abs(subtitle.Paragraphs[subtitle.Paragraphs.Count - 1].EndTime.TotalMilliseconds) < 0.001)
            {
                var p = subtitle.Paragraphs[subtitle.Paragraphs.Count - 1];
                p.EndTime.TotalMilliseconds = p.StartTime.TotalMilliseconds + Utilities.GetOptimalDisplayMilliseconds(p.Text);
            }

            subtitle.Renumber();
        }
Пример #10
0
        /// <summary>
        /// OnMouseDoubleClick
        /// </summary>
        /// <param name="e"></param>
        protected override void OnMouseDoubleClick(MouseEventArgs e)
        {
            /*  出生日期,
             *  病区, 科室, 病床号, 记录时间, 医院名称   */
            List <EnumPatientInfoType> lstInfoType = new List <EnumPatientInfoType>();

            lstInfoType.Add(EnumPatientInfoType.婚姻);
            lstInfoType.Add(EnumPatientInfoType.民族);
            lstInfoType.Add(EnumPatientInfoType.籍贯);
            lstInfoType.Add(EnumPatientInfoType.国籍);
            lstInfoType.Add(EnumPatientInfoType.家庭地址);
            lstInfoType.Add(EnumPatientInfoType.身份证号);
            lstInfoType.Add(EnumPatientInfoType.出生地);
            lstInfoType.Add(EnumPatientInfoType.职业);
            lstInfoType.Add(EnumPatientInfoType.工作单位);
            lstInfoType.Add(EnumPatientInfoType.联系电话);
            lstInfoType.Add(EnumPatientInfoType.联系人);
            lstInfoType.Add(EnumPatientInfoType.联系人电话);
            lstInfoType.Add(EnumPatientInfoType.与联系人关系);
            lstInfoType.Add(EnumPatientInfoType.身高);
            lstInfoType.Add(EnumPatientInfoType.体重);
            lstInfoType.Add(EnumPatientInfoType.血型);
            lstInfoType.Add(EnumPatientInfoType.费别);
            lstInfoType.Add(EnumPatientInfoType.住院天数);
            lstInfoType.Add(EnumPatientInfoType.户口地址);

            //lstInfoType.Add(EnumPatientInfoType.文化);
            //lstInfoType.Add(EnumPatientInfoType.邮编);
            //lstInfoType.Add(EnumPatientInfoType.监护人);
            //lstInfoType.Add(EnumPatientInfoType.监护人地址);
            //lstInfoType.Add(EnumPatientInfoType.监护人电话);
            //lstInfoType.Add(EnumPatientInfoType.与监护人关系);

            // 以下9个为指定角色的人才能修改
            lstInfoType.Add(EnumPatientInfoType.姓名);
            lstInfoType.Add(EnumPatientInfoType.性别);
            lstInfoType.Add(EnumPatientInfoType.年龄);
            lstInfoType.Add(EnumPatientInfoType.住院号);
            lstInfoType.Add(EnumPatientInfoType.住院次数);
            lstInfoType.Add(EnumPatientInfoType.病区);
            lstInfoType.Add(EnumPatientInfoType.科室);
            lstInfoType.Add(EnumPatientInfoType.病床号);
            lstInfoType.Add(EnumPatientInfoType.入院日期);
            lstInfoType.Add(EnumPatientInfoType.出生日期);
            lstInfoType.Add(EnumPatientInfoType.门诊住院号);

            if (lstInfoType.IndexOf(InfoType) >= 0)
            {
                string strCaption         = CaptionText.Replace(":", "").Replace(":", "");
                frmModifyPatBasicInfo frm = new frmModifyPatBasicInfo(strCaption, this.Text, ShowCaption);
                if (frm.ShowDialog(this.FindForm()) == DialogResult.OK)
                {
                    string info = frm.PatientInfo.Trim();
                    if (ShowCaption)
                    {
                        this.Text = CaptionText + info;
                    }
                    else
                    {
                        this.Text = info;
                    }
                    this.Refresh();
                }
            }
            base.OnMouseDoubleClick(e);
        }