NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

<ig:XamRichTextEditor x:Name="ContextView"
Margin="0,0,0,4"
AllowDocumentViewSplitting="False"
BorderBrush="{StaticResource WhiteBrush}"
BorderThickness="1"
Document="{Binding Path=Data}"
FontFamily="{Binding Path=FontFamily,
RelativeSource={RelativeSource AncestorType={x:Type Window},
AncestorLevel=1},
diag:PresentationTraceSources.TraceLevel=High}"
FontSize="{Binding Path=FontSize,
RelativeSource={RelativeSource AncestorType={x:Type Window},
AncestorLevel=1},
diag:PresentationTraceSources.TraceLevel=High}">
<ig:XamRichTextEditor.ClipboardSerializationProviders>
<ig:WordSerializationProvider />
<ig:RtfSerializationProvider />
<ig:HtmlSerializationProvider />
</ig:XamRichTextEditor.ClipboardSerializationProviders>
</ig:XamRichTextEditor>











class DocumentContext
{
readonly CharacterSettings csWithBold = new CharacterSettings { Bold = true };
readonly CharacterSettings csWithoutBold = new CharacterSettings();
readonly RichTextDocument document;
ParagraphNode currentParagraphNode;

public DocumentContext()
{
document = new RichTextDocument { IsReadOnly = true };
document.RootNode.Body.ChildNodes.Clear();
}

public RichTextDocument Document
{
get { return document; }
}

public void AddTitle(string content)
{
var rn = new RunNode();
rn.SetText(content + Environment.NewLine);
rn.Settings = csWithBold;
currentParagraphNode.ChildNodes.Add(rn);
}

public void AddContent(string contentTitle, string contentDescription)
{
AddText(csWithBold, contentTitle);
AddText(csWithoutBold, contentDescription);
}

public void AddNewLine()
{
AddText(csWithoutBold, Environment.NewLine);
}

public void CreateParagraphNode()
{
currentParagraphNode = new ParagraphNode();
document.RootNode.Body.ChildNodes.Add(currentParagraphNode);
}

static RunNode CreateRunNodeWithContent(CharacterSettings cs, string content)
{
var rn = new RunNode();
if (cs != null)
{
rn.Settings = cs;
}
if (content != null)
{
rn.SetText(content);
}
return rn;
}

void AddText(CharacterSettings cs, string content)
{
var rn = new RunNode();
rn.SetText(content);
if (cs != null)
{
rn.Settings = cs;
}
currentParagraphNode.ChildNodes.Add(rn);
}

#region Table related

public void CreateTable(IMeasurementContext context)
{
var rowCounter = 0;

// text character settings
var charSettings = new CharacterSettings() { Color = new ColorInfo(Color.FromArgb(255, 85, 85, 85)) };

// setting for headers
var headerSettings = new TableCellSettings
{
Shading = new Shading(new ColorInfo(Color.FromArgb(255, 232, 234, 235)))
};

// settings for non-highlighted rows
var rowSettings = new TableCellSettings
{
Shading = new Shading(new ColorInfo(Color.FromArgb(255, 252, 252, 252)))
};

// settings for highlighted rows
var rowAlternatingSettings = new TableCellSettings
{
Shading = new Shading(new ColorInfo(Color.FromArgb(255, 246, 246, 246)))
};

// create table settings
var tableBorder = new RichTextBorder()
{
Color = Color.FromArgb(255, 224, 224, 224),
BorderType = RichTextBorderType.Single,
Size = new Extent(1, ExtentUnitType.LogicalPixels),
};
ParagraphSettings paragraphSettings;
TableNode tn;
TableSettings tableSettings;
var paragraphSetting = ParagraphSettings(
context,
document,
tableBorder,
out tn,
out paragraphSettings,
out tableSettings);

foreach (var trn in tn.ChildNodes.Cast<TableRowNode>())
{
if (rowCounter == 0)
{
// populating headers
GetHeadersValue(context, trn, headerSettings, charSettings);
}
else
{
// populating data
GetRowsValue(
context,
rowCounter,
trn,
rowAlternatingSettings,
rowSettings,
paragraphSetting,
charSettings);
}

rowCounter++;
}
}

static ParagraphSettings ParagraphSettings(
IMeasurementContext context,
RichTextDocument data,
RichTextBorder tableBorder,
out TableNode tn,
out ParagraphSettings paragraphSettings,
out TableSettings tableSettings)
{
string error;
tableSettings = new TableSettings
{
Borders =
new TableBorderSettings
{
Top = tableBorder,
Bottom = tableBorder,
Start = tableBorder,
End = tableBorder
}
};
//create cell settings to center elements
paragraphSettings = new ParagraphSettings
{
TextAlignment = ParagraphTextAlignment.Center,
ParagraphAlignment = ParagraphAlignment.Center
};

tn = data.InsertTable(
data.AggregateOffsetCount,
2,
Channels.ToList().Count + 1,
out error);
tn.Settings = tableSettings;
return paragraphSettings;
}

static void GetRowsValue(
IMeasurementContext context,
int rowCounter,
TableRowNode trn,
TableCellSettings rowAlternatingSettings,
TableCellSettings rowSettings,
ParagraphSettings paragraphSettings,
CharacterSettings charSettings)
{
var b = context.Settings.Channels.DownlinkChannels.ElementAt(rowCounter - 1);

TableCellNode tcn = trn.ChildNodes[0] as TableCellNode;
tcn.Settings = rowCounter % 2 != 0 ? rowAlternatingSettings : rowSettings;
ParagraphNode pn = tcn.ChildNodes[0] as ParagraphNode;
pn.Settings = paragraphSettings;
pn.ChildNodes.Add(
CreateRunNodeWithContent(
charSettings,
rowCounter + "n" + String.Format("{0:0.##}", (b.Frequency))));

tcn = trn.ChildNodes[1] as TableCellNode;
tcn.Settings = rowCounter % 2 != 0 ? rowAlternatingSettings : rowSettings;
pn = tcn.ChildNodes[0] as ParagraphNode;
pn.Settings = paragraphSettings;
pn.ChildNodes.Add(
CreateRunNodeWithContent(charSettings, String.Format(
"{0:0.##}",(Gains.ElementAt(rowCounter - 1)))));
}

static void GetHeadersValue(
IMeasurementContext context,
TableRowNode trn,
TableCellSettings headerSettings,
CharacterSettings charSettings)
{
var tcn = trn.ChildNodes[0] as TableCellNode;
tcn.Settings = headerSettings;
var pn = tcn.ChildNodes[0] as ParagraphNode;
pn.ChildNodes.Add(CreateRunNodeWithContent(charSettings, "Channel"));

tcn = trn.ChildNodes[1] as TableCellNode;
tcn.Settings = headerSettings;
pn = tcn.ChildNodes[0] as ParagraphNode;
pn.ChildNodes.Add(
!(context.Settings.IsGood())
? CreateRunNodeWithContent(charSettings, "Input")
: CreateRunNodeWithContent(charSettings, "Output"));
}
#endregion
}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.