public CustomImagePickerViewModel()
        {
            var resourceService = DependencyService.Get <IResourceService>();

            this.RecipientsItemSource = new List <string>
            {
                "BrandonPeterson",
                "VacationWander",
                "Joshua Price",
                "Reuben Holmes",
                "Eva Lawson",
                "Rory Baxter",
                "David Webb",
                "Howard Pittman",
            };
            this.Source = RichTextSource.FromStream(() => resourceService.GetResourceStream("pick-image-demo.html"));
            //this.EmojiSource =
            this.EmojiSource = resourceService
                               .GetResourceNamesFromFolder("Emojis")
                               .OrderBy(resourceName => resourceName)
                               .Select(resourceName => RichTextImageSource.FromStream(() =>
                                                                                      resourceService.GetResourceStream(resourceName), RichTextImageType.Png))
                               .ToList();


            this.SendEmailCommand = new Command(SendEmail);
        }
        public CustomizationViewModel()
        {
            this.resourceService = DependencyService.Get <IResourceService>();

            this.Source = RichTextSource.FromStream(() => this.resourceService.GetResourceStream("RichTextEditorOverview.html"));

            this.MoreTextFormattingText      = TelerikFont.IconFontFamily;
            this.MoreParagraphFormattingText = TelerikFont.IconAlignLeft;
        }
        public HyperlinkErrorHandling()
        {
            InitializeComponent();

            var htmlSource = @"<h5>Check the following links:</h5>
                        <p><a href='https://www.telerik.com/xamarin-ui' target='_blank'>Telerik.com - valid Url</a></p>
                        <p><a href='www.google.com'>Google - not absolute Url</a></p>
                        <p><a href='http:/www.wvtesting.com'>Wrong format of Url</a></p>";

            this.richTextEditor.Source = RichTextSource.FromString(htmlSource);
        }
Example #4
0
        public RichTextEditorGettingStartedXaml()
        {
            InitializeComponent();

            // >> richtexteditor-getting-started
            var htmlSource = @"<h4>One of the Most Beautiful Islands on Earth - Tenerife</h4>
                        <p><strong>Tenerife</strong> is the largest and most populated island of the eight <a href='https://en.wikipedia.org/wiki/Canary_Islands' target='_blank'>Canary Islands</a>.</p>
                        <p style='color:#808080'>It is also the most populated island of <strong>Spain</strong>, with a land area of <i>2,034.38 square kilometers</i> and <i>904,713</i> inhabitants, 43% of the total population of the <strong>Canary Islands</strong>.</p>";

            this.richTextEditor.Source = RichTextSource.FromString(htmlSource);
            // << richtexteditor-getting-started
        }
Example #5
0
        private void InsertText(string text)
        {
            if (isBurnMode)
            {
                return;
            }
            Focus();
            //删除输入 包括@
            TextPointer p = CaretPosition.GetPositionAtOffset(-sbLastWords.Length - 1);

            if (p != null)
            {
                CaretPosition = p;
            }
            var getGroupMembersUser = RichTextSource.FirstOrDefault(c => c.userNum + c.userName == text);

            text = "@" + text;
            CaretPosition.DeleteTextInRun(sbLastWords.Length + 1);
            //pTalk = p.Paragraph;
            //插入选中项  todo
            TextBlock tbLeft = new TextBlock()
            {
                Text = text, FontSize = 12, Foreground = new SolidColorBrush(talkColor)
            };

            if (getGroupMembersUser != null)
            {
                tbLeft.Tag = getGroupMembersUser.userId;
            }
            else if (text.Contains("全体"))
            {
                tbLeft.Tag = groupId;
            }
            TextPointer       point       = this.Selection.Start;
            InlineUIContainer uiContainer = new InlineUIContainer(tbLeft, point);
            TextPointer       nextPoint   = uiContainer.ContentEnd;

            this.CaretPosition = nextPoint;
            this.CaretPosition.InsertTextInRun(" ");//加入空格
            //pTalk.Inlines.Add(tbLeft);
            //this.Document.Blocks.Add(pTalk);
            //TextPointer pointer = this.Document.ContentEnd;
            //if (pointer != null)
            //{
            //    CaretPosition = pointer;
            //}
            //CaretPosition.InsertTextInRun(" ");//加入空格
            //TextPointer pp = CaretPosition.GetPositionAtOffset(1);
            //if (pp != null)
            //{
            //    CaretPosition = pp;
            //}
        }
Example #6
0
        public RichTextEditorToolbar()
        {
            InitializeComponent();

            Func <CancellationToken, Task <Stream> > streamFunc = ct => Task.Run(() =>
            {
                Assembly assembly = typeof(RichTextEditorToolbar).Assembly;
                string fileName   = assembly.GetManifestResourceNames().FirstOrDefault(n => n.Contains("richtexteditor-htmlsource.html"));
                Stream stream     = assembly.GetManifestResourceStream(fileName);
                return(stream);
            });

            this.richTextEditor.Source = RichTextSource.FromStream(streamFunc);
        }
        public CustomContextMenu()
        {
            InitializeComponent();

            // >> richtexteditor-contextmenu-setvm
            this.BindingContext = new ViewModel();
            // << richtexteditor-contextmenu-setvm

            var htmlSource = @"<h4>One of the Most Beautiful Islands on Earth - Tenerife</h4>
                        <p><strong>Tenerife</strong> is the largest and most populated island of the eight <a href='https://en.wikipedia.org/wiki/Canary_Islands' target='_blank'>Canary Islands</a>.</p>
                        <p style='color:#808080'>It is also the most populated island of <strong>Spain</strong>, with a land area of <i>2,034.38 square kilometers</i> and <i>904,713</i> inhabitants, 43% of the total population of the <strong>Canary Islands</strong>.</p>";

            this.richTextEditor.Source = RichTextSource.FromString(htmlSource);
            this.richTextEditor.Behaviors.Add(new PickImageBehavior());
        }
        public PickerPopupPlacement()
        {
            this.InitializeComponent();

            Func <Stream> streamFunc = () =>
            {
                var assembly = typeof(PickerPopupPlacement).Assembly;
                var fileName = assembly.GetManifestResourceNames()
                               .FirstOrDefault(resourceName => resourceName.Contains("richtexteditor-htmlsource.html"));

                return(assembly.GetManifestResourceStream(fileName));
            };

            this.richTextEditor.Source = RichTextSource.FromStream(streamFunc);
        }
Example #9
0
        public InsertImages()
        {
            InitializeComponent();

            // >> rte-insert-images-add-rte-source
            Func <CancellationToken, Task <Stream> > streamFunc = ct => Task.Run(() =>
            {
                Assembly assembly = typeof(InsertImages).Assembly;
                string fileName   = assembly.GetManifestResourceNames().FirstOrDefault(n => n.Contains("PickYourHoliday.html"));
                Stream stream     = assembly.GetManifestResourceStream(fileName);
                return(stream);
            });

            this.richTextEditor.Source = RichTextSource.FromStream(streamFunc);
            // << rte-insert-images-add-rte-source
        }
        public ReadOnlyState()
        {
            InitializeComponent();
            // >> richtexteditor-readonly-state-code-behind
            Func <CancellationToken, Task <Stream> > streamFunc = ct => Task.Run(() =>
            {
                Assembly assembly = typeof(ReadOnlyState).Assembly;
                string fileName   = assembly.GetManifestResourceNames().FirstOrDefault(n => n.Contains("richtexteditor-htmlsource.html"));
                Stream stream     = assembly.GetManifestResourceStream(fileName);
                return(stream);
            });

            this.richTextEditor.Source = RichTextSource.FromStream(streamFunc);
            // << richtexteditor-readonly-state-code-behind

            this.richTextEditor.Behaviors.Add(new PickImageBehavior());
        }
Example #11
0
        public FirstLookViewModel()
        {
            this.resourceService = DependencyService.Get <IResourceService>();

            this.RecipientsItemSource = new List <string>
            {
                "VacationWander",
                "Joshua Price",
                "Reuben Holmes",
                "Eva Lawson",
                "Rory Baxter",
                "David Webb",
                "Howard Pittman",
                "Davis Anderson",
                "Cannon Puckett",
                "Xavi Vasquez",
                "Ronald Hatfield",
                "Freda Curtis",
                "Jeffery Francis",
                "Eva Lawson",
                "Emmett Santos",
                "Vada Davies",
                "Jenny Fuller",
                "Terrell Norris",
                "Vadim Saunders",
                "Nida Carty",
                "Niki Samaniego",
                "Valdex Mills",
                "Layton Buck",
                "Alex Ramos",
                "Alena Cline",
                "Joel Walsh",
                "Vadik Pearson",
                "Bob Carty",
                "Carol Samaniego",
                "Greg Nikolas",
                "Ivan Ivanov",
                "Konny Mills",
                "Matias Santos",
                "Peter Bence",
                "Quincy Sanchez",
            };

            this.Source           = RichTextSource.FromStream(() => this.resourceService.GetResourceStream("PickYourHoliday.html"));
            this.SendEmailCommand = new Command(SendEmail);
        }
        public CustomImagePicker()
        {
            InitializeComponent();

            // >> rte-custom-image-picker-initialize-images
            InitializeImages();
            // << rte-custom-image-picker-initialize-images

            // >> rte-custom-image-picker-html-document
            Func <CancellationToken, Task <Stream> > streamFunc = ct => Task.Run(() =>
            {
                string fileName = this.currentAssembly.GetManifestResourceNames().FirstOrDefault(n => n.Contains("pick-image-demo.html"));
                Stream stream   = this.currentAssembly.GetManifestResourceStream(fileName);
                return(stream);
            });

            this.richTextEditor.Source = RichTextSource.FromStream(streamFunc);
            // << rte-custom-image-picker-html-document
        }
Example #13
0
        /// <summary>
        /// 按中文查询
        /// </summary>
        /// <param name="condition"></param>
        private List <string> ChineseQuery(string condition)
        {
            List <AntSdkGroupMember> contactsList = RichTextSource.Where(c => c.userName.Contains(condition) && c.userId != AntSdkService.AntSdkCurrentUserInfo.userId).ToList();//AntSdkService.AntSdkListContactsEntity.contacts.users.Where(c => c.userName.Contains(condition)).ToList();

            if (!contactsList.Any())
            {
                return(null);
            }
            List <string> resultList = contactsList.Select(t => t.userNum + t.userName + "  [" + t.position + "]").ToList();

            //GetGroupMembers_User isUserMember =
            //      RichTextSource.SingleOrDefault((m => m.userId == AntSdkService.AntSdkCurrentUserInfo.userId));
            //if (isUserMember != null && isUserMember.roleLevel == 1)
            //{
            //    resultList.Add("全体成员");
            //}
            //resultList.Insert(0,"全体成员");
            return(resultList);
        }