protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            if (this.NavigationContext.QueryString.ContainsKey("user"))
            {
                string title = this.NavigationContext.QueryString["title"];
                if (title.Length > 3 && title.Substring(0, 3) == "Re:")
                {
                    TitleText.Text = title;
                }
                else
                {
                    TitleText.Text = "Re: " + title;
                }

                UserText.Text = this.NavigationContext.QueryString["user"];
                reid          = int.Parse(this.NavigationContext.QueryString["reid"]);

                ContentText.Focus();
            }
            else
            {
                UserText.Focus();
            }
        }
Beispiel #2
0
        void ReleaseDesignerOutlets()
        {
            if (BackButton != null)
            {
                BackButton.Dispose();
                BackButton = null;
            }

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

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

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

            if (HeaderLabel != null)
            {
                HeaderLabel.Dispose();
                HeaderLabel = null;
            }
        }
        // GET: Admin/ContentText/Draft/<ModuleID>
        public ActionResult Draft(Guid id)
        {
            ContentText ct = new ContentText(id);
            ContentTextDraftViewModel contentText = new ContentTextDraftViewModel(ct);

            return(View(contentText));
        }
Beispiel #4
0
        void ReleaseDesignerOutlets()
        {
            if (BackButton != null)
            {
                BackButton.Dispose();
                BackButton = null;
            }

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

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

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

            if (ScrollView != null)
            {
                ScrollView.Dispose();
                ScrollView = null;
            }
        }
Beispiel #5
0
        private List <string> GetSplittedString()
        {
            if (!ContentText.ToLower().Contains(HighlightText.ToLower()))
            {
                return new List <string>()
                       {
                           ContentText
                       }
            }
            ;

            int           startIndex    = ContentText.IndexOf(HighlightText, StringComparison.OrdinalIgnoreCase);
            List <string> splittedTexts = new List <string>();
            string        matchedText   = ContentText.Substring(startIndex, HighlightText.Length);
            string        startText     = startIndex > 0 ? ContentText.Substring(0, startIndex) : string.Empty;
            string        lastText      = ContentText.Substring(startIndex + HighlightText.Length);

            if (!string.IsNullOrEmpty(startText))
            {
                splittedTexts.Add(startText);
            }

            if (!string.IsNullOrEmpty(matchedText))
            {
                splittedTexts.Add(matchedText);
            }

            if (!string.IsNullOrEmpty(lastText))
            {
                splittedTexts.Add(lastText);
            }

            return(splittedTexts);
        }
    }
Beispiel #6
0
        void ReleaseDesignerOutlets()
        {
            if (BackButton != null)
            {
                BackButton.Dispose();
                BackButton = null;
            }

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

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

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

            if (UrlLabel != null)
            {
                UrlLabel.Dispose();
                UrlLabel = null;
            }
        }
Beispiel #7
0
        private string Importation(NumberOfMessage numberOfMessage)
        {
            string kindMessage = Option.IMPORTACAO;
            string message     = MessagesOfReturn.Message(numberOfMessage, kindMessage);
            IDictionary <string, List <string> > objectsToRequest = new DatasToRequest4(kindMessage).GetDatasToRequest();
            ContentText contentForSave = new ContentText(numberOfMessage, kindMessage);

            return(new ProcessMessage <ResponseMessage4>(objectsToRequest, contentForSave).Process());
        }
Beispiel #8
0
        /// <summary>
        /// 光标所在处添加内容光标后移
        /// </summary>
        /// <param name="text"></param>
        public void CurrentWrite(string text)
        {
            var index = ContentText.CaretOffset;
            var str   = ContentText.Text;
            var str1  = str.Substring(0, index);
            var str2  = str.Substring(index);

            ContentText.Text        = str1 + text + str2;
            ContentText.CaretOffset = index + text.Length;
            ContentText.Focus();
        }
Beispiel #9
0
        public PopUpNews(Stream stream) : base(stream)
        {
            using (BinaryDataReader reader = new BinaryDataReader(stream, true))
            {
                // Read the title key
                reader.Seek(0x50, SeekOrigin.Begin);
                TitleKey = reader.ReadString(StringDataFormat.ZeroTerminated, Encoding.ASCII);

                // Read the content key
                reader.Seek(0x90, SeekOrigin.Begin);
                ContentKey = reader.ReadString(StringDataFormat.ZeroTerminated, Encoding.ASCII);

                // Split the title key by underscores
                string[] splitKey = TitleKey.Split("_");

                // Check if this is a pop-up for an event
                if (splitKey[2] == "event")
                {
                    // Combine the event ID and the pop-up ID
                    Id = splitKey[3] + "_" + splitKey[4];

                    // Set the event flag
                    IsPopUpForEvent = true;
                }
                else
                {
                    // The ID is simply the last entry
                    Id = splitKey.Last();

                    // Set the event flag
                    IsPopUpForEvent = false;
                }

                // Seek to the data
                reader.Seek(0xF0, SeekOrigin.Begin);

                // Read the MSBTs
                Dictionary <Language, Dictionary <string, string> > msbts = this.ReadMsbts(reader);

                // Loop over every MSBT combination
                foreach (KeyValuePair <Language, Dictionary <string, string> > pair in msbts)
                {
                    // Add the title and content to their respective Dictionaries
                    TitleText.Add(pair.Key, pair.Value[TitleKey]);
                    ContentText.Add(pair.Key, pair.Value[ContentKey]);
                }

                // Read the image
                Image = this.ReadDataEntry(reader);

                // Read the URL
                Url = this.ReadDataEntryAsString(reader);
            }
        }
Beispiel #10
0
 private async Task AddContentTexts(int parentId, List <IncludedItemDTO> items)
 {
     foreach (var item in items)
     {
         var dbItem = new ContentText();
         dbItem.ParentContentId = parentId;
         dbItem.ContentTextId   = item.Id;
         dbItem.Seq             = item.Seq;
         _dataContext.ContentTexts.Add(dbItem);
     }
     await _dataContext.SaveChangesAsync();
 }
Beispiel #11
0
        public void Notice(string message, string title = "")
        {
            Form form = new Form(title);

            ContentText msg = new ContentText(message);
            Button      btn = new Button("OK");

            form.AddControl(msg);
            form.AddControl(btn);

            SendForm(form);
        }
Beispiel #12
0
        async void Reload_Clicked(object sender, EventArgs e)
        {
            OverlayText.Opacity   = 0;
            OverlayText.IsVisible = false;
            ContentText.Opacity   = 0;
            await StampedCard.ScaleTo(0, 150, Easing.CubicInOut);

            // TodayCard.BackgroundColor = Color.White;
            StampedCard.BackgroundColor = Color.FromHex("7C4DFF");
            await ContentText.FadeTo(1, 0);

            await StampedCard.ScaleTo(1, 150, Easing.CubicInOut);
        }
        public void OnFailure(TransactionFailureResult result)
        {
            // Get information about the rejected transaction
            TransactionType  transType        = result.TransactionType;
            TransactionId    ecrTransId       = result.EcrTransactionId;
            TransactionId    terminalTransId  = result.TerminalTransactionId;
            FailureErrorType errorType        = result.Error;
            string           additionalReason = result.AdditionalReason;
            List <Receipt>   receipts         = result.Receipts;

            foreach (Receipt receipt in receipts)
            {
                DocumentType   documentType      = receipt.DocumentType;
                bool?          signatureRequired = receipt.SignatureRequired;
                ReceiptContent receiptContent    = receipt.Content;
                if (receiptContent.Format == ReceiptFormatType.Text)
                {
                    ContentText contentText      = receiptContent.Text;
                    string      plainTextReceipt = contentText.PlainText;
                }
            }
            List <Token> tokens = result.Tokens;

            foreach (Token token in tokens)
            {
                TokenType           tokenType           = token.Type;
                string              tokenValue          = token.Value;
                DateTime?           tokenExpiry         = token.Expiry;
                string              tokenSchemeId       = token.SchemeId;
                EnrolmentStatusType?enrolmentStatusType = token.EnrolmentStatus;
            }
            // TokenResponses give info about the result of token lookups and
            // provides an alternative way to get the token when the lookup was successful.
            List <TokenResponse> tokenResponses = result.TokenResponses;

            foreach (TokenResponse tokenResponse in tokenResponses)
            {
                TokenRequest tokenRequest  = tokenResponse.TokenRequest;
                string       tokenSchemeId = tokenRequest.SchemeId;
                if (tokenResponse.Result == TokenResultType.Success)
                {
                    Token token = tokenResponse.Token;
                }
                else
                {
                    TokenFailureErrorType?tokenErrorType = tokenResponse.Error;
                    string tokenErrorDescription         = tokenResponse.AdditionalReason;
                }
            }
        }
        public ActionResult Draft(ContentTextDraftViewModel contentTextDraftViewModel)
        {
            try {
                if (ModelState.IsValid)
                {
                    ContentText contentText = new ContentText(contentTextDraftViewModel);
                    contentText.SaveChanges(contentTextDraftViewModel);
                }

                return(RedirectToAction("edit", "pages", new { id = contentTextDraftViewModel.PageID }));
            } catch {
                return(View());
            }
        }
        public void OnPrintRequest(PrintRequestData requestData, IPrintReceiver printReceiver)
        {
            // Get information about the requested print received from the terminal
            DocumentType documentType = requestData.DocumentType;
            PrintContent printContent = requestData.Content;

            if (printContent.Format == PrintFormatType.Text)
            {
                ContentText contentText    = printContent.Text;
                string      plainTextPrint = contentText.PlainText;
            }
            // Handle print
            // Return response
            printReceiver.PrintSuccess();
        }
    public void Layout(System.Action action)
    {
        if (action != null)
        {
            action();
        }
        _ui();
        var maxHeight = (float)(51.5 / 667.0) * Display.main.systemHeight;

        if (ContentText.text != null && ContentText.text != string.Empty && ContentText.preferredHeight > maxHeight)
        {
            Destroy(ContentText.GetComponent <UnityEngine.UI.ContentSizeFitter>());
            ContentText.rectTransform.sizeDelta = new Vector2(ContentText.rectTransform.sizeDelta.x, maxHeight);
        }
    }
        public ActionResult HistoryMakeDraft(ContentTextHistoryViewModel data)
        {
            try {
                if (ModelState.IsValid)
                {
                    ContentText contentText = new ContentText(data.ModuleID);
                    contentText.MakeDraft(data.ContentID);
                }

                return(RedirectToAction("draft", "contenttext", new { id = data.ModuleID }));
            } catch {
                ContentText ct = new ContentText(data.ContentID);
                return(View(ct));
            }
        }
        public void OnDisplayRequest(DisplayRequestData displayRequestData)
        {
            // Get information about the display message received from the terminal
            List <DisplayOutput> displayMessages = displayRequestData.DisplayOutput;

            foreach (DisplayOutput displayMessage in displayMessages)
            {
                DeviceType     displayMessageType    = displayMessage.DeviceType;
                DisplayContent displayMessageContent = displayMessage.Content;
                if (displayMessageContent.Format == DisplayFormatType.Text)
                {
                    ContentText contentText             = displayMessageContent.Text;
                    string      plainTextDisplayMessage = contentText.PlainText;
                }
            }
        }
Beispiel #19
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            string copyingSong = "";

            if (NavigationContext.QueryString.TryGetValue("CopyingSong", out copyingSong))
            {
                int mysong = int.Parse(copyingSong);
                settings.CurrSongSetting = mysong;
                DataContext = App.VirtualSongBook.SongList[mysong];
                int    fontsize   = settings.FontSizeSetting / 2;
                string ContText   = strParser(App.VirtualSongBook.SongList[mysong].Content);
                string SiteHeader = "<!DOCTYPE html><head><title>vSongBook On a Window</title><style>html{font-size:" +
                                    fontsize + "px;}</style>";
                ContentText.NavigateToString(SiteHeader + "</head><body><p>" + ContText + "<br>" +
                                             "</p><p><br><br>Via vSongBook</p></body></html>");
            }
        }
Beispiel #20
0
        private void OnContentTextSelectionChanged(
            object sender, RoutedEventArgs e)
        {
            if (_viewModel != null)
            {
                _viewModel.SelectedText = ContentText.SelectedText;

                var selectionStart = ContentText.SelectionStart;
                var line           = ContentText
                                     .GetLineIndexFromCharacterIndex(selectionStart);
                var column = selectionStart -
                             ContentText.GetCharacterIndexFromLineIndex(line);
                _viewModel.CaretLine    = line;
                _viewModel.CaretColumn  = column;
                _viewModel.IndexOfCaret = selectionStart;
            }
        }
        public void MovieTextAssertion()
        {
            List <string> listOfTables = new List <string>();

            List <string> listOfContext = new List <string>()
            {
                "Title",
                "Running time",
                "Genre",
                "Description",
                "Release date"
            };

            for (int i = 0; i < MovieContent.Count(); i++)
            {
                List <string> listOfContent = new List <string>();

                listOfTables.Add(MovieContent[i].ToString());

                for (int j = 0; j < ContentText.Count(); j++)
                {
                    if (j == 0)
                    {
                        listOfContent.Add(ContentText[j].Text.Substring(0, 5));
                    }
                    if (j == 1)
                    {
                        listOfContent.Add(ContentText[j].Text.Substring(0, 12));
                    }
                    if (j == 2)
                    {
                        listOfContent.Add(ContentText[j].Text.Substring(0, 5));
                    }
                    if (j == 3)
                    {
                        listOfContent.Add(ContentText[j].Text.Substring(0, 11));
                    }
                    if (j == 4)
                    {
                        listOfContent.Add(ContentText[j].Text.Substring(0, 12));
                    }
                    Assert.AreEqual(listOfContext[j], listOfContent[j]);
                }
            }
        }
Beispiel #22
0
            internal void Draw()
            {
                // Get the start position of the notification
                var pos = Position;

                // Draw the textures
                if (Header != null)
                {
                    Header.Color = Color.FromArgb(AlphaLevel, Content.Color);
                    Header.Draw(pos + Handle.Texture.Header.Position ?? Vector2.Zero, Handle.Texture.Header.SourceRectangle);
                }
                if (Content != null)
                {
                    Content.Color = Color.FromArgb(AlphaLevel, Content.Color);
                    Content.Draw(pos + Handle.Texture.Content.Position ?? Vector2.Zero, Handle.Texture.Content.SourceRectangle, null, null, new Vector2(1, ContentScale));
                }
                if (Footer != null)
                {
                    Footer.Color = Color.FromArgb(AlphaLevel, Footer.Color);
                    if (ContentScale > 1)
                    {
                        int extraHeight;
                        if (Handle.Texture.Footer.SourceRectangle.HasValue)
                        {
                            extraHeight = Height - Handle.Texture.Footer.SourceRectangle.Value.Height;
                        }
                        else
                        {
                            extraHeight = Height - Footer.Texture.GetLevelDescription(0).Height;
                        }
                        Footer.Draw(pos + new Vector2(0, extraHeight), Handle.Texture.Footer.SourceRectangle);
                    }
                    else
                    {
                        Footer.Draw(pos + Handle.Texture.Footer.Position ?? Vector2.Zero, Handle.Texture.Footer.SourceRectangle);
                    }
                }

                // Draw the text
                HeaderText.Draw(Handle.HeaderText, Color.FromArgb(AlphaLevel, HeaderText.Color),
                                new Rectangle((int)(pos.X + Width - HeaderText.Width - TextOuterPadding.X), (int)(pos.Y + TextOuterPadding.Y), (int)HeaderText.Size.X, (int)HeaderText.Size.Y));
                ContentText.Draw(Handle.ContentText, Color.FromArgb(AlphaLevel, ContentText.Color),
                                 new Rectangle((int)(pos.X + Width - ContentText.Width - TextOuterPadding.X), (int)(pos.Y + TextOuterPadding.Y + HeaderText.Size.Y + HeaderToContentSpace),
                                               (int)ContentText.Size.X, (int)ContentText.Size.Y));
            }
        /// <summary>
        /// Salva o arquivo XML do objeto xmlOriginal no diretóro do servidor
        /// </summary>
        /// <param name="xmlOriginal">Objeto que contém as propriedades do XML que será gravado</param>
        /// <exception cref="ChangeXmlException">Lança a exceção do tipo ChangeXmlException com uma mensagem e internamente as exeções que ocorreram</exception>
        public static void SaveXML(ContentText xmlOriginal)
        {
            //Verifica se o arquivo deve ser salva
            if (xmlOriginal.IsConditionsAcceptableForSaveText)
            {
                try
                {
                    RecordFile.CreateDirectorIfNotExisty(xmlOriginal.DirectoryFileSaveFileText);

                    RecordFile.SaveFile(xmlOriginal.PathFileSaveFileText, xmlOriginal.Content);
                }
                catch (Exception ex)
                {
                    string msg = MessagesOfReturn.ExceptionSaveXml(xmlOriginal.PathFileSaveFileText);
                    throw new ChangeXmlException(msg, ex);
                }
            }
        }
Beispiel #24
0
 private void OnGoToRequested(
     int start,
     int selectionLength,
     int line)
 {
     if (start > 0)
     {
         if (selectionLength > 0)
         {
             ContentText.Select(start, selectionLength);
         }
         else
         {
             ContentText.CaretIndex = start;
         }
         ContentText.ScrollToLine(line);
         Focus();
     }
 }
Beispiel #25
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            /* Note:
             * This functionality is not planned for release 1.0. Kept for future use.
             *
             * //Line with email and phone number
             * //string mail = SettingsPage4ViewModel.EMAIL_TEXT + " " + SettingsPage4ViewModel.EMAIL;
             * //string phoneNum = SettingsPage4ViewModel.PHONE_NUM_Text + " " + SettingsPage4ViewModel.PHONE_NUM;
             *
             * //Opening hours
             * //string monThu = "•  " + SettingsPage4ViewModel.PHONE_OPEN_MON_THU;
             * //string fri = "•  " + SettingsPage4ViewModel.PHONE_OPEN_FRE;
             * //string sunHoly = SettingsPage4ViewModel.PHONE_OPEN_SAT_SUN_HOLY;
             * //string openingHours = SettingsPage4ViewModel.PHONE_OPEN_TEXT + "<br><br>" + monThu + "<br>" + fri + "<br><br>" + sunHoly;
             *
             * //Contract info section
             * //string contactsInfo = "<br><br>" + mail + "<br>" + phoneNum + ".<br><br>" + openingHours;
             *
             */

            //Support url and associated text
            string urlStringAndText = SettingsPage4ViewModel.CONTENT_TEXT_BEFORE_SUPPORT_LINK + " " + "<a href=" + SettingsPage4ViewModel.SUPPORT_LINK + ">" + SettingsPage4ViewModel.SUPPORT_LINK_SHOWN_TEXT + "</a>";

            //Concatenation the content
            string content = urlStringAndText; // + contactsInfo;

            ContentText.SetAttributedText(content);
            ContentText.AccessibilityTraits    = UIAccessibilityTrait.Link;
            ContentText.WeakDelegate           = new OpenTextViewUrlInWebviewDelegate(this);
            ContentText.WeakLinkTextAttributes = new NSDictionary(UIStringAttributeKey.ForegroundColor, ColorHelper.LINK_COLOR, UIStringAttributeKey.UnderlineStyle, new NSNumber(1));

            //Ensuring text is resiezed correctly when font size is increased
            HeaderLabel.SetAttributedText(SettingsPage4ViewModel.HEADER);
            BackButton.AccessibilityLabel = SettingsViewModel.BACK_BUTTON_ACCESSIBILITY_TEXT;

            HeaderLabel.AccessibilityTraits = UIAccessibilityTrait.Header;

            SetupStyling();
        }
        public void OnInputRequest(InputRequestData requestData, IInputReceiver inputReceiver)
        {
            Console.WriteLine($"TransactionListener OnInputRequest InputRequestData: {requestData} , IInputReceiver: {inputReceiver}");
            // Get information about the request for input from the terminal
            InputRequestType inputType    = requestData.InputType;
            DeviceType       inputDevice  = requestData.DeviceType;
            string           inputDefault = requestData.DefaultInputString;
            int?           inputTimeout   = requestData.TimeoutInSeconds;
            int?           inputMinLength = requestData.MinLength;
            int?           inputMaxLength = requestData.MaxLength;
            DisplayOutput  output         = requestData.DisplayOutput;
            DeviceType     outputDevice   = output.DeviceType;
            DisplayContent outputContent  = output.Content;

            if (outputContent.Format == DisplayFormatType.Text)
            {
                ContentText contentText             = outputContent.Text;
                string      plainTextDisplayMessage = contentText.PlainText;
            }
            // Return user input
            inputReceiver.InputText("1234"); //see chapter "Input requests" for details
        }
        void ReleaseDesignerOutlets()
        {
            if (CancelButton != null)
            {
                CancelButton.Dispose();
                CancelButton = null;
            }

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

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

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

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

            if (HeaderText != null)
            {
                HeaderText.Dispose();
                HeaderText = null;
            }
        }
Beispiel #28
0
        public Present(Stream stream) : base(stream)
        {
            using (BinaryDataReader reader = new BinaryDataReader(stream, true))
            {
                // Read the title key
                reader.Seek(0x50, SeekOrigin.Begin);
                TitleKey = reader.ReadString(StringDataFormat.ZeroTerminated, Encoding.ASCII);

                // Read the content key
                reader.Seek(0x90, SeekOrigin.Begin);
                ContentKey = reader.ReadString(StringDataFormat.ZeroTerminated, Encoding.ASCII);

                // Parse the ID from the title key
                Id = TitleKey.Split("_").Last();

                // Seek to the data
                reader.Seek(0xF0, SeekOrigin.Begin);

                // Read the MSBTs
                Dictionary <Language, Dictionary <string, string> > msbts = this.ReadMsbts(reader);

                // Loop over every MSBT combination
                foreach (KeyValuePair <Language, Dictionary <string, string> > pair in msbts)
                {
                    // Add the title and content to their respective Dictionaries
                    TitleText.Add(pair.Key, pair.Value[TitleKey]);
                    ContentText.Add(pair.Key, pair.Value[ContentKey]);
                }

                // Read the image
                Image = this.ReadDataEntry(reader);

                // Seek to the unknown
                reader.Seek(0x174, SeekOrigin.Begin);
                SpiritId = reader.ReadUInt32();
            }
        }
        // GET: Admin/ContentText/history/<ModuleID>
        public ActionResult History(Guid id)
        {
            ContentText contentText = new ContentText(id);

            return(View(contentText));
        }
Beispiel #30
0
        /// <summary>
        /// 自动格式化
        /// </summary>
        /// <param name="editor"></param>
        public void AutoFormat()
        {
            var index = ContentText.CaretOffset;

            var text     = ContentText.Text;
            var tempkey  = "" + ((char)1);
            var tempkey2 = "" + ((char)2) + ((char)2);
            var tempkey3 = "" + ((char)3) + ((char)3);

            text = text.Replace("\\", tempkey);
            text = text.Replace(tempkey + tempkey, tempkey2);
            text = text.Replace(tempkey + "\"", tempkey3);
            var result = "";
            var strs   = text.Split('\"');
            var parse  = "";

            for (int i = 0; i < strs.Length; i += 1)
            {
                if (i % 2 == 1)
                {
                    result += "\"" + strs[i] + "\"";
                }
                else
                {
                    if (result.Length + strs[i].Length <= index)
                    {
                        var formatstr = Format(strs[i], ref parse);
                        index  += formatstr.Length - strs[i].Length;
                        result += formatstr;
                    }
                    else if (result.Length < index)
                    {
                        var str1      = strs[i].Substring(0, index - result.Length);
                        var str2      = strs[i].Substring(index - result.Length);
                        var formatstr = Format(str1, ref parse);
                        index += formatstr.Length - str1.Length;
                        if (formatstr.EndsWith("\n\n") && str2.StartsWith("\n"))
                        {
                            formatstr = formatstr.Substring(0, formatstr.Length - 1);
                            index    -= 1;
                        }
                        else if (formatstr.EndsWith(";\n") && str2.StartsWith("\n"))
                        {
                            formatstr = formatstr.Substring(0, formatstr.Length - 1);
                            index    -= 1;
                        }
                        result += formatstr;
                        result += Format(str2, ref parse);
                    }
                    else
                    {
                        result += Format(strs[i], ref parse);
                    }
                }
            }
            result = result.Replace(tempkey3, tempkey + "\"");
            result = result.Replace(tempkey2, tempkey + tempkey);
            result = result.Replace(tempkey, "\\");

            ContentText.Text = result;

            ContentText.CaretOffset = index;
            ContentText.Focus();
        }
Beispiel #31
0
 /// <summary>
 /// Insert data
 /// </summary>
 /// <param name="line"></param>
 public void insertData(ContentText line)
 {
     if (line == null)
     {
         return;
     }
     lock (text)
     {
         text.Add(line);
     }
 }
Beispiel #32
0
        private void DrawPart(ContentText text, TextBuffer tb = null)
        {
            if (tb == null)
            {
                tb = richTextBox.Buffer;
            }

            Gtk.TextIter iter = tb.EndIter;

            TextTag format = new TextTag(null);

            format.FontDesc = DefaultFont;

            if (text.Bold)
            {
                format.Weight = Pango.Weight.Bold;
                if (Configuration.Scrollback.UnderlineBold)
                {
                    format.Underline = Pango.Underline.Double;
                }
            }

            if (text.Underline)
            {
                format.Underline = Pango.Underline.Single;
            }

            if (text.Italic)
            {
                format.Style = Pango.Style.Italic;
                format.BackgroundGdk = Core.FromColor(text.TextColor);
                format.ForegroundGdk = Core.FromColor(Configuration.CurrentSkin.BackgroundColor);
            }

            if (text.Link != null)
            {
                format.TextEvent += new TextEventHandler(LinkHandler);
            }
            else
            {
                format.TextEvent += new TextEventHandler(LinkRm);
            }

            format.Data.Add("link", text.Link);
            format.Data.Add("identifier", text.Text);
            if (!text.Italic)
            {
                format.ForegroundGdk = Core.FromColor(text.TextColor);
            }
            tb.TagTable.Add(format);
            //format.SizePoints = Configuration.CurrentSkin.FontSize;
            tb.InsertWithTags(ref iter, text.Text, format);
        }
Beispiel #33
0
        /// <summary>
        /// Insert a part
        /// </summary>
        /// <param name="text"></param>
        /// <param name="drawLine"></param>
        public void InsertPart(ContentText text, bool drawLine = true)
        {
            if (Core._KernelThread != System.Threading.Thread.CurrentThread)
            {
                throw new Core.PidgeonException("You can't call this function from different thread");
            }

            if (text == null)
            {
                throw new Core.PidgeonException("You can't insert null to text box");
            }

            if (CurrentLine == null)
            {
                CurrentLine = new Line(this);
            }

            CurrentLine.insertData(text);

            if (drawLine)
            {
                DrawPart(text);
            }
        }