Example #1
1
        public void Write(string outputPath, FlowDocument doc)
        {
            Document pdfDoc = new Document(PageSize.A4, 50, 50, 50, 50);
            Font textFont = new Font(baseFont, DEFAULT_FONTSIZE, Font.NORMAL, BaseColor.BLACK);
            Font headingFont = new Font(baseFont, DEFAULT_HEADINGSIZE, Font.BOLD, BaseColor.BLACK);
            using (FileStream stream = new FileStream(outputPath, FileMode.Create))
            {
                PdfWriter writer = PdfWriter.GetInstance(pdfDoc, stream);
                pdfDoc.Open();
                foreach (Block i in doc.Blocks) {
                    if (i is System.Windows.Documents.Paragraph)
                    {
                        TextRange range = new TextRange(i.ContentStart, i.ContentEnd);
                        Console.WriteLine(i.Tag);
                        switch (i.Tag as string)
                        {
                            case "Paragraph": iTextSharp.text.Paragraph par = new iTextSharp.text.Paragraph(range.Text, textFont);
                                par.Alignment = Element.ALIGN_JUSTIFIED;
                                              pdfDoc.Add(par);
                                              break;
                            case "Heading": iTextSharp.text.Paragraph head = new iTextSharp.text.Paragraph(range.Text, headingFont);
                                              head.Alignment = Element.ALIGN_CENTER;
                                              head.SpacingAfter = 10;
                                              pdfDoc.Add(head);
                                              break;
                            default:          iTextSharp.text.Paragraph def = new iTextSharp.text.Paragraph(range.Text, textFont);
                                              def.Alignment = Element.ALIGN_JUSTIFIED;
                                              pdfDoc.Add(def);
                                              break;

                        }
                    }
                    else if (i is System.Windows.Documents.List)
                    {
                        iTextSharp.text.List list = new iTextSharp.text.List(iTextSharp.text.List.UNORDERED, 10f);
                        list.SetListSymbol("\u2022");
                        list.IndentationLeft = 15f;
                        foreach (var li in (i as System.Windows.Documents.List).ListItems)
                        {
                            iTextSharp.text.ListItem listitem = new iTextSharp.text.ListItem();
                            TextRange range = new TextRange(li.Blocks.ElementAt(0).ContentStart, li.Blocks.ElementAt(0).ContentEnd);
                            string text = range.Text.Substring(1);
                            iTextSharp.text.Paragraph par = new iTextSharp.text.Paragraph(text, textFont);
                            listitem.SpacingAfter = 10;
                            listitem.Add(par);
                            list.Add(listitem);
                        }
                        pdfDoc.Add(list);
                    }

               }
                if (pdfDoc.PageNumber == 0)
                {
                    iTextSharp.text.Paragraph par = new iTextSharp.text.Paragraph(" ");
                    par.Alignment = Element.ALIGN_JUSTIFIED;
                    pdfDoc.Add(par);
                }
               pdfDoc.Close();
            }
        }
Example #2
0
 internal static FlowDocument CopyFlowDocument(FlowDocument doc)
 {
     MemoryStream memStream = new MemoryStream();
     XamlWriter.Save(doc, memStream);
     memStream.Seek(0, SeekOrigin.Begin);
     return (FlowDocument)XamlReader.Load(memStream);
 }
Example #3
0
        public about()
        {
            InitializeComponent();
            aboutBox.AddHandler(Hyperlink.RequestNavigateEvent, new RequestNavigateEventHandler(RequestNavigateHandler));
            // Create a FlowDocument to contain content for the RichTextBox.
            FlowDocument myFlowDoc = new FlowDocument();

            // Add paragraphs to the FlowDocument.

            Hyperlink oskarGithub = new Hyperlink();
            oskarGithub.Inlines.Add("github");
            oskarGithub.NavigateUri = new Uri("https://github.com/oskarp/redminetimetask");

            Hyperlink redmineLib = new Hyperlink();
            redmineLib.Inlines.Add("Redmine-net-api");
            redmineLib.NavigateUri = new Uri("https://github.com/zapadi/redmine-net-api");

            // Create a paragraph and add the Run and hyperlink to it.
            Paragraph mePa = new Paragraph();
            mePa.Inlines.Add("This project is open source and hosted at ");
            mePa.Inlines.Add(oskarGithub);
            myFlowDoc.Blocks.Add(mePa);

            Paragraph redminePa = new Paragraph();
            redminePa.Inlines.Add("We use ");
            redminePa.Inlines.Add(redmineLib);
            redminePa.Inlines.Add(" for the redmine communication.");
            myFlowDoc.Blocks.Add(redminePa);

            // Add initial content to the RichTextBox.
            aboutBox.Document = myFlowDoc;
        }
Example #4
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var regEx = new Regex(@"\<a\s(href\=""|[^\>]+?\shref\="")(?<link>[^""]+)"".*?\>(?<text>.*?)(\<\/a\>|$)", RegexOptions.IgnoreCase | RegexOptions.Multiline);

            FlowDocument flowDocument = new FlowDocument();
            string html = AppSettings.HyperlinkifyAll((string)value, "");
            html = html.Replace("<br />", "");
            html = html.Replace("<br/>", "");
            flowDocument.FontFamily = new System.Windows.Media.FontFamily("Segoe UI");

            int nextOffset = 0;
            foreach (Match match in regEx.Matches(html))
            {
                if (match.Index > nextOffset)
                {
                    AppendText(flowDocument, html.Substring(nextOffset, match.Index - nextOffset));
                    nextOffset = match.Index + match.Length;
                    AppendLink(flowDocument, match.Groups["text"].Value, new Uri(match.Groups["link"].Value));
                }
            }

            if (nextOffset < html.Length)
                AppendText(flowDocument, html.Substring(nextOffset));

            return flowDocument;
        }
        public void SetText(FlowDocument document, string text) {
            var newText = ChatToXamlConverter.Convert(text);

            var tr = new TextRange(document.ContentStart, document.ContentEnd);
            using (var ms = new MemoryStream(Encoding.UTF8.GetBytes(newText)))
                tr.Load(ms, DataFormats.Xaml);
        }
Example #6
0
        public void CreateTable(int count)
        {
            // Create the parent FlowDocument...
            flowDoc = new FlowDocument();

            // Create the Table...
            table1 = new Table();
            table1.BringIntoView();
            // ...and add it to the FlowDocument Blocks collection.
            flowDoc.Blocks.Add(table1);

            // Set some global formatting properties for the table.
            table1.CellSpacing = 10;
            table1.Background = Brushes.White;
            // Create 6 columns and add them to the table's Columns collection.
            int numberOfColumns = 6;
            for (int x = 0; x < numberOfColumns; x++)
            {
                table1.Columns.Add(new TableColumn());

                // Set alternating background colors for the middle colums.
                if (x % 2 == 0)
                    table1.Columns[x].Background = Brushes.Beige;
                else
                    table1.Columns[x].Background = Brushes.LightSteelBlue;
            }
        }
Example #7
0
        internal static void PrintFlowDocument(PrintQueue pq, FlowDocument flowDocument)
        {
            if (pq == null) return;
            // Create a XpsDocumentWriter object, open a Windows common print dialog.
            // This methods returns a ref parameter that represents information about the dimensions of the printer media. 
            XpsDocumentWriter docWriter = PrintQueue.CreateXpsDocumentWriter(pq);
            PageImageableArea ia = pq.GetPrintCapabilities().PageImageableArea;
            PrintTicket pt = pq.UserPrintTicket;

            if (ia != null)
            {
                DocumentPaginator paginator = ((IDocumentPaginatorSource)flowDocument).DocumentPaginator;
                // Change the PageSize and PagePadding for the document to match the CanvasSize for the printer device.
                paginator.PageSize = new Size((double)pt.PageMediaSize.Width, (double)pt.PageMediaSize.Height);
                Thickness pagePadding = flowDocument.PagePadding;
                flowDocument.PagePadding = new Thickness(
                        Math.Max(ia.OriginWidth, pagePadding.Left),
                        Math.Max(ia.OriginHeight, pagePadding.Top),
                        Math.Max((double)pt.PageMediaSize.Width - (ia.OriginWidth + ia.ExtentWidth), pagePadding.Right),
                        Math.Max((double)pt.PageMediaSize.Height - (ia.OriginHeight + ia.ExtentHeight), pagePadding.Bottom));
                flowDocument.ColumnWidth = double.PositiveInfinity;
                // Send DocumentPaginator to the printer.
                docWriter.Write(paginator);
            }
        }
Example #8
0
		static FlowDocument CreateDocument(Project project, Lessee lessee, bool overview) {
			var doc = new FlowDocument();

			if ( lessee != null && !overview ) {// Print 1 page for a single lessee
				WritePage(doc, new Lessee[] { lessee }, project, false, true);
			} else if ( lessee == null && overview ) {// Partition lessees 8 at a time
				int i = 0;
				var list = new List<Lessee>();
				foreach ( Lessee l in project.Result.Lessees.Keys.OrderBy(l => l.Name) ) {
					list.Add(l);
					if ( ++i == 8 ) {
						WritePage(doc, list, project, true, false);
						i = 0;
						list = new List<Lessee>();
					}
				}
				if ( i > 6 ) {
					WritePage(doc, list.Take(6).ToList(), project, true, false);
					WritePage(doc, new Lessee[] { list[list.Count - 1] }, project, true, true);
				} else WritePage(doc, list, project, true, true);
			} else if ( lessee == null && !overview ) {// Print 1 page per lessee for all lessees
				foreach ( Lessee l in project.Result.Lessees.Keys ) {
					WritePage(doc, new Lessee[] { l }, project, false, false);
				}
			} else {
				throw new ArgumentException("Arguments invalid");
			}

			return doc;
		}
Example #9
0
 public UndoMyEditAction(int columnId, bool isInlineNote, FlowDocument document, UVEditUndoAction undoAction)
 {
     __ColumnId = columnId;
     __IsInlineNote = isInlineNote;
     __DocumentGuid = (Guid)document.Tag;
     __UndoAction = undoAction;
 }
Example #10
0
        public static FlowDocument CreateTemplateDocument(string pattern, Dictionary<string, ParamValue> parameters, ArrayList lines)
        {
            FlowDocument document = new FlowDocument();

            Paragraph paragraph = new Paragraph();
            foreach (string line in lines)
            {
                  MatchCollection matchReturn = Regex.Matches(line, pattern);
                if (matchReturn.Count != 0)
                {
                    int index = 0;
                    foreach (Match match in matchReturn)
                    {
                        paragraph.Inlines.Add(new Run(line.Substring(index, match.Index - index)));
                        index = match.Index + match.Length;

                        TextBlock textBlock = new TextBlock();
                        parameters[match.Value].TextControl.Add(textBlock);
                        textBlock.Text = parameters[match.Value].Value;
                        textBlock.Background = Brushes.Green;
                        paragraph.Inlines.Add(textBlock);
                    }
                    paragraph.Inlines.Add(new Run(line.Substring(index, line.Length - index)));
                }
                else
                {
                    paragraph.Inlines.Add(new Run(line));
                }
                paragraph.Inlines.Add(new LineBreak());
            }
            document.Blocks.Add(paragraph);

            return document;
        }
 //
 public RTB_Support(RichTextBox target_rtb = null)
 {
     if (target_rtb != null)
         flowDoc = target_rtb.Document;
     else
         flowDoc = new FlowDocument();
 }
 public FlowDocument RotateContainers(Object data)
 {
     var doc = new FlowDocument();
     if (data is ObservableCollection<Vehicle>)
     {
         vehicles = (ObservableCollection<Vehicle>)data;
         doc = ShowVehicles();
     }
     else if (data is List<VerticalBlock>)
     {
         vBlocks = (List<VerticalBlock>)data;
         doc = ShowVerticalBlocks();
     }
     else if (data is List<RowBlock>)
     {
         rBlocks = (List<RowBlock>)data;
         doc = ShowRowBlocks();
     }
     else if (data is List<Container>)
     {
         containers = (List<Container>)data;
         doc = ShowContainers();
     }
     else
     {
         MessageBox.Show("В форму отчета передан неверный тип данных:" + data.GetType());
         return null;
     }
     return doc;
 }
Example #13
0
        public static void Print(FlowDocument printedPage)
        {
            PrintDialog dialog = new PrintDialog();

            dialog.PrintTicket = dialog.PrintQueue.DefaultPrintTicket;
            dialog.PrintTicket.PageOrientation = PageOrientation.Portrait;
            dialog.PrintTicket.OutputQuality = OutputQuality.High;
            dialog.PrintTicket.PageBorderless = PageBorderless.None;
            dialog.PrintTicket.PageMediaSize = new PageMediaSize(PageMediaSizeName.ISOA4);

            if (dialog.ShowDialog() == true)
            {
                double pageHeight = printedPage.PageHeight;
                double pageWidth = printedPage.PageWidth;
                Thickness pagePadding = printedPage.PagePadding;
                double columnGap = printedPage.ColumnGap;
                double columnWidth = printedPage.ColumnWidth;

                printedPage.PageHeight = dialog.PrintableAreaHeight;
                printedPage.PageWidth = dialog.PrintableAreaWidth;
                printedPage.PagePadding = new Thickness(50);

                dialog.PrintDocument(((IDocumentPaginatorSource)printedPage).DocumentPaginator, "");

                printedPage.PagePadding = pagePadding;
                printedPage.PageHeight = pageHeight;
                printedPage.PageWidth = pageWidth;
                printedPage.ColumnWidth = columnWidth;
                printedPage.ColumnGap = columnGap;

            }
        }
        // ---------------------------------------------------------------------
        //
        // Internal Methods
        //
        // ---------------------------------------------------------------------

        #region Internal Methods

        public static string GetFlowDocumentText(FlowDocument flowDoc)
        {
            TextPointer contentstart = flowDoc.ContentStart;
            TextPointer contentend = flowDoc.ContentEnd;
            TextRange textRange = new TextRange(contentstart, contentend);
            return textRange.Text;
        }
Example #15
0
        /// <summary>
        /// 获取文档分页器
        /// </summary>
        /// <param name="pageWidth"></param>
        /// <param name="pageHeight"></param>
        /// <returns></returns>
        public DocumentPaginator GetPaginator(double pageWidth,double pageHeight)
        {
            //将RichTextBox的文档内容转为XAML
            TextRange originalRange = new TextRange(
            _textBox.Document.ContentStart,
            _textBox.Document.ContentEnd
            );
            MemoryStream memoryStream = new MemoryStream();
            originalRange.Save(memoryStream, System.Windows.DataFormats.XamlPackage);

            //根据XAML将流文档复制一份
            FlowDocument copy = new FlowDocument();

            TextRange copyRange = new TextRange(
            copy.ContentStart,
            copy.ContentEnd
            );
            copyRange.Load(memoryStream, System.Windows.DataFormats.XamlPackage);

            DocumentPaginator paginator =
            ((IDocumentPaginatorSource)copy).DocumentPaginator;

            //转换为新的分页器
            return new PrintingPaginator(
            paginator,new Size( pageWidth,pageHeight),
            new Size(DPI,DPI)
            );
        }
        private static IEnumerable<TextElement> GetRunsAndParagraphs(FlowDocument doc)
        {
            for (TextPointer position = doc.ContentStart;
              position != null && position.CompareTo(doc.ContentEnd) <= 0;
              position = position.GetNextContextPosition(LogicalDirection.Forward))
            {
                if (position.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementEnd)
                {
                    Run run = position.Parent as Run;

                    if (run != null)
                    {
                        yield return run;
                    }
                    else
                    {
                        Paragraph para = position.Parent as Paragraph;

                        if (para != null)
                        {
                            yield return para;
                        }
                    }
                }
            }
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="report">report document</param>
        /// <param name="data">report data</param>
        /// <exception cref="ArgumentException">Flow document must have a specified page height</exception>
        /// <exception cref="ArgumentException">Flow document must have a specified page width</exception>
        /// <exception cref="ArgumentException">Flow document can have only one report header section</exception>
        /// <exception cref="ArgumentException">Flow document can have only one report footer section</exception>
        public ReportPaginator(ReportDocument report, ReportData data)
        {
            _report = report;
            _data = data;

            _flowDocument = report.CreateFlowDocument();
            _pageSize = new Size(_flowDocument.PageWidth, _flowDocument.PageHeight);

            if (_flowDocument.PageHeight == double.NaN) throw new ArgumentException("Flow document must have a specified page height");
            if (_flowDocument.PageWidth == double.NaN) throw new ArgumentException("Flow document must have a specified page width");

            _dynamicCache = new ReportPaginatorDynamicCache(_flowDocument);
            ArrayList listPageHeaders = _dynamicCache.GetFlowDocumentVisualListByType(typeof(SectionReportHeader));
            if (listPageHeaders.Count > 1) throw new ArgumentException("Flow document can have only one report header section");
            if (listPageHeaders.Count == 1) _blockPageHeader = (SectionReportHeader)listPageHeaders[0];
            ArrayList listPageFooters = _dynamicCache.GetFlowDocumentVisualListByType(typeof(SectionReportFooter));
            if (listPageFooters.Count > 1) throw new ArgumentException("Flow document can have only one report footer section");
            if (listPageFooters.Count == 1) _blockPageFooter = (SectionReportFooter)listPageFooters[0];

            _paginator = ((IDocumentPaginatorSource)_flowDocument).DocumentPaginator;

            // remove header and footer in our working copy
            Block block = _flowDocument.Blocks.FirstBlock;
            while (block != null)
            {
                Block thisBlock = block;
                block = block.NextBlock;
                if ((thisBlock == _blockPageHeader) || (thisBlock == _blockPageFooter)) _flowDocument.Blocks.Remove(thisBlock);
            }

            // get report context values
            _reportContextValues = _dynamicCache.GetFlowDocumentVisualListByInterface(typeof(IInlineContextValue));

            FillData();
        }
Example #18
0
        public string GetPlainText(FlowDocument doc)
        {
            StringBuilder result = new StringBuilder();

            foreach (Block b in doc.Blocks)
            {
                Paragraph p = b as Paragraph;
                if (p != null)
                {
                    foreach (Inline i in p.Inlines)
                    {
                        if (i is Run)
                        {
                            Run r = i as Run;
                            result.Append(r.Text);
                        }
                        else if (i is InlineUIContainer)
                        {
                            InlineUIContainer ic = i as InlineUIContainer;
                            if (ic.Child is Image)
                            {
                                BitmapImage img = (ic.Child as Image).Source as BitmapImage;
                                result.Append(m_EmoticonsReverse[img.UriSource.ToString()]);
                            }
                        }
                    }
                }
            }
            return result.ToString();
        }
 private static void AddTextToRTF(FlowDocument myFlowDoc, string text)
 {
     var para = new Paragraph();
     var run = new Run(text);
     para.Inlines.Add(run);
     myFlowDoc.Blocks.Add(para);
 }
Example #20
0
        public string FormatDocument(FlowDocument doc)
        {
            StringBuilder buf = new StringBuilder ();
             FormatBlocks (doc, doc.Blocks, buf, 0);

             return buf.ToString ();
        }
Example #21
0
        public static void AddBlock(Block from, FlowDocument to)
        {
            if (from != null)
              {
            //if (from is ItemsContent)
            //{
            //  ((ItemsContent)from).RunBeforeCopy();
            //}
            //else
            {
              TextRange range = new TextRange(from.ContentStart, from.ContentEnd);

              MemoryStream stream = new MemoryStream();

              System.Windows.Markup.XamlWriter.Save(range, stream);

              range.Save(stream, DataFormats.XamlPackage);

              TextRange textRange2 = new TextRange(to.ContentEnd, to.ContentEnd);

              textRange2.Load(stream, DataFormats.XamlPackage);
            }

              }
        }
Example #22
0
 public void FormatBlocks(FlowDocument doc, BlockCollection blocks, StringBuilder buf, int indent)
 {
     foreach (Block block in blocks)
      {
     FormatBlock (doc, block, buf, indent);
      }
 }
Example #23
0
        private static void OnBoundDocumentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            RichTextBox box = d as RichTextBox;

            if (box == null)
                return;

            RemoveEventHandler(box);

            string newXAML = GetBoundDocument(d);

            box.Document.Blocks.Clear();

            if (!string.IsNullOrEmpty(newXAML))
            {
                using (MemoryStream xamlMemoryStream = new MemoryStream(Encoding.ASCII.GetBytes(newXAML)))
                {
                    ParserContext parser = new ParserContext();
                    parser.XmlnsDictionary.Add("", "http://schemas.microsoft.com/winfx/2006/xaml/presentation");
                    parser.XmlnsDictionary.Add("x", "http://schemas.microsoft.com/winfx/2006/xaml");
                    FlowDocument doc = new FlowDocument();
                    Section section = XamlReader.Load(xamlMemoryStream, parser) as Section;

                    box.Document.Blocks.Add(section);

                }
            }

            AttachEventHandler(box);

        }
Example #24
0
        public ZTextBufferWindow(ZWindowManager manager, FontAndColorService fontAndColorService)
            : base(manager, fontAndColorService)
        {
            this.normalFontFamily = new FontFamily("Cambria");
            this.fixedFontFamily = new FontFamily("Consolas");

            var zero = new FormattedText(
                textToFormat: "0",
                culture: CultureInfo.InstalledUICulture,
                flowDirection: FlowDirection.LeftToRight,
                typeface: new Typeface(normalFontFamily, FontStyles.Normal, FontWeights.Normal, FontStretches.Normal),
                emSize: this.FontSize,
                foreground: Brushes.Black);

            this.fontCharSize = new Size(zero.Width, zero.Height);

            this.document = new FlowDocument
            {
                FontFamily = normalFontFamily,
                FontSize = this.FontSize,
                PagePadding = new Thickness(8.0)
            };

            this.paragraph = new Paragraph();
            this.document.Blocks.Add(this.paragraph);

            this.scrollViewer = new FlowDocumentScrollViewer
            {
                FocusVisualStyle = null,
                Document = this.document
            };

            this.Children.Add(this.scrollViewer);
        }
        public Object Convert(Object value, Type targetType, Object parameter, CultureInfo culture)
        {
            var text = value as String;
            var flowDocument = new FlowDocument();

            if (String.IsNullOrEmpty(text))
                return flowDocument;

            var paragraph = new Paragraph();

            using (var reader = new StringReader(text))
            {
                String line;

                while ((line = reader.ReadLine()) != null)
                {
                    if (line.StartsWith("+++") || 
                        line.StartsWith("---") || 
                        line.StartsWith("diff ", StringComparison.OrdinalIgnoreCase))
                        continue;

                    paragraph.Inlines.Add(BuildLine(line));
                    paragraph.Inlines.Add(new LineBreak());
                }
            }

            return paragraph.Inlines;
        }
Example #26
0
        private void cmdCreateDynamicDocument_Click(object sender, RoutedEventArgs e)
        {
            // Create first part of sentence.
            Run runFirst = new Run();
            runFirst.Text = "Hello world of ";

            // Create bolded text.
            Bold bold = new Bold();
            Run runBold = new Run();
            runBold.Text = "dynamically generated";
            bold.Inlines.Add(runBold);

            // Create last part of sentence.
            Run runLast = new Run();
            runLast.Text = " documents";

            // Add three parts of sentence to a paragraph, in order.
            Paragraph paragraph = new Paragraph();
            paragraph.Inlines.Add(runFirst);
            paragraph.Inlines.Add(bold);
            paragraph.Inlines.Add(runLast);

            // Create a document and add this paragraph.
            FlowDocument document = new FlowDocument();
            document.Blocks.Add(paragraph);

            // Show the document.
            docViewer.Document = document;
        }
 private void SubscribeToAllHyperlinks(FlowDocument flowDocument)
 {
     var hyperlinks = GetVisuals(flowDocument).OfType<Hyperlink>();
       foreach (var link in hyperlinks) {
     link.RequestNavigate += OnRequestNavigate;
       }
 }
Example #28
0
 public static FlowDocument MakeFlowDocument(string eugenstr, System.Windows.Media.Brush specialColor)
 {
     FlowDocument document = new FlowDocument();
     int i = 0;
     string[] parts = eugenstr.Split(GREEN_TAG, StringSplitOptions.None);
     if (parts.Length > 1)
     {
         Paragraph paragraph = new Paragraph();
         while (i < parts.Length)
         {
             if (i % 2 == 0)
             {
                 Span normalspan = new Span(new Run(parts[i].Replace("#styleGreen", string.Empty)));
                 paragraph.Inlines.Add(normalspan);
             }
             else
             {
                 Span coloredSpan = new Span(new Run(parts[i]));
                 coloredSpan.Foreground = specialColor;
                 paragraph.Inlines.Add(coloredSpan);
             }
             i++;
         }
         document.Blocks.Add(paragraph);
     }
     else { Paragraph paragraph = new Paragraph(new Run(eugenstr)); document.Blocks.Add(paragraph); }
     return document;
 }
 public new void SetText(FlowDocument document, string text) {
     try {
         base.SetText(document, text);
     } catch (Exception e) {
         MainLog.Logger.FormattedWarnException(e);
     }
 }
        // ReSharper disable once FunctionComplexityOverflow
        private void create_torrent_hyperlinks( bool download )
        {
            try
            {
                var doc = new FlowDocument();

                var para = new Paragraph();
                doc.Blocks.Add( para );

                foreach ( var torrent in Factory.Instance.Eztv.get_torrents().Where( torrent => String.Compare( torrent.Imbdid, this.TvdbSeries.ImdbId, StringComparison.Ordinal ) == 0 ) )
                {
                    if ( this.CheckBoxHdtv.IsChecked ?? false )
                    {
                        if ( torrent.Epname.ToLower().Contains( "hdtv" ) && !torrent.Epname.ToLower().Contains( "720" ) && !torrent.Epname.ToLower().Contains( "1080" ) )
                        {
                            continue;
                        }
                    }

                    if ( this.CheckBox720P.IsChecked ?? false )
                    {
                        if ( torrent.Epname.ToLower().Contains( "720" ) )
                        {
                            continue;
                        }
                    }

                    if ( this.CheckBox1080P.IsChecked ?? false )
                    {
                        if ( torrent.Epname.ToLower().Contains( "1080" ) )
                        {
                            continue;
                        }
                    }

                    var textblock = new TextBlock {Text = torrent.Epname, TextWrapping = TextWrapping.NoWrap};

                    var link = new Hyperlink {IsEnabled = true};
                    link.Inlines.Add( textblock );
                    link.NavigateUri = new Uri( torrent.Magnetlink );
                    link.Click += this.Link_Click;

                    para.Inlines.Add( link );
                    para.Inlines.Add( Environment.NewLine );

                    if ( download )
                    {
                        Factory.Instance.Utils.download_torrent( link.NavigateUri.ToString() );
                    }
                }

                this.RichTextTorrents.Document = doc;
                this.RichTextTorrents.IsReadOnly = true;
            }
            catch ( Exception ex )
            {
                Factory.Instance.LogLines.Enqueue( ex.Message );
                Factory.Instance.LogLines.Enqueue( ex.StackTrace );
            }
        }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 7 "..\..\..\NPC\MonsterFlowDocumentReader.xaml"
                ((DnD.NPC.MonsterFlowDocumentReader)(target)).Loaded += new System.Windows.RoutedEventHandler(this.UserControl_Loaded);

            #line default
            #line hidden
                return;

            case 2:
                this.btnClearAll = ((System.Windows.Controls.Button)(target));

            #line 17 "..\..\..\NPC\MonsterFlowDocumentReader.xaml"
                this.btnClearAll.Click += new System.Windows.RoutedEventHandler(this.btnClearAll_Click);

            #line default
            #line hidden
                return;

            case 3:
                this.cbFont = ((System.Windows.Controls.ComboBox)(target));

            #line 18 "..\..\..\NPC\MonsterFlowDocumentReader.xaml"
                this.cbFont.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.ComboBox_SelectionChanged);

            #line default
            #line hidden
                return;

            case 4:
                this.chkMultipleMonsters = ((System.Windows.Controls.CheckBox)(target));

            #line 19 "..\..\..\NPC\MonsterFlowDocumentReader.xaml"
                this.chkMultipleMonsters.Checked += new System.Windows.RoutedEventHandler(this.chkMultipleMonsters_Checked);

            #line default
            #line hidden
                return;

            case 5:
                this.chkPageBreak = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 6:
                this.MonsterFlowReader = ((System.Windows.Controls.FlowDocumentReader)(target));
                return;

            case 7:
                this.MonsterFlow = ((System.Windows.Documents.FlowDocument)(target));
                return;

            case 8:
                this.lblCount = ((System.Windows.Controls.Label)(target));
                return;
            }
            this._contentLoaded = true;
        }
Example #32
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.tabControl = ((System.Windows.Controls.TabControl)(target));
                return;

            case 2:
                this.Terminal = ((System.Windows.Controls.TabItem)(target));
                return;

            case 3:
                this.Log_ = ((System.Windows.Controls.RichTextBox)(target));
                return;

            case 4:
                this.LOGs = ((System.Windows.Documents.FlowDocument)(target));
                return;

            case 5:
                this.button = ((System.Windows.Controls.Button)(target));
                return;

            case 6:
                this.button_Copy = ((System.Windows.Controls.Button)(target));
                return;

            case 7:
                this.cb_numericupdown = ((System.Windows.Controls.ComboBox)(target));
                return;

            case 8:
                this.Opcje = ((System.Windows.Controls.TabItem)(target));
                return;

            case 9:
                this.cbPortName = ((System.Windows.Controls.ComboBox)(target));
                return;

            case 10:
                this.cbBaudrate = ((System.Windows.Controls.ComboBox)(target));
                return;

            case 11:
                this.cb_databit = ((System.Windows.Controls.ComboBox)(target));
                return;

            case 12:
                this.cbParity = ((System.Windows.Controls.ComboBox)(target));
                return;

            case 13:
                this.cbStop = ((System.Windows.Controls.ComboBox)(target));
                return;

            case 14:
                this.label = ((System.Windows.Controls.Label)(target));
                return;

            case 15:
                this.label_Copy = ((System.Windows.Controls.Label)(target));
                return;

            case 16:
                this.label_Copy1 = ((System.Windows.Controls.Label)(target));
                return;

            case 17:
                this.label_Copy2 = ((System.Windows.Controls.Label)(target));
                return;

            case 18:
                this.label_Copy3 = ((System.Windows.Controls.Label)(target));
                return;

            case 19:
                this.button_Dom = ((System.Windows.Controls.Button)(target));

            #line 66 "..\..\comPort.xaml"
                this.button_Dom.Click += new System.Windows.RoutedEventHandler(this.Button_Click);

            #line default
            #line hidden
                return;

            case 20:
                this.button_Ods = ((System.Windows.Controls.Button)(target));
                return;

            case 21:
                this.button_An = ((System.Windows.Controls.Button)(target));
                return;
            }
            this._contentLoaded = true;
        }
Example #33
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 9 "..\..\..\NPC\DnDAppFiles.xaml"
                ((DnD.NPC.DnDAppFiles)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded);

            #line default
            #line hidden
                return;

            case 2:

            #line 20 "..\..\..\NPC\DnDAppFiles.xaml"
                ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.MenuItem_Click_1);

            #line default
            #line hidden
                return;

            case 3:

            #line 21 "..\..\..\NPC\DnDAppFiles.xaml"
                ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.MenuItem_Click);

            #line default
            #line hidden
                return;

            case 4:

            #line 24 "..\..\..\NPC\DnDAppFiles.xaml"
                ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.MenuItem_Click_2);

            #line default
            #line hidden
                return;

            case 5:
                this.listMonster = ((System.Windows.Controls.ListBox)(target));

            #line 53 "..\..\..\NPC\DnDAppFiles.xaml"
                this.listMonster.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.listMonster_SelectionChanged);

            #line default
            #line hidden
                return;

            case 6:
                this.GridMonster = ((System.Windows.Controls.DataGrid)(target));

            #line 56 "..\..\..\NPC\DnDAppFiles.xaml"
                this.GridMonster.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.GridMonster_SelectionChanged);

            #line default
            #line hidden
                return;

            case 7:
                this.btnClearAll = ((System.Windows.Controls.Button)(target));

            #line 70 "..\..\..\NPC\DnDAppFiles.xaml"
                this.btnClearAll.Click += new System.Windows.RoutedEventHandler(this.btnClearAll_Click);

            #line default
            #line hidden
                return;

            case 8:
                this.cbFont = ((System.Windows.Controls.ComboBox)(target));

            #line 71 "..\..\..\NPC\DnDAppFiles.xaml"
                this.cbFont.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.ComboBox_SelectionChanged);

            #line default
            #line hidden
                return;

            case 9:
                this.chkMultipleMonsters = ((System.Windows.Controls.CheckBox)(target));

            #line 72 "..\..\..\NPC\DnDAppFiles.xaml"
                this.chkMultipleMonsters.Checked += new System.Windows.RoutedEventHandler(this.chkMultipleMonsters_Checked);

            #line default
            #line hidden
                return;

            case 10:
                this.chkPageBreak = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 11:
                this.MainFlowReader = ((System.Windows.Controls.FlowDocumentReader)(target));
                return;

            case 12:
                this.MainFlow = ((System.Windows.Documents.FlowDocument)(target));
                return;
            }
            this._contentLoaded = true;
        }
Example #34
0
 public void SetText(System.Windows.Documents.FlowDocument document, string text)
 {
     new TextRange(document.ContentStart, document.ContentEnd).Text = text;
 }
Example #35
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.MainGrid = ((System.Windows.Controls.Grid)(target));
                return;

            case 2:
                this.labelSelection = ((System.Windows.Controls.Label)(target));
                return;

            case 3:
                this.UserSelectionGrid = ((System.Windows.Controls.Grid)(target));
                return;

            case 4:
                this.ButtonPdfReader = ((System.Windows.Controls.Button)(target));

            #line 21 "..\..\..\UserControls\UCReadData.xaml"
                this.ButtonPdfReader.Click += new System.Windows.RoutedEventHandler(this.ButtonPdfReader_Click);

            #line default
            #line hidden
                return;

            case 5:
                this.ButtonExcelReader = ((System.Windows.Controls.Button)(target));

            #line 22 "..\..\..\UserControls\UCReadData.xaml"
                this.ButtonExcelReader.Click += new System.Windows.RoutedEventHandler(this.ButtonExcellReader_Click);

            #line default
            #line hidden
                return;

            case 6:
                this.ButtonWordReader = ((System.Windows.Controls.Button)(target));

            #line 23 "..\..\..\UserControls\UCReadData.xaml"
                this.ButtonWordReader.Click += new System.Windows.RoutedEventHandler(this.ButtonWordReader_Click);

            #line default
            #line hidden
                return;

            case 7:
                this.ButtonTextReader = ((System.Windows.Controls.Button)(target));

            #line 24 "..\..\..\UserControls\UCReadData.xaml"
                this.ButtonTextReader.Click += new System.Windows.RoutedEventHandler(this.ButtonTextReader_Click);

            #line default
            #line hidden
                return;

            case 8:
                this.StatusGrid = ((System.Windows.Controls.Grid)(target));
                return;

            case 9:
                this.LabelStatus = ((System.Windows.Controls.Label)(target));
                return;

            case 10:
                this.DataDisplayGrid = ((System.Windows.Controls.Grid)(target));
                return;

            case 11:
                this.FileReaderDataGrid = ((System.Windows.Controls.DataGrid)(target));
                return;

            case 12:
                this.RichTxtBox = ((System.Windows.Controls.RichTextBox)(target));
                return;

            case 13:
                this.FlowDocument = ((System.Windows.Documents.FlowDocument)(target));
                return;

            case 14:
                this.wbBrowser = ((System.Windows.Controls.WebBrowser)(target));
                return;
            }
            this._contentLoaded = true;
        }
 public HtmlTextBlob(System.Windows.Documents.FlowDocument document)
     : base(document)
 {
 }
        internal static System.Windows.Documents.Section CreateContentControl(QuestionContent content, string prefix, System.Windows.Documents.Section paragraph, Response response)
        {
            System.Windows.Documents.Section rootSection = paragraph;
            if (rootSection == null)
            {
                rootSection = new System.Windows.Documents.Section();
            }

            if (content.ContentType == ContentType.Html ||
                content.ContentType == ContentType.FlowDocument)
            {
                string doc = string.Empty;
                if (content.ContentType == ContentType.Html)
                {
                    doc = HtmlToXamlConverter.ConvertHtmlToXaml(content.Content, true);
                }
                else
                {
                    doc = content.Content;
                }

                System.Windows.Documents.FlowDocument flowDocument = HtmlToXamlConverter.DeserializeFlowDocument(doc);

                replaceTextBoxWithText(flowDocument, content, null);

                List <Block> tempList = new List <Block>();
                tempList.AddRange(flowDocument.Blocks);
                flowDocument.Blocks.Clear();
                rootSection.Blocks.AddRange(tempList);

                Paragraph firstPara = null;
                if (rootSection.Blocks.FirstBlock is Paragraph)
                {
                    firstPara = rootSection.Blocks.FirstBlock as Paragraph;
                }
                else
                {
                    firstPara = new Paragraph();
                    rootSection.Blocks.InsertBefore(rootSection.Blocks.FirstBlock, firstPara);
                }

                if (firstPara.Inlines.Count > 0)
                {
                    firstPara.Inlines.InsertBefore(firstPara.Inlines.FirstInline, new Run(prefix));
                }
                else
                {
                    firstPara.Inlines.Add(prefix);
                }
            }
            else
            {
                Paragraph para = null;
                if (rootSection.Blocks.LastBlock is Paragraph)
                {
                    para = rootSection.Blocks.LastBlock as Paragraph;
                }
                else
                {
                    para = new Paragraph();
                    rootSection.Blocks.Add(para);
                }

                string questionContent = content.Content;
                int    startIndex      = 0;

                para.Inlines.Add(prefix);

                while (true)
                {
                    startIndex = questionContent.IndexOf("_$", 0);
                    if (startIndex >= 0)
                    {
                        int    endIndex    = questionContent.IndexOf("$_", startIndex);
                        string placeHolder = questionContent.Substring(startIndex, endIndex - startIndex + 2);

                        string text = questionContent.Substring(0, startIndex);

                        if (!string.IsNullOrEmpty(text) &&
                            text[text.Length - 1] == '\n')
                        {
                            para.Inlines.Add(CreateText(text.Remove(text.Length - 1)));
                        }
                        else
                        {
                            para.Inlines.Add(CreateText(text));
                        }

                        QuestionContentPart part = content.GetContentPart(placeHolder);
                        if (response is FIBQuestionResponse)
                        {
                            FIBQuestionResponse fibResponse = response as FIBQuestionResponse;
                            para.Inlines.Add(CreateUIPart(part, fibResponse.GetBlankResponse(part.Id, false)));
                        }
                        else
                        {
                            para.Inlines.Add(CreateUIPart(part, null));
                        }

                        questionContent = questionContent.Remove(0, endIndex + 2);
                        if (string.IsNullOrEmpty(questionContent))
                        {
                            break;
                        }
                    }
                    else
                    {
                        para.Inlines.Add(CreateText(questionContent));
                        break;
                    }
                }
            }

            return(rootSection);
        }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 5 "..\..\MainWindow.xaml"
                ((PointOfSaleManagementSys.MainWindow)(target)).Closing += new System.ComponentModel.CancelEventHandler(this.Window_Closing);

            #line default
            #line hidden
                return;

            case 2:
                this.LvShopping = ((System.Windows.Controls.ListView)(target));

            #line 21 "..\..\MainWindow.xaml"
                this.LvShopping.MouseDoubleClick += new System.Windows.Input.MouseButtonEventHandler(this.LvShopping_MouseDoubleClick);

            #line default
            #line hidden
                return;

            case 3:
                this.BalancePriceTb = ((System.Windows.Controls.TextBox)(target));
                return;

            case 4:
                this.totalTaxCost = ((System.Windows.Controls.TextBox)(target));
                return;

            case 5:
                this.PaidTextBox = ((System.Windows.Controls.TextBox)(target));
                return;

            case 6:
                this.ComboCard = ((System.Windows.Controls.ComboBox)(target));
                return;

            case 7:
                this.DpDate = ((System.Windows.Controls.DatePicker)(target));
                return;

            case 8:

            #line 66 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.ButtonBeer_Click);

            #line default
            #line hidden
                return;

            case 9:

            #line 69 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.ButtonDessert_Click);

            #line default
            #line hidden
                return;

            case 10:

            #line 72 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.ButtonLunch_Click);

            #line default
            #line hidden
                return;

            case 11:

            #line 75 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.ButtonDinner_Click);

            #line default
            #line hidden
                return;

            case 12:

            #line 78 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.ButtonHotDrink_Click);

            #line default
            #line hidden
                return;

            case 13:

            #line 81 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.ButtonWine_Click);

            #line default
            #line hidden
                return;

            case 14:
                this.TabControl = ((System.Windows.Controls.TabControl)(target));
                return;

            case 15:
                this.Tab1 = ((System.Windows.Controls.TabItem)(target));
                return;

            case 16:
                this.LvItems = ((System.Windows.Controls.ListView)(target));

            #line 123 "..\..\MainWindow.xaml"
                this.LvItems.MouseDoubleClick += new System.Windows.Input.MouseButtonEventHandler(this.LvItems_MouseDoubleClick);

            #line default
            #line hidden
                return;

            case 17:
                this.tab2 = ((System.Windows.Controls.TabItem)(target));
                return;

            case 18:
                this.FdViewer = ((System.Windows.Controls.FlowDocumentScrollViewer)(target));
                return;

            case 19:
                this.FlowDocument1 = ((System.Windows.Documents.FlowDocument)(target));
                return;

            case 20:

            #line 143 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.ButtonAdd_Click);

            #line default
            #line hidden
                return;

            case 21:

            #line 144 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.ButtonDelete_Click);

            #line default
            #line hidden
                return;

            case 22:

            #line 145 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.ButtonChekOut_Click);

            #line default
            #line hidden
                return;

            case 23:

            #line 146 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.ButtonInvoice_Click);

            #line default
            #line hidden
                return;

            case 24:

            #line 147 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.ButtonReset_Click);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
Example #39
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 12 "..\..\..\MainWindow.xaml"
                ((GUI.MainWindow)(target)).Closed += new System.EventHandler(this.Window_Closed);

            #line default
            #line hidden

            #line 14 "..\..\..\MainWindow.xaml"
                ((GUI.MainWindow)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded);

            #line default
            #line hidden
                return;

            case 2:
                this.ConnectButton = ((System.Windows.Controls.MenuItem)(target));

            #line 32 "..\..\..\MainWindow.xaml"
                this.ConnectButton.Click += new System.Windows.RoutedEventHandler(this.Connect_Click);

            #line default
            #line hidden
                return;

            case 3:
                this.tabControl = ((System.Windows.Controls.TabControl)(target));
                return;

            case 4:
                this.LocalPathTextBlock = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 5:

            #line 76 "..\..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Local_Refresh_Button_Click);

            #line default
            #line hidden
                return;

            case 6:
                this.DirList = ((System.Windows.Controls.ListBox)(target));

            #line 80 "..\..\..\MainWindow.xaml"
                this.DirList.MouseDoubleClick += new System.Windows.Input.MouseButtonEventHandler(this.DirList_MouseDoubleClick);

            #line default
            #line hidden
                return;

            case 7:
                this.FileList = ((System.Windows.Controls.ListBox)(target));

            #line 83 "..\..\..\MainWindow.xaml"
                this.FileList.MouseDoubleClick += new System.Windows.Input.MouseButtonEventHandler(this.FileMouseDoubleClick);

            #line default
            #line hidden
                return;

            case 8:
                this.Set_Parent = ((System.Windows.Controls.MenuItem)(target));

            #line 88 "..\..\..\MainWindow.xaml"
                this.Set_Parent.Click += new System.Windows.RoutedEventHandler(this.Parent_Click);

            #line default
            #line hidden
                return;

            case 9:
                this.NameText = ((System.Windows.Controls.TextBox)(target));
                return;

            case 10:
                this.NamespaceText = ((System.Windows.Controls.TextBox)(target));
                return;

            case 11:
                this.DescriptionText = ((System.Windows.Controls.TextBox)(target));
                return;

            case 12:
                this.CategText = ((System.Windows.Controls.TextBox)(target));
                return;

            case 13:
                this.StatusComboBox = ((System.Windows.Controls.ComboBox)(target));
                return;

            case 14:
                this.CheckinList = ((System.Windows.Controls.ListBox)(target));
                return;

            case 15:

            #line 173 "..\..\..\MainWindow.xaml"
                ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.Reset_Click);

            #line default
            #line hidden
                return;

            case 16:
                this.Add_Dependency = ((System.Windows.Controls.Button)(target));

            #line 180 "..\..\..\MainWindow.xaml"
                this.Add_Dependency.Click += new System.Windows.RoutedEventHandler(this.Add_Dependency_Click);

            #line default
            #line hidden
                return;

            case 17:
                this.Checkin_Button = ((System.Windows.Controls.Button)(target));

            #line 183 "..\..\..\MainWindow.xaml"
                this.Checkin_Button.Click += new System.Windows.RoutedEventHandler(this.Checkin_Click);

            #line default
            #line hidden
                return;

            case 18:

            #line 209 "..\..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Repo_Refresh_Button_Click);

            #line default
            #line hidden
                return;

            case 19:
                this.PathTextBlock = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 20:
                this.RepoDirList = ((System.Windows.Controls.ListBox)(target));

            #line 217 "..\..\..\MainWindow.xaml"
                this.RepoDirList.MouseDoubleClick += new System.Windows.Input.MouseButtonEventHandler(this.RepoDirList_MouseDoubleClick);

            #line default
            #line hidden
                return;

            case 21:
                this.RepoFileList = ((System.Windows.Controls.ListBox)(target));

            #line 240 "..\..\..\MainWindow.xaml"
                this.RepoFileList.MouseDoubleClick += new System.Windows.Input.MouseButtonEventHandler(this.FileMouseDoubleClick);

            #line default
            #line hidden
                return;

            case 22:
                this.Select = ((System.Windows.Controls.MenuItem)(target));

            #line 245 "..\..\..\MainWindow.xaml"
                this.Select.Click += new System.Windows.RoutedEventHandler(this.Checkout_Select_Click);

            #line default
            #line hidden
                return;

            case 23:
                this.CheckoutList = ((System.Windows.Controls.ListBox)(target));
                return;

            case 24:

            #line 264 "..\..\..\MainWindow.xaml"
                ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.Reset_Click);

            #line default
            #line hidden
                return;

            case 25:
                this.Checkout_Button = ((System.Windows.Controls.Button)(target));

            #line 272 "..\..\..\MainWindow.xaml"
                this.Checkout_Button.Click += new System.Windows.RoutedEventHandler(this.Checkout_Click);

            #line default
            #line hidden
                return;

            case 26:
                this.ConditionComboBox = ((System.Windows.Controls.ComboBox)(target));
                return;

            case 27:
                this.tbQueryContent = ((System.Windows.Controls.TextBox)(target));
                return;

            case 28:
                this.BrowseButton = ((System.Windows.Controls.Button)(target));

            #line 308 "..\..\..\MainWindow.xaml"
                this.BrowseButton.Click += new System.Windows.RoutedEventHandler(this.Button_Click);

            #line default
            #line hidden
                return;

            case 29:
                this.showFiles = ((System.Windows.Controls.ListBox)(target));

            #line 312 "..\..\..\MainWindow.xaml"
                this.showFiles.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.ShowFiles_SelectionChanged);

            #line default
            #line hidden
                return;

            case 30:
                this.viewMetadata = ((System.Windows.Controls.ListBox)(target));
                return;

            case 31:
                this.CategoriesList = ((System.Windows.Controls.ListBox)(target));

            #line 319 "..\..\..\MainWindow.xaml"
                this.CategoriesList.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.CategoriesList_SelectionChanged);

            #line default
            #line hidden
                return;

            case 32:
                this.RootList = ((System.Windows.Controls.ListBox)(target));
                return;

            case 33:
                this.codeLabel = ((System.Windows.Controls.TextBox)(target));
                return;

            case 34:
                this.fileView = ((System.Windows.Documents.FlowDocument)(target));
                return;

            case 35:
                this.main = ((System.Windows.Documents.Paragraph)(target));
                return;

            case 36:
                this.statusBarText = ((System.Windows.Controls.TextBlock)(target));
                return;
            }
            this._contentLoaded = true;
        }
Example #40
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.Display = ((System.Windows.Controls.Canvas)(target));
                return;

            case 2:
                this.RichTextBoxDisplay = ((System.Windows.Controls.RichTextBox)(target));
                return;

            case 3:
                this.NumericDisplay = ((System.Windows.Documents.FlowDocument)(target));
                return;

            case 4:
                this.Caret = ((System.Windows.Controls.Border)(target));
                return;

            case 5:
                this.CaretStoryBoard = ((System.Windows.Media.Animation.Storyboard)(target));
                return;

            case 6:
                this.GraphStats = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 7:
                this.DefTable = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 8:
                this.Format = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 9:
                this.Calculs = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 10:
                this.Table = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 11:
                this.Snde = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 12:
                this.Quitter = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 13:
                this.Inserer = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 14:
                this.Alpha = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 15:
                this.Echanger = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 16:
                this.Listes = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 17:
                this.RosaryControl = ((Calculatrice.CustomControls.RosaryControl)(target));
                return;

            case 18:
                this.Math = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 19:
                this.Matrice = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 20:
                this.Dessin = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 21:
                this.Distrib = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 22:
                this.Annul = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 23:
                this.Angle = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 24:
                this.Trig = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 25:
                this.Resol = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 26:
                this.G = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 27:
                this.H = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 28:
                this.I = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 29:
                this.Log = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 30:
                this.Ln = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 31:
                this.Sto = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 32:
                this.Diviser = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 33:
                this.Multiplier = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 34:
                this.Moins = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 35:
                this.Plus = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 36:
                this.J = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 37:
                this.K = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 38:
                this.L = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 39:
                this.Sept = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 40:
                this.Huit = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 41:
                this.Neuf = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 42:
                this.Quatre = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 43:
                this.Cinq = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 44:
                this.Six = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 45:
                this.Un = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 46:
                this.Deux = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 47:
                this.Trois = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 48:
                this.Zero = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 49:
                this.Point = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 50:
                this.Rep = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 51:
                this.On = ((Calculatrice.CustomControls.FunctControl)(target));
                return;

            case 52:
                this.Enter = ((Calculatrice.CustomControls.FunctControl)(target));
                return;
            }
            this._contentLoaded = true;
        }
 public RichTextBox(System.Windows.Documents.FlowDocument document)
 {
 }
Example #42
0
        /// <summary>
        /// Renders DOM text elements recursively, i.e. including their childs.
        /// </summary>
        /// <param name="e">The root DOM text element.</param>
        /// <returns>The corresponding Wpf element.</returns>
        /// <exception cref="System.InvalidOperationException">
        /// </exception>
        /// <exception cref="System.NotImplementedException"></exception>
        public object RenderRecursively(TextElement e)
        {
            object wpf = null;

            switch (e)
            {
            case BlockUIContainer buc:
            {
                wpf = new swd.BlockUIContainer();
            }
            break;

            case FlowDocument flowDocument:
            {
                // make sure the standard colors were set
                flowDocument.Foreground = ExCSS.Color.Black;
                flowDocument.Background = ExCSS.Color.White;

                var flowDocumente = new swd.FlowDocument()
                {
                    Name = NameOfFlowDocument
                };
                if (TemplateBindingViewportWidth is null)
                {
                    TemplateBindingViewportWidth = new Binding("ColumnWidth")
                    {
                        Source = flowDocumente
                    }
                }
                ;
                if (TemplateBindingViewportHeight is null)
                {
                    TemplateBindingViewportHeight = new Binding("ColumnWidth")
                    {
                        Source = flowDocumente
                    }
                }
                ;                                                                                    // Binding to ColumnWidth is not optimal, but better than nothing!

                if (flowDocument.Background.HasValue)
                {
                    flowDocumente.Background = GetBrushFromColor(flowDocument.Background.Value);
                }
                if (flowDocument.Foreground.HasValue)
                {
                    flowDocumente.Foreground = GetBrushFromColor(flowDocument.Foreground.Value);
                }

                wpf = flowDocumente;
            }
            break;

            case Hyperlink hl:
            {
                var hle = new swd.Hyperlink();
                if (!string.IsNullOrEmpty(hl.NavigateUri))
                {
                    if (System.Uri.TryCreate(hl.NavigateUri, UriKind.RelativeOrAbsolute, out var uri))
                    {
                        hle.NavigateUri = uri;
                    }
                }
                if (!string.IsNullOrEmpty(hl.TargetName))
                {
                    hle.TargetName = hl.TargetName;
                }
                wpf = hle;
            }
            break;

            case Image image:
            {
                var imagee = new System.Windows.Controls.Image();
                if (!string.IsNullOrEmpty(image.Source))
                {
                    imagee.SetBinding(System.Windows.Controls.Image.SourceProperty, $"ImageProvider[{image.Source}]");
                }

                if (image.Width == null && image.Height == null)
                {
                    imagee.Stretch = System.Windows.Media.Stretch.Uniform;

                    var binding = new Binding()
                    {
                        RelativeSource = RelativeSource.Self, Path = new System.Windows.PropertyPath("Source")
                    };
                    binding.Converter = ImageToImageWidthConverter.Instance;
                    imagee.SetBinding(System.Windows.Controls.Image.WidthProperty, binding);
                }
                else
                {
                    imagee.Stretch = System.Windows.Media.Stretch.Uniform;
                }

                if (image.Width != null)
                {
                    if (image.Width.IsPurelyAbsolute(out var widthPx))
                    {
                        imagee.Width = widthPx;
                    }
                    else
                    {
                        var multibinding = new MultiBinding();
                        multibinding.Bindings.Add(new Binding()
                            {
                                Source = TemplateBindingViewportWidth.Source, Path = TemplateBindingViewportWidth.Path
                            });
                        multibinding.Bindings.Add(new Binding()
                            {
                                Source = TemplateBindingViewportHeight.Source, Path = TemplateBindingViewportHeight.Path
                            });
                        multibinding.Converter          = CompoundLengthConverter.Instance;
                        multibinding.ConverterParameter = GetCompoundLengthConverterParameters(image.Width);
                        imagee.SetBinding(System.Windows.Controls.Image.WidthProperty, multibinding);
                    }
                }

                if (image.Height != null)
                {
                    if (image.Height.IsPurelyAbsolute(out var heightPx))
                    {
                        imagee.Height = heightPx;
                    }
                    else
                    {
                        var multibinding = new MultiBinding();
                        multibinding.Bindings.Add(new Binding()
                            {
                                Source = TemplateBindingViewportWidth.Source, Path = TemplateBindingViewportWidth.Path
                            });
                        multibinding.Bindings.Add(new Binding()
                            {
                                Source = TemplateBindingViewportHeight.Source, Path = TemplateBindingViewportHeight.Path
                            });
                        multibinding.Converter          = CompoundLengthConverter.Instance;
                        multibinding.ConverterParameter = GetCompoundLengthConverterParameters(image.Height);
                        imagee.SetBinding(System.Windows.Controls.Image.HeightProperty, multibinding);
                    }
                }

                // set max-width and max-height
                if (image.MaxWidth != null && image.MaxWidth.Value.IsAbsolute)
                {
                    imagee.MaxWidth = image.MaxWidth.Value.ToPixel();
                }
                else if (image.MaxWidth == null || image.MaxWidth.Value.Type == ExCSS.Length.Unit.Vw)
                {
                    double vwValue = image.MaxWidth.HasValue ? image.MaxWidth.Value.Value : 100;

                    var binding = new Binding()
                    {
                        Source = TemplateBindingViewportWidth.Source, Path = TemplateBindingViewportWidth.Path
                    };
                    binding.Converter          = RelativeSizeConverter.Instance;
                    binding.ConverterParameter = vwValue;
                    imagee.SetBinding(System.Windows.Controls.Image.MaxWidthProperty, binding);
                }
                else
                {
                    throw new InvalidProgramException();
                }


                if (image.MaxHeight != null && image.MaxHeight.Value.IsAbsolute)
                {
                    imagee.MaxHeight = image.MaxHeight.Value.ToPixel();
                }
                else if (image.MaxHeight == null || image.MaxHeight.Value.Type == ExCSS.Length.Unit.Vh)
                {
                    double vhValue = image.MaxHeight.HasValue ? image.MaxHeight.Value.Value : 100;
                    var    binding = new Binding()
                    {
                        Source = TemplateBindingViewportWidth.Source, Path = TemplateBindingViewportWidth.Path
                    };
                    binding.Converter          = RelativeSizeConverter.Instance;
                    binding.ConverterParameter = vhValue;
                    imagee.SetBinding(System.Windows.Controls.Image.MaxHeightProperty, binding);
                }
                else
                {
                    throw new InvalidProgramException();
                }

                wpf = imagee;
            }
            break;

            case InlineUIContainer iuc:
            {
                var inlineuiContainere = new swd.InlineUIContainer();
                wpf = inlineuiContainere;
            }
            break;

            case LineBreak lb:
            {
                wpf = new swd.LineBreak();
            }
            break;

            case List list:
            {
                var liste = new swd.List();
                if (list.MarkerStyle.HasValue)
                {
                    liste.MarkerStyle = ToMarkerStyle(list.MarkerStyle.Value);
                }
                wpf = liste;
            }
            break;

            case ListItem li:
            {
                wpf = new swd.ListItem();
            }
            break;

            case Paragraph p:
            {
                var pe = new swd.Paragraph();
                if (p.TextDecorations.HasValue)
                {
                    pe.TextDecorations = ToTextDecorations(p.TextDecorations.Value);
                }
                if (p.TextIndent.HasValue)
                {
                    pe.TextIndent = p.TextIndent.Value.IsAbsolute ? p.TextIndent.Value.ToPixel() : 0;
                }
                wpf = pe;
            }
            break;

            case Run run:
            {
                if (SplitIntoWords)
                {
                    wpf = CreateTextElement_SeparateWords(run.Text);
                }
                else if (SplitIntoSentences)
                {
                    wpf = CreateTextElement_SeparateSentences(run.Text);
                }
                else
                {
                    wpf = new swd.Run(run.Text);
                }
            }
            break;

            case Section s:
            {
                wpf = new swd.Section();
            }
            break;

            case Span span:
            {
                wpf = new swd.Span();
            }
            break;

            case Table tb:
            {
                var tbe = new swd.Table();
                foreach (var c in tb.Columns)
                {
                    if (c.Width.HasValue)
                    {
                        tbe.Columns.Add(new swd.TableColumn()
                            {
                                Width = new System.Windows.GridLength(c.Width.Value)
                            });
                    }
                    else
                    {
                        tbe.Columns.Add(new swd.TableColumn());
                    }
                }
                wpf = tbe;
            }
            break;

            case TableCell tc:
            {
                var tce = new swd.TableCell();
                if (1 != tc.ColumnSpan)
                {
                    tce.ColumnSpan = tc.ColumnSpan;
                }

                if (1 != tc.RowSpan)
                {
                    tce.RowSpan = tc.RowSpan;
                }
                if (tc.BorderBrush.HasValue)
                {
                    tce.BorderBrush = new System.Windows.Media.SolidColorBrush(ToColor(tc.BorderBrush.Value));
                }
                if (tc.BorderThickness.HasValue)
                {
                    tce.BorderThickness = ToThickness(tc.BorderThickness.Value);
                }
                wpf = tce;
            }
            break;

            case TableRow trow:
            {
                wpf = new swd.TableRow();
            }
            break;

            case TableRowGroup trg:
            {
                wpf = new swd.TableRowGroup();
            }
            break;

            default:
            {
                wpf = null;
            }
            break;
            }

            // Render TextElement properties

            if (wpf is swd.TextElement te)
            {
                if (!string.IsNullOrEmpty(e.FontFamily))
                {
                    te.FontFamily = GetFontFamily(e.FontFamily);
                }

                if (e.FontSize.HasValue)
                {
                    var fs = e.FontSize.Value;
                    fs          = Math.Max(0.004, fs);
                    te.FontSize = fs;
                }

                if (e.FontStyle.HasValue)
                {
                    te.FontStyle = ToFontStyle(e.FontStyle.Value);
                }

                if (e.FontWeight.HasValue)
                {
                    te.FontWeight = ToFontWeight(e.FontWeight.Value);
                }

                if (e.Foreground.HasValue && e.Foreground != e.ForegroundInheritedOnly)
                {
                    te.Foreground = GetBrushFromColor(e.Foreground.Value);
                }

                if (e.Background.HasValue && e.Background != e.BackgroundInheritedOnly)
                {
                    te.Background = GetBrushFromColor(e.Background.Value);
                }
            }

            // now special properties

            if (e is Block b && wpf is swd.Block be)
            {
                if (b.Margin.HasValue)
                {
                    be.Margin = ToThickness(b.Margin.Value);
                }

                if (b.Padding.HasValue)
                {
                    be.Padding = ToThickness(b.Padding.Value);
                }

                if (b.BorderBrush.HasValue)
                {
                    be.BorderBrush = new System.Windows.Media.SolidColorBrush(ToColor(b.BorderBrush.Value));
                }

                if (b.BorderThickness.HasValue)
                {
                    be.BorderThickness = ToThickness(b.BorderThickness.Value);
                }

                if (b.TextAlignment.HasValue)
                {
                    be.TextAlignment = ToTextAlignment(b.TextAlignment.Value);
                }

                if (b.LineHeight.HasValue)
                {
                    be.LineHeight = b.LineHeight.Value;
                }
            }
            if (e is Inline i && wpf is swd.Inline ie)
            {
                if (i.VerticalAlignment.HasValue)
                {
                    ie.BaselineAlignment = ToBaselineAlignment(i.VerticalAlignment.Value);
                }
            }
            //  finished rendering the attributes


            // now, render all children
            foreach (var child in e.Childs)
            {
                var childe = RenderRecursively(child);

                switch (wpf)
                {
                case swd.Figure figure:
                    figure.Blocks.Add((swd.Block)childe);
                    break;

                case swd.Floater floater:
                    floater.Blocks.Add((swd.Block)childe);
                    break;

                case swd.FlowDocument flowDocument:
                    flowDocument.Blocks.Add((swd.Block)childe);
                    break;

                case swd.List list:
                    list.ListItems.Add((swd.ListItem)childe);
                    break;

                case swd.ListItem listItem:
                    listItem.Blocks.Add((swd.Block)childe);
                    break;

                case swd.Section section:
                    section.Blocks.Add((swd.Block)childe);
                    break;

                case swd.Table table:
                    table.RowGroups.Add((swd.TableRowGroup)childe);
                    break;

                case swd.TableCell tableCell:
                    tableCell.Blocks.Add((swd.Block)childe);
                    break;

                case swd.TableRow tableRow:
                    tableRow.Cells.Add((swd.TableCell)childe);
                    break;

                case swd.TableRowGroup tableRowGroup:
                    tableRowGroup.Rows.Add((swd.TableRow)childe);
                    break;

                // now elements that can contain inlines
                case swd.Paragraph paragraph:
                    paragraph.Inlines.Add((swd.Inline)childe);
                    break;

                case swd.Span span:
                    span.Inlines.Add((swd.Inline)childe);
                    break;

                // now some specialties
                case swd.InlineUIContainer inlineUIContainer:
                    if (inlineUIContainer.Child != null)
                    {
                        throw new InvalidOperationException($"{nameof(swd.InlineUIContainer)} can not contain more than one child");
                    }
                    inlineUIContainer.Child = (System.Windows.UIElement)childe;
                    break;

                case swd.BlockUIContainer blockUIContainer:
                    if (blockUIContainer.Child != null)
                    {
                        throw new InvalidOperationException($"{nameof(swd.BlockUIContainer)} can not contain more than one child");
                    }
                    blockUIContainer.Child = (System.Windows.UIElement)childe;
                    break;

                default:
                    throw new NotImplementedException();
                }
            }

            if (AttachDomAsTags)
            {
                if (wpf is System.Windows.FrameworkContentElement conEle)
                {
                    conEle.Tag = e;
                }
                else if (wpf is System.Windows.FrameworkElement uiEle)
                {
                    uiEle.Tag = e;
                }
            }

            return(wpf);
        }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.myMainWindow = ((Projects_Manager_Medexy.AddTasksToProject)(target));

            #line 8 "..\..\..\windows\AddTasksToProject.xaml"
                this.myMainWindow.Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded);

            #line default
            #line hidden
                return;

            case 2:

            #line 9 "..\..\..\windows\AddTasksToProject.xaml"
                ((System.Windows.Controls.Grid)(target)).SizeChanged += new System.Windows.SizeChangedEventHandler(this.Grid_SizeChanged_1);

            #line default
            #line hidden
                return;

            case 3:
                this.TasksDatagrid = ((System.Windows.Controls.DataGrid)(target));

            #line 10 "..\..\..\windows\AddTasksToProject.xaml"
                this.TasksDatagrid.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.TasksDatagrid_SelectionChanged);

            #line default
            #line hidden
                return;

            case 4:
                this.TaskStartDatePicker = ((System.Windows.Controls.DatePicker)(target));

            #line 71 "..\..\..\windows\AddTasksToProject.xaml"
                this.TaskStartDatePicker.SelectedDateChanged += new System.EventHandler <System.Windows.Controls.SelectionChangedEventArgs>(this.TaskStartDatePicker_SelectedDateChanged);

            #line default
            #line hidden
                return;

            case 5:
                this.TaskEndDatePicker = ((System.Windows.Controls.DatePicker)(target));

            #line 73 "..\..\..\windows\AddTasksToProject.xaml"
                this.TaskEndDatePicker.SelectedDateChanged += new System.EventHandler <System.Windows.Controls.SelectionChangedEventArgs>(this.TaskEndDatePicker_SelectedDateChanged);

            #line default
            #line hidden
                return;

            case 6:
                this.TaskPavTb = ((System.Windows.Controls.TextBox)(target));

            #line 74 "..\..\..\windows\AddTasksToProject.xaml"
                this.TaskPavTb.GotFocus += new System.Windows.RoutedEventHandler(this.TaskPavTb_GotFocus);

            #line default
            #line hidden
                return;

            case 7:
                this.TaskAtsakingasDg = ((System.Windows.Controls.DataGrid)(target));

            #line 76 "..\..\..\windows\AddTasksToProject.xaml"
                this.TaskAtsakingasDg.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.TaskAtsakingasDg_SelectionChanged);

            #line default
            #line hidden
                return;

            case 8:
                this.TaskKomentaras = ((System.Windows.Controls.RichTextBox)(target));

            #line 89 "..\..\..\windows\AddTasksToProject.xaml"
                this.TaskKomentaras.GotFocus += new System.Windows.RoutedEventHandler(this.TaskKomentaras_GotFocus);

            #line default
            #line hidden
                return;

            case 9:
                this.flow1 = ((System.Windows.Documents.FlowDocument)(target));
                return;

            case 10:
                this.Paragraph1 = ((System.Windows.Documents.Paragraph)(target));
                return;

            case 11:
                this.Run1 = ((System.Windows.Documents.Run)(target));
                return;

            case 12:
                this.AddTasksBtn = ((System.Windows.Controls.Button)(target));

            #line 97 "..\..\..\windows\AddTasksToProject.xaml"
                this.AddTasksBtn.Click += new System.Windows.RoutedEventHandler(this.AddTasksBtnClick);

            #line default
            #line hidden
                return;

            case 13:
                this.TaskAtsakingasSearchTb = ((System.Windows.Controls.TextBox)(target));

            #line 98 "..\..\..\windows\AddTasksToProject.xaml"
                this.TaskAtsakingasSearchTb.GotFocus += new System.Windows.RoutedEventHandler(this.TaskAtsakingasSearchTb_GotFocus);

            #line default
            #line hidden

            #line 98 "..\..\..\windows\AddTasksToProject.xaml"
                this.TaskAtsakingasSearchTb.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.TaskAtsakingasSearchTb_TextChanged);

            #line default
            #line hidden
                return;

            case 14:
                this.ClearTaskAtsakingasSearchTbBtn = ((System.Windows.Controls.Button)(target));

            #line 99 "..\..\..\windows\AddTasksToProject.xaml"
                this.ClearTaskAtsakingasSearchTbBtn.Click += new System.Windows.RoutedEventHandler(this.ClearTaskAtsakingasSearchTbBtnClick);

            #line default
            #line hidden
                return;

            case 15:
                this.TaskAddedUsersDg = ((System.Windows.Controls.DataGrid)(target));
                return;

            case 17:
                this.TaskUsersDg = ((System.Windows.Controls.DataGrid)(target));
                return;

            case 19:
                this.TaskInvolvedSearchTb = ((System.Windows.Controls.TextBox)(target));

            #line 145 "..\..\..\windows\AddTasksToProject.xaml"
                this.TaskInvolvedSearchTb.GotFocus += new System.Windows.RoutedEventHandler(this.TaskInvolvedSearchTb_GotFocus);

            #line default
            #line hidden

            #line 145 "..\..\..\windows\AddTasksToProject.xaml"
                this.TaskInvolvedSearchTb.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.TaskInvolvedSearchTb_TextChanged);

            #line default
            #line hidden
                return;

            case 20:
                this.ClearTaskInvolvedSearchTb = ((System.Windows.Controls.Button)(target));

            #line 146 "..\..\..\windows\AddTasksToProject.xaml"
                this.ClearTaskInvolvedSearchTb.Click += new System.Windows.RoutedEventHandler(this.ClearTaskInvolvedSearchTbBtnClick);

            #line default
            #line hidden
                return;

            case 21:
                this.RemoveTaskUsersBtn = ((System.Windows.Controls.Button)(target));

            #line 147 "..\..\..\windows\AddTasksToProject.xaml"
                this.RemoveTaskUsersBtn.Click += new System.Windows.RoutedEventHandler(this.RemoveTaskUsersBtnClick);

            #line default
            #line hidden
                return;

            case 22:
                this.AddTaksUsersBtn = ((System.Windows.Controls.Button)(target));

            #line 148 "..\..\..\windows\AddTasksToProject.xaml"
                this.AddTaksUsersBtn.Click += new System.Windows.RoutedEventHandler(this.AddTaskUsersBtnClick);

            #line default
            #line hidden
                return;

            case 23:
                this.RemoveTasksBtn = ((System.Windows.Controls.Button)(target));

            #line 150 "..\..\..\windows\AddTasksToProject.xaml"
                this.RemoveTasksBtn.Click += new System.Windows.RoutedEventHandler(this.RemoveTasksBtnClick);

            #line default
            #line hidden
                return;

            case 24:
                this.SaveBtn = ((System.Windows.Controls.Button)(target));

            #line 151 "..\..\..\windows\AddTasksToProject.xaml"
                this.SaveBtn.Click += new System.Windows.RoutedEventHandler(this.SaveBtn_OnClick);

            #line default
            #line hidden
                return;

            case 25:
                this.CloseBtn = ((System.Windows.Controls.Button)(target));

            #line 152 "..\..\..\windows\AddTasksToProject.xaml"
                this.CloseBtn.Click += new System.Windows.RoutedEventHandler(this.CloseBtn_OnClick);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
        public void Convert(System.Windows.Documents.FlowDocument document, Stream documentStream)
        {
            var textRange = new TextRange(document.ContentStart, document.ContentEnd);

            textRange.Save(documentStream, DataFormats.Xaml);
        }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 11 "..\..\..\vtnViaje.xaml"
                ((Vistas.vtnViaje)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded);

            #line default
            #line hidden
                return;

            case 2:

            #line 18 "..\..\..\vtnViaje.xaml"
                ((System.Windows.Data.CollectionViewSource)(target)).Filter += new System.Windows.Data.FilterEventHandler(this.CollectionViewSource_Filter);

            #line default
            #line hidden
                return;

            case 3:
                this.Principal = ((System.Windows.Controls.Grid)(target));
                return;

            case 4:
                this.Menu = ((System.Windows.Controls.Grid)(target));
                return;

            case 5:
                this.grdOperador = ((System.Windows.Controls.Grid)(target));
                return;

            case 6:
                this.btnExitOP = ((System.Windows.Controls.Button)(target));

            #line 49 "..\..\..\vtnViaje.xaml"
                this.btnExitOP.Click += new System.Windows.RoutedEventHandler(this.CerrarOperador);

            #line default
            #line hidden
                return;

            case 7:
                this.btnLogoutOP = ((System.Windows.Controls.Button)(target));

            #line 58 "..\..\..\vtnViaje.xaml"
                this.btnLogoutOP.Click += new System.Windows.RoutedEventHandler(this.LogoutOP);

            #line default
            #line hidden
                return;

            case 8:
                this.btnCliente = ((System.Windows.Controls.Button)(target));

            #line 67 "..\..\..\vtnViaje.xaml"
                this.btnCliente.Click += new System.Windows.RoutedEventHandler(this.ClickCliente);

            #line default
            #line hidden
                return;

            case 9:
                this.btnViaje = ((System.Windows.Controls.Button)(target));

            #line 68 "..\..\..\vtnViaje.xaml"
                this.btnViaje.Click += new System.Windows.RoutedEventHandler(this.ClickCViaje);

            #line default
            #line hidden
                return;

            case 10:
                this.imgViaje = ((System.Windows.Controls.Image)(target));
                return;

            case 11:
                this.btnPasaje = ((System.Windows.Controls.Button)(target));

            #line 70 "..\..\..\vtnViaje.xaml"
                this.btnPasaje.Click += new System.Windows.RoutedEventHandler(this.ClickPasaje);

            #line default
            #line hidden
                return;

            case 12:
                this.imgPasaje = ((System.Windows.Controls.Image)(target));
                return;

            case 13:
                this.imgUsuarioOP = ((System.Windows.Controls.Image)(target));
                return;

            case 14:
                this.grdViaje = ((System.Windows.Controls.Grid)(target));
                return;

            case 15:
                this.lstViajes = ((System.Windows.Controls.ListView)(target));
                return;

            case 16:
                this.Empresa = ((System.Windows.Controls.Label)(target));
                return;

            case 17:
                this.cmbEmpresa = ((System.Windows.Controls.ComboBox)(target));
                return;

            case 18:
                this.label2 = ((System.Windows.Controls.Label)(target));
                return;

            case 19:
                this.cmbAutobus = ((System.Windows.Controls.ComboBox)(target));
                return;

            case 20:
                this.label3 = ((System.Windows.Controls.Label)(target));
                return;

            case 21:
                this.dpFechaServicio = ((System.Windows.Controls.DatePicker)(target));
                return;

            case 22:
                this.label4 = ((System.Windows.Controls.Label)(target));
                return;

            case 23:
                this.txtDNI = ((System.Windows.Controls.TextBox)(target));
                return;

            case 24:
                this.btnfiltro = ((System.Windows.Controls.Button)(target));

            #line 104 "..\..\..\vtnViaje.xaml"
                this.btnfiltro.Click += new System.Windows.RoutedEventHandler(this.btnFiltrar_Click);

            #line default
            #line hidden
                return;

            case 25:
                this.btnVistaPrevia = ((System.Windows.Controls.Button)(target));

            #line 105 "..\..\..\vtnViaje.xaml"
                this.btnVistaPrevia.Click += new System.Windows.RoutedEventHandler(this.btnVistaPrevia_Click);

            #line default
            #line hidden
                return;

            case 26:
                this.btnCancelar = ((System.Windows.Controls.Button)(target));

            #line 106 "..\..\..\vtnViaje.xaml"
                this.btnCancelar.Click += new System.Windows.RoutedEventHandler(this.btnCancelar_Click);

            #line default
            #line hidden
                return;

            case 27:
                this.btnUpdate = ((System.Windows.Controls.Button)(target));

            #line 108 "..\..\..\vtnViaje.xaml"
                this.btnUpdate.Click += new System.Windows.RoutedEventHandler(this.btnUpdate_Click);

            #line default
            #line hidden
                return;

            case 28:
                this.label1 = ((System.Windows.Controls.Label)(target));
                return;

            case 29:
                this.dpFechaInicio = ((System.Windows.Controls.DatePicker)(target));
                return;

            case 30:
                this.label5 = ((System.Windows.Controls.Label)(target));
                return;

            case 31:
                this.dpFechaFin = ((System.Windows.Controls.DatePicker)(target));
                return;

            case 32:
                this.label6 = ((System.Windows.Controls.Label)(target));
                return;

            case 33:
                this.label7 = ((System.Windows.Controls.Label)(target));
                return;

            case 34:
                this.label8 = ((System.Windows.Controls.Label)(target));
                return;

            case 35:
                this.txtCantPasaje = ((System.Windows.Controls.TextBox)(target));
                return;

            case 36:
                this.txtMontoTotal = ((System.Windows.Controls.TextBox)(target));
                return;

            case 37:
                this.txtHoraServicio = ((System.Windows.Controls.TextBox)(target));
                return;

            case 38:
                this.grdVistaPrevia = ((System.Windows.Controls.Grid)(target));
                return;

            case 39:
                this.DocPrueba = ((System.Windows.Documents.FlowDocument)(target));
                return;

            case 40:
                this.userListPreview = ((System.Windows.Controls.ListView)(target));
                return;

            case 41:

            #line 149 "..\..\..\vtnViaje.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click);

            #line default
            #line hidden
                return;

            case 42:
                this.btnVolver = ((System.Windows.Controls.Button)(target));

            #line 150 "..\..\..\vtnViaje.xaml"
                this.btnVolver.Click += new System.Windows.RoutedEventHandler(this.btnVolverFiltro);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
Example #46
0
        public void TranslateMessage(String key, String[] data)
        {
            this.Dispatcher.BeginInvoke((Action) delegate()
            {
                try
                {
                    if ("con".Equals(key))
                    {
                        if (data[0].Equals("Y"))
                        {
                            this.Show();
                            parent.loggedIn = true;
                            parent.Close();
                        }
                        else if (data[0].Equals("D"))
                        {
                            MessageBoxResult mbResult = MessageBox.Show("您开没有对该应用进行授权,是否跳转到主站进行授权操作?", "授权验证请求", MessageBoxButton.OKCancel, MessageBoxImage.Question);
                            if (mbResult == MessageBoxResult.OK)
                            {
                                string ret = string.Format("{0}?client_id={1}&response_type=code&redirect_uri={2}", "http://icpc.njust.edu.cn/OAuth/Authorize", "b681a5074007b0a8c2e8fda84ec7be80017c2f04", "http://202.119.81.70:90/OAuthRedirect.aspx");
                                System.Diagnostics.Process.Start(ret);
                            }
                        }
                        else
                        {
                            MessageBox.Show("对不起,用户账号或者密码不正确,登录不成功!");
                        }
                        this.Dispatcher.BeginInvoke((Action) delegate()
                        {
                            parent.msg.Content = "";
                        });
                    }
                    //个人信息
                    #region
                    else if (key.Equals("nick"))//昵称
                    {
                        NickName.Text = data[0];
                    }
                    else if (key.Equals("gender"))//性别
                    {
                        try
                        {
                            if (data[0] == "True")
                            {
                                imale = new Image();
                                //Gender = this.maleRTB;
                                System.Windows.Documents.FlowDocument doc = Gender.Document;
                                doc.Blocks.Clear();
                                byte[] image_full_original_data = Convert.FromBase64String(male);
                                BitmapImage bImg = new BitmapImage();
                                bImg.BeginInit();
                                bImg.StreamSource = new MemoryStream(image_full_original_data);
                                bImg.EndInit();
                                imale.Source = bImg;
                                new InlineUIContainer(this.imale, Gender.Selection.End);
                                Gender.DataContext = "♂";
                            }
                            else
                            {
                                ifemale = new Image();
                                //Gender = this.femaleRTB;
                                System.Windows.Documents.FlowDocument doc = Gender.Document;
                                doc.Blocks.Clear();
                                byte[] image_full_original_data = Convert.FromBase64String(female);
                                BitmapImage bImg = new BitmapImage();
                                bImg.BeginInit();
                                bImg.StreamSource = new MemoryStream(image_full_original_data);
                                bImg.EndInit();
                                ifemale.Source = bImg;
                                new InlineUIContainer(this.ifemale, Gender.Selection.End);
                                Gender.DataContext = "♀";
                            }
                        }
                        catch (Exception ee)
                        {
                            MessageBox.Show(ee.ToString());
                        }
                    }
                    else if (key.Equals("error"))//报错
                    {
                        MessageBox.Show(data[0]);
                    }
                    #endregion
                    //分组管理
                    #region
                    else if (key.Equals("crtgroup"))//创建分组
                    {
                        TreeViewItem tvItem          = new TreeViewItem();
                        tvItem.Header                = data[1];
                        tvItem.DataContext           = data[0];
                        tvItem.MouseRightButtonDown += tb_MouseRightButtonDown;
                        tvItem.MouseRightButtonUp   += tb_MouseRightButtonUp;
                        friendsList.Items.Add(tvItem);
                        getGroupItemById.Add(data[0], tvItem);
                    }
                    else if (key.Equals("chggroup"))//修改分组名称
                    {
                        getGroupItemById[data[0]].Header = data[1];
                    }
                    else if (key.Equals("delroup"))//删除分组
                    {
                        TreeViewItem tvItem = getGroupItemById[data[0]];
                        friendsList.Items.Remove(tvItem);
                        getGroupItemById.Remove(data[0]);
                    }
                    #endregion
                    //好友管理
                    #region
                    else if (key.Equals("crtfrd"))//添加好友
                    {
                        TreeViewItem friendItem = new TreeViewItem();
                        TreeViewItem grpItem    = getGroupItemById[data[1]];
                        String friendInfo       = "";
                        friendInfo += data[2];
                        friendInfo += "(";
                        friendInfo += data[0];
                        friendInfo += ")";
                        String gender;
                        if (data[3] == "True")
                        {
                            friendInfo += "  ♂";
                            gender      = "  ♂";
                        }
                        else
                        {
                            friendInfo += "  ♀";
                            gender      = "  ♀";
                        }
                        friendItem.Header                = friendInfo;
                        object obj                       = new object[] { (object)data[0], (object)data[1], (object)data[2], (object)gender, (object)"  离线", (object)"False" };//ID,组ID,备注,性别,是否在线,是否有窗口
                        friendItem.DataContext           = obj;
                        friendItem.MouseRightButtonDown += friend_MouseRightButtonDown;
                        friendItem.MouseRightButtonUp   += friend_MouseRightButtonUp;
                        friendItem.MouseDoubleClick     += friend_MouseDoubleClick;
                        grpItem.Items.Add(friendItem);
                        getFriendItemById.Add(data[0], friendItem);
                    }
                    else if (key.Equals("chgfrd"))//好友改名
                    {
                        object[] obj   = (object[])getFriendItemById[data[0]].DataContext;
                        String[] datas = new String[6];
                        for (int i = 0; i < obj.Length; i++)
                        {
                            datas[i] = (String)obj[i];
                        }
                        getFriendItemById[data[0]].Header = data[1] + "(" + datas[0] + ")" + datas[3] + datas[4];
                        obj[2] = (object)data[1];
                        getFriendItemById[data[0]].DataContext = (object)obj;
                        if (getChatItemById.ContainsKey(data[0]))
                        {
                            getChatItemById[data[0]].Title = "与 " + data[1] + " 聊天中";
                        }
                    }
                    else if (key.Equals("delfrd"))//删除好友
                    {
                        TreeViewItem tvItem = getFriendItemById[data[0]];
                        object[] obj        = (object[])getFriendItemById[data[0]].DataContext;
                        String[] info       = new String[2];
                        info[0]             = (String)obj[0];
                        info[1]             = (String)obj[1];
                        getGroupItemById[info[1]].Items.Remove(tvItem);
                        if (getChatItemById.ContainsKey(data[0]))
                        {
                            MessageBox.Show("由于删除好友,聊天窗口即将关闭!");
                            getChatItemById[data[0]].Close();
                            getChatItemById.Remove(data[0]);
                        }
                        getFriendItemById.Remove(data[0]);
                    }
                    else if (key.Equals("frdstt"))//提示好友是否在线
                    {
                        object[] obj = (object[])getFriendItemById[data[0]].DataContext;
                        if (data[1] == "True")
                        {
                            obj[4] = "  在线";
                        }
                        else
                        {
                            obj[4] = "  离线";
                        }
                        getFriendItemById[data[0]].Header      = (String)obj[2] + "(" + (String)obj[0] + ")" + (String)obj[3] + (String)obj[4];
                        getFriendItemById[data[0]].DataContext = (object)obj;
                    }
                    else if (key.Equals("cnffrd"))//添加好友确认
                    {
                        String msg = "";
                        msg       += "用户 ";
                        msg       += data[1];
                        msg       += " 请求添加您为好友,是否同意?";
                        MessageBoxResult mbResult = MessageBox.Show(msg, "", MessageBoxButton.OKCancel, MessageBoxImage.Question);
                        if (mbResult == MessageBoxResult.OK)
                        {
                            new AcptCnf(this, data[0], data[2], data[3]).ShowDialog();
                        }
                    }
                    #endregion
                    //接受消息和图片
                    #region
                    else if (key.Equals("recvmsg"))//接受消息
                    {
                        SoundPlayer player = new SoundPlayer((String)AppDomain.CurrentDomain.BaseDirectory + "msg.wav");
                        player.Play();
                        RichTextBox stackrtb = new RichTextBox();
                        stackrtb.SelectAll();
                        stackrtb.Paste();
                        object[] obj;
                        try
                        {
                            obj = (object[])getFriendItemById[data[0]].DataContext;
                        }
                        catch
                        {
                            MessageBox.Show("陌生人 " + data[0] + " 于 " + data[2] + " 发来消息:" + data[1]);
                            return;
                        }
                        if (((String)obj[5]).Equals("False"))
                        {
                            obj[5] = (object)"True";
                            getFriendItemById[(String)obj[0]].DataContext = (object)obj;
                            ChatDialog chatDialog = new ChatDialog((String)obj[2], this, (String)obj[0]);
                            getChatItemById.Add((String)obj[0], chatDialog);
                            chatDialog.Show();
                            chatDialog.Activate();
                        }
                        ChatDialog cDialog = getChatItemById[data[0]];
                        String head        = (String)obj[2] + "  " + data[2];
                        RichTextBox rtb    = new RichTextBox();
                        RichTextBox rtb2   = cDialog.msgRecRichTextBox;
                        rtb2.SelectAll();
                        rtb2.Copy();
                        cDialog.msgRecRichTextBox.SelectAll();
                        cDialog.msgRecRichTextBox.Paste();
                        rtb.AppendText(head);
                        rtb.SelectAll();
                        rtb.Selection.ApplyPropertyValue(TextElement.ForegroundProperty, Brushes.Blue);
                        rtb.Copy();
                        cDialog.msgRecRichTextBox.Paste();
                        cDialog.msgRecRichTextBox.AppendText(data[1] + "\r\n");
                        stackrtb.SelectAll();
                        stackrtb.Copy();
                    }
                    else if (key.Equals("recvimg"))//接收图片
                    {
                        SoundPlayer player = new SoundPlayer((String)AppDomain.CurrentDomain.BaseDirectory + "msg.wav");
                        player.Play();
                        RichTextBox stackrtb = new RichTextBox();
                        stackrtb.SelectAll();
                        stackrtb.Paste();
                        object[] obj;
                        try
                        {
                            obj = (object[])getFriendItemById[data[0]].DataContext;
                        }
                        catch
                        {
                            MessageBox.Show("陌生人 " + data[0] + " 发来图片,由于您未加其为好友,内容不予显示");
                            return;
                        }
                        if (((String)obj[5]).Equals("False"))
                        {
                            obj[5] = (object)"True";
                            getFriendItemById[(String)obj[0]].DataContext = (object)obj;
                            ChatDialog chatDialog = new ChatDialog((String)obj[2], this, (String)obj[0]);
                            getChatItemById.Add((String)obj[0], chatDialog);
                            chatDialog.Show();
                            chatDialog.Activate();
                        }
                        ChatDialog cDialog = getChatItemById[data[0]];
                        String head        = (String)obj[2] + "  " + data[2];
                        RichTextBox rtb    = new RichTextBox();
                        RichTextBox rtb2   = cDialog.msgRecRichTextBox;
                        rtb2.SelectAll();
                        rtb2.Copy();
                        cDialog.msgRecRichTextBox.SelectAll();
                        cDialog.msgRecRichTextBox.Paste();
                        rtb.AppendText(head);
                        rtb.SelectAll();
                        rtb.Selection.ApplyPropertyValue(TextElement.ForegroundProperty, Brushes.Blue);
                        rtb.Copy();
                        cDialog.msgRecRichTextBox.Paste();
                        Image img2        = new Image();
                        BitmapImage bImg2 = new BitmapImage();
                        img2.IsEnabled    = true;
                        byte[] image_full_original_data = Convert.FromBase64String(data[1]);
                        bImg2.BeginInit();
                        bImg2.StreamSource = new MemoryStream(image_full_original_data);
                        bImg2.EndInit();
                        img2.Source = bImg2;
                        new InlineUIContainer(img2, cDialog.msgRecRichTextBox.Selection.End); //插入图片到选定位置
                        stackrtb.SelectAll();
                        stackrtb.Copy();
                    }
                    else if (key.Equals("imgack"))
                    {
                        getChatItemById[data[0]].SendPicButton.IsEnabled = true;
                    }
                    #endregion
                    //离线接收文件
                    #region
                    else if (key.Equals("cnffsnd"))//确认是否接收
                    {
                        object[] obj;
                        try
                        {
                            obj = (object[])getFriendItemById[data[0]].DataContext;
                        }
                        catch
                        {
                            MessageBox.Show("陌生人 " + data[0] + " 请求向您发送文件,由于您未加其为好友,服务器代为拒绝了此文件。");
                            SendMessage("rjctget", new String[] { data[2], data[0], data[1] });
                            return;
                        }
                        String nick = (String)obj[2];
                        if (MessageBox.Show("好友 " + nick + " 请求向您发送文件 " + data[1] + " ,是否接收?", "消息", MessageBoxButton.YesNo, MessageBoxImage.Question).Equals(MessageBoxResult.Yes))
                        {
                            //接收
                            SaveFileDialog sfd = new SaveFileDialog();
                            sfd.Filter         = "All Files (*.*)|*.*";
                            sfd.DefaultExt     = "*" + data[1].Substring(data[1].LastIndexOf('.'));
                            if (sfd.ShowDialog() == true)
                            {
                                getSaveFileUrlOffItemById.Add(data[2], sfd.SafeFileName);
                                getSaveFileOffItemById.Add(data[2], "");
                            }
                            SendMessage("accptget", new String[] { data[2], data[1] });
                        }
                        else//拒绝
                        {
                            SendMessage("rjctget", new String[] { data[2], data[0], data[1] });
                        }
                    }
                    else if (key.Equals("rjctdvr"))
                    {
                        object[] obj = (object[])getFriendItemById[data[0]].DataContext;
                        String nick  = (String)obj[2];
                        MessageBox.Show("对不起," + nick + " 拒绝接收您发送的文件 \"" + data[1] + "\"。");
                    }
                    else if (key.Equals("prepget"))//服务器准备接受文件
                    {
                        getToIdOffItemById.Add(data[2], data[0]);
                        getUrlOffItemById.Add(data[2], data[1]);
                        String datas = ShareFile.Read(data[1]);
                        getProgressDataOffItemById.Add(data[2], datas);
                        int parts = datas.Length / 200000;
                        if (datas.Length % 200000 != 0)
                        {
                            parts++;
                        }
                        getProgressCntOffItemById.Add(data[2], parts);
                        getProgressCntOffNumItemById.Add(data[2], 0);
                        Progress pg = new Progress();
                        getProgressOffItemById.Add(data[2], pg);
                        getProgressOffItemById[data[2]].label.Content = "正在发送 " + data[1];
                        //设置进度条节数parts
                        getProgressOffItemById[data[2]].progressBar.Maximum = parts;
                        pg.Show();
                        if (getProgressCntOffItemById[data[2]] - 1 == getProgressCntOffNumItemById[data[2]])
                        {
                            SendMessage("sfileseg", new String[] { data[2], datas.Substring(200000 * getProgressCntOffNumItemById[data[2]]) });
                        }
                        else
                        {
                            SendMessage("sfileseg", new String[] { data[2], datas.Substring(200000 * getProgressCntOffNumItemById[data[2]], 200000) });
                        }
                    }
                    else if (key.Equals("segcnt"))
                    {
                        int cntnum  = getnum(data[1]);
                        Progress pg = new Progress();
                        getProgressOffItemById.Add(data[0], pg);
                        getProgressOffItemById[data[0]].label.Content = "正在接收文件" + getSaveFileUrlOffItemById[data[0]];
                        //设置进度条节数cntnum
                        getProgressOffItemById[data[0]].progressBar.Maximum = cntnum;
                        pg.Show();
                    }
                    else if (key.Equals("segsucc"))
                    {
                        getProgressOffItemById[data[0]].progressBar.Value += 1.0;
                        getProgressCntOffNumItemById[data[0]]++;
                        if (getProgressCntOffNumItemById[data[0]] == getProgressCntOffItemById[data[0]])
                        {
                            SendMessage("sfilefnsh", new String[] { data[0], getUrlOffItemById[data[0]], getToIdOffItemById[data[0]] });
                            MessageBox.Show("文件已成功发送至服务器!");
                            getProgressOffItemById[data[0]].Close();
                            getProgressOffItemById.Remove(data[0]);
                            getProgressCntOffNumItemById.Remove(data[0]);
                            getProgressCntOffItemById.Remove(data[0]);
                            getProgressDataOffItemById.Remove(data[0]);
                            getToIdOffItemById.Remove(data[0]);
                            getUrlOffItemById.Remove(data[0]);
                        }
                        else
                        {
                            if (getProgressCntOffItemById[data[0]] - 1 == getProgressCntOffNumItemById[data[0]])
                            {
                                SendMessage("sfileseg", new String[] { data[0], getProgressDataOffItemById[data[0]].Substring(200000 * getProgressCntOffNumItemById[data[0]]) });
                            }
                            else
                            {
                                SendMessage("sfileseg", new String[] { data[0], getProgressDataOffItemById[data[0]].Substring(200000 * getProgressCntOffNumItemById[data[0]], 200000) });
                            }
                        }
                    }
                    else if (key.Equals("tfileseg"))
                    {
                        getSaveFileOffItemById[data[0]] += data[1];
                        getProgressOffItemById[data[0]].progressBar.Value += 1.0;
                    }
                    else if (key.Equals("tfilefnsh"))
                    {
                        ShareFile.Write(getSaveFileUrlOffItemById[data[0]], getSaveFileOffItemById[data[0]]);
                        MessageBox.Show("文件 " + data[1] + " 已成功接收!");
                        getProgressOffItemById[data[0]].Close();
                        getProgressOffItemById.Remove(data[0]);
                        getSaveFileUrlOffItemById.Remove(data[0]);
                        getSaveFileOffItemById.Remove(data[0]);
                    }
                    #endregion
                    //在线接收文件
                    #region
                    else if (key.Equals("prepgeton"))
                    {
                        getToIdOnItemById.Add(data[1], data[0]);
                        getUrlOnItemById.Add(data[1], data[2]);
                        Progress pg = new Progress();
                        getProgressOnItemById.Add(data[1], pg);
                        String datas = ShareFile.Read(data[2]);
                        getProgressDataOnItemById.Add(data[1], datas);
                        int parts = datas.Length / 200000;
                        if (datas.Length % 200000 != 0)
                        {
                            parts++;
                        }
                        getProgressOnItemById[data[1]].label.Content = "正在发送 " + data[2];
                        //设置进度条节数parts
                        getProgressOnItemById[data[1]].progressBar.Maximum = parts;
                        pg.Show();
                        getProgressCntOnItemById.Add(data[1], parts);
                        getProgressCntOnNumItemById.Add(data[1], 0);
                        SendMessage("ssegcnton", new String[] { data[0], data[1], parts.ToString() });
                        if (getProgressCntOnItemById[data[1]] - 1 == getProgressCntOnNumItemById[data[1]])
                        {
                            SendMessage("sfilesegon", new String[] { data[1], datas.Substring(200000 * getProgressCntOnNumItemById[data[1]]), data[0] });
                        }
                        else
                        {
                            SendMessage("sfilesegon", new String[] { data[1], datas.Substring(200000 * getProgressCntOnNumItemById[data[1]], 200000), data[0] });
                        }
                    }
                    else if (key.Equals("cnffsndon"))
                    {
                        object[] obj;
                        try
                        {
                            obj = (object[])getFriendItemById[data[0]].DataContext;
                        }
                        catch
                        {
                            MessageBox.Show("陌生人 " + data[0] + " 请求向您发送文件,由于您未加其为好友,服务器代为拒绝了此文件。");
                            SendMessage("rjctgeton", new String[] { data[2], data[0], data[1] });
                            return;
                        }
                        String nick = (String)obj[2];
                        if (MessageBox.Show("好友 " + nick + " 请求向您发送文件 " + data[1] + " ,是否接收?", "消息", MessageBoxButton.YesNo, MessageBoxImage.Question).Equals(MessageBoxResult.Yes))
                        {
                            //接收
                            SaveFileDialog sfd = new SaveFileDialog();
                            sfd.Filter         = "All Files (*.*)|*.*";
                            if (sfd.ShowDialog() == true)
                            {
                                getSaveFileUrlOnItemById.Add(data[2], sfd.SafeFileName);
                                getSaveFileOnItemById.Add(data[2], "");
                            }
                            SendMessage("accptgeton", new String[] { data[0], data[2], data[1] });
                        }
                        else//拒绝
                        {
                            SendMessage("rjctgeton", new String[] { data[2], data[0], data[1] });
                        }
                    }
                    else if (key.Equals("rjctdvron"))
                    {
                        object[] obj = (object[])getFriendItemById[data[0]].DataContext;
                        String nick  = (String)obj[2];
                        MessageBox.Show("对不起," + nick + " 拒绝接收您发送的文件 \"" + data[1] + "\"。");
                    }
                    else if (key.Equals("tsegcnton"))
                    {
                        int cntnum  = getnum(data[1]);
                        Progress pg = new Progress();
                        getProgressOnItemById.Add(data[0], pg);
                        getProgressOnItemById[data[0]].label.Content = "正在接收文件" + getSaveFileUrlOnItemById[data[0]];
                        //设置进度条节数cntnum
                        getProgressOnItemById[data[0]].progressBar.Maximum = cntnum;
                        pg.Show();
                    }
                    else if (key.Equals("segsuccon"))
                    {
                        getProgressOnItemById[data[0]].progressBar.Value += 1.0;
                        getProgressCntOnNumItemById[data[0]]++;
                        if (getProgressCntOnNumItemById[data[0]] == getProgressCntOnItemById[data[0]])
                        {
                            SendMessage("sfilefnshon", new String[] { data[0], getUrlOnItemById[data[0]], getToIdOnItemById[data[0]] });
                            MessageBox.Show("向好友 " + getToIdOnItemById[data[0]] + " 发送的文件 " + getUrlOnItemById[data[0]] + "已成功发送!");
                            getProgressOnItemById[data[0]].Close();
                            getProgressOnItemById.Remove(data[0]);
                            getProgressCntOnNumItemById.Remove(data[0]);
                            getProgressCntOnItemById.Remove(data[0]);
                            getProgressDataOnItemById.Remove(data[0]);
                            getToIdOnItemById.Remove(data[0]);
                            getUrlOnItemById.Remove(data[0]);
                        }
                        else
                        {
                            if (getProgressCntOnItemById[data[0]] - 1 == getProgressCntOnNumItemById[data[0]])
                            {
                                SendMessage("sfilesegon", new String[] { data[0], getProgressDataOnItemById[data[0]].Substring(200000 * getProgressCntOnNumItemById[data[0]]), getToIdOnItemById[data[0]] });
                            }
                            else
                            {
                                SendMessage("sfilesegon", new String[] { data[0], getProgressDataOnItemById[data[0]].Substring(200000 * getProgressCntOnNumItemById[data[0]], 200000), getToIdOnItemById[data[0]] });
                            }
                        }
                    }
                    else if (key.Equals("tfilesegon"))
                    {
                        getSaveFileOnItemById[data[0]] += data[1];
                        getProgressOnItemById[data[0]].progressBar.Value += 1.0;
                    }
                    else if (key.Equals("tfilefnshon"))
                    {
                        ShareFile.Write(getSaveFileUrlOnItemById[data[0]], getSaveFileOnItemById[data[0]]);
                        MessageBox.Show("文件 " + data[1] + " 已成功接收!");
                        getProgressOnItemById[data[0]].Close();
                        getProgressOnItemById.Remove(data[0]);
                        getSaveFileUrlOnItemById.Remove(data[0]);
                        getSaveFileOnItemById.Remove(data[0]);
                    }
                    else if (key.Equals("off"))
                    {
                        MessageBox.Show("当前账号在其他地区登录,您被迫下线!");
                        Environment.Exit(0);
                    }
                    #endregion
                    //历史消息
                    #region
                    else if (key.Equals("history"))
                    {
                        try
                        {
                            HistoryWindow hw;
                            if (this.selfId.Equals(data[0]))
                            {
                                hw = getHistoryItemById[data[1]];
                            }
                            else
                            {
                                hw = getHistoryItemById[data[0]];
                            }
                            RichTextBox stackrtb = new RichTextBox();
                            stackrtb.SelectAll();
                            stackrtb.Paste();

                            RichTextBox rtb = hw.historyRecRichTextBox;
                            rtb.SelectAll();
                            rtb.Copy();
                            hw.historyRecRichTextBox.SelectAll();
                            hw.historyRecRichTextBox.Paste();
                            RichTextBox rtb2 = new RichTextBox();
                            String head      = "";
                            if (this.selfId.Equals(data[0]))
                            {
                                head += this.NickName.Text;
                            }
                            else
                            {
                                object[] obj = (object[])getFriendItemById[data[0]].DataContext;
                                head        += (String)obj[2];
                            }
                            head += "  ";
                            head += data[4];
                            rtb2.AppendText(head);
                            rtb2.SelectAll();
                            if (this.selfId.Equals(data[0]))
                            {
                                rtb2.Selection.ApplyPropertyValue(TextElement.ForegroundProperty, Brushes.DarkGreen);
                            }
                            else
                            {
                                rtb2.Selection.ApplyPropertyValue(TextElement.ForegroundProperty, Brushes.Blue);
                            }
                            rtb2.Copy();
                            hw.historyRecRichTextBox.Paste();
                            if (data[2].Equals("msg"))//文字记录
                            {
                                hw.historyRecRichTextBox.AppendText(data[3] + "\r\n");
                            }
                            else//图片记录
                            {
                                Image img2        = new Image();
                                BitmapImage bImg2 = new BitmapImage();
                                img2.IsEnabled    = true;
                                byte[] image_full_original_data = Convert.FromBase64String(data[3]);
                                bImg2.BeginInit();
                                bImg2.StreamSource = new MemoryStream(image_full_original_data);
                                bImg2.EndInit();
                                img2.Source = bImg2;
                                new InlineUIContainer(img2, hw.historyRecRichTextBox.Selection.End); //插入图片到选定位置
                                //hw.historyRecRichTextBox.AppendText("\r\n");
                            }
                            stackrtb.SelectAll();
                            stackrtb.Copy();
                        }
                        catch (Exception ee)
                        {
                            MessageBox.Show(ee.ToString());
                        }
                    }
                    #endregion
                    else
                    {
                        MessageBox.Show(key);
                    }
                }
                catch { }
            });
        }
Example #47
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.myMainWindow = ((Projects_Manager_Medexy.add_project)(target));

            #line 7 "..\..\..\windows\add_project.xaml"
                this.myMainWindow.Loaded += new System.Windows.RoutedEventHandler(this.myMainWindow_Loaded);

            #line default
            #line hidden
                return;

            case 2:
                this.grid = ((System.Windows.Controls.Grid)(target));

            #line 8 "..\..\..\windows\add_project.xaml"
                this.grid.SizeChanged += new System.Windows.SizeChangedEventHandler(this.Grid_SizeChanged);

            #line default
            #line hidden
                return;

            case 3:
                this.ApplicationScaleTransform = ((System.Windows.Media.ScaleTransform)(target));
                return;

            case 4:
                this.StartDatePicker = ((System.Windows.Controls.DatePicker)(target));

            #line 20 "..\..\..\windows\add_project.xaml"
                this.StartDatePicker.SelectedDateChanged += new System.EventHandler <System.Windows.Controls.SelectionChangedEventArgs>(this.StartDatePicker_SelectedDateChanged);

            #line default
            #line hidden
                return;

            case 5:
                this.EndDatePicker = ((System.Windows.Controls.DatePicker)(target));

            #line 24 "..\..\..\windows\add_project.xaml"
                this.EndDatePicker.SelectedDateChanged += new System.EventHandler <System.Windows.Controls.SelectionChangedEventArgs>(this.EndDatePicker_SelectedDateChanged);

            #line default
            #line hidden
                return;

            case 6:
                this.pavTb = ((System.Windows.Controls.TextBox)(target));

            #line 26 "..\..\..\windows\add_project.xaml"
                this.pavTb.GotFocus += new System.Windows.RoutedEventHandler(this.pavTb_GotFocus);

            #line default
            #line hidden
                return;

            case 7:
                this.added_users_dg = ((System.Windows.Controls.DataGrid)(target));
                return;

            case 9:
                this.users_dg = ((System.Windows.Controls.DataGrid)(target));
                return;

            case 11:
                this.searchTb = ((System.Windows.Controls.TextBox)(target));

            #line 73 "..\..\..\windows\add_project.xaml"
                this.searchTb.GotFocus += new System.Windows.RoutedEventHandler(this.searchTb_GotFocus);

            #line default
            #line hidden

            #line 73 "..\..\..\windows\add_project.xaml"
                this.searchTb.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.searchTb_TextChanged);

            #line default
            #line hidden
                return;

            case 12:
                this.clearSearchTb = ((System.Windows.Controls.Button)(target));

            #line 75 "..\..\..\windows\add_project.xaml"
                this.clearSearchTb.Click += new System.Windows.RoutedEventHandler(this.clearSearchTb_Click);

            #line default
            #line hidden
                return;

            case 13:
                this.RemoveUserBtn = ((System.Windows.Controls.Button)(target));

            #line 77 "..\..\..\windows\add_project.xaml"
                this.RemoveUserBtn.Click += new System.Windows.RoutedEventHandler(this.RemoveUserBtnClick);

            #line default
            #line hidden
                return;

            case 14:
                this.AddUserBtn = ((System.Windows.Controls.Button)(target));

            #line 78 "..\..\..\windows\add_project.xaml"
                this.AddUserBtn.Click += new System.Windows.RoutedEventHandler(this.AddUserBtnClick);

            #line default
            #line hidden
                return;

            case 15:

            #line 79 "..\..\..\windows\add_project.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.SaveProjectBtnClick);

            #line default
            #line hidden
                return;

            case 16:
                this.komentarasTb = ((System.Windows.Controls.RichTextBox)(target));
                return;

            case 17:
                this.flow = ((System.Windows.Documents.FlowDocument)(target));
                return;

            case 18:
                this.Paragraph = ((System.Windows.Documents.Paragraph)(target));
                return;

            case 19:
                this.Run = ((System.Windows.Documents.Run)(target));
                return;

            case 20:
                this.TasksDatagrid = ((System.Windows.Controls.DataGrid)(target));

            #line 88 "..\..\..\windows\add_project.xaml"
                this.TasksDatagrid.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.TasksDatagrid_SelectionChanged);

            #line default
            #line hidden
                return;

            case 21:
                this.TaskStartDatePicker = ((System.Windows.Controls.DatePicker)(target));

            #line 149 "..\..\..\windows\add_project.xaml"
                this.TaskStartDatePicker.SelectedDateChanged += new System.EventHandler <System.Windows.Controls.SelectionChangedEventArgs>(this.TaskStartDatePicker_SelectedDateChanged);

            #line default
            #line hidden
                return;

            case 22:
                this.TaskEndDatePicker = ((System.Windows.Controls.DatePicker)(target));

            #line 151 "..\..\..\windows\add_project.xaml"
                this.TaskEndDatePicker.SelectedDateChanged += new System.EventHandler <System.Windows.Controls.SelectionChangedEventArgs>(this.TaskEndDatePicker_SelectedDateChanged);

            #line default
            #line hidden
                return;

            case 23:
                this.TaskPavTb = ((System.Windows.Controls.TextBox)(target));

            #line 152 "..\..\..\windows\add_project.xaml"
                this.TaskPavTb.GotFocus += new System.Windows.RoutedEventHandler(this.TaskPavTb_GotFocus);

            #line default
            #line hidden
                return;

            case 24:
                this.TaskAtsakingasDg = ((System.Windows.Controls.DataGrid)(target));

            #line 155 "..\..\..\windows\add_project.xaml"
                this.TaskAtsakingasDg.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.TaskAtsakingasDg_SelectionChanged);

            #line default
            #line hidden
                return;

            case 25:
                this.TaskKomentaras = ((System.Windows.Controls.RichTextBox)(target));

            #line 168 "..\..\..\windows\add_project.xaml"
                this.TaskKomentaras.GotFocus += new System.Windows.RoutedEventHandler(this.TaskKomentaras_GotFocus);

            #line default
            #line hidden
                return;

            case 26:
                this.flow1 = ((System.Windows.Documents.FlowDocument)(target));
                return;

            case 27:
                this.Paragraph1 = ((System.Windows.Documents.Paragraph)(target));
                return;

            case 28:
                this.Run1 = ((System.Windows.Documents.Run)(target));
                return;

            case 29:
                this.AddTasksBtn = ((System.Windows.Controls.Button)(target));

            #line 176 "..\..\..\windows\add_project.xaml"
                this.AddTasksBtn.Click += new System.Windows.RoutedEventHandler(this.AddTasksBtnClick);

            #line default
            #line hidden
                return;

            case 30:
                this.TaskAtsakingasSearchTb = ((System.Windows.Controls.TextBox)(target));

            #line 177 "..\..\..\windows\add_project.xaml"
                this.TaskAtsakingasSearchTb.GotFocus += new System.Windows.RoutedEventHandler(this.TaskAtsakingasSearchTb_GotFocus);

            #line default
            #line hidden

            #line 177 "..\..\..\windows\add_project.xaml"
                this.TaskAtsakingasSearchTb.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.TaskAtsakingasSearchTb_TextChanged);

            #line default
            #line hidden
                return;

            case 31:
                this.ClearTaskAtsakingasSearchTbBtn = ((System.Windows.Controls.Button)(target));

            #line 178 "..\..\..\windows\add_project.xaml"
                this.ClearTaskAtsakingasSearchTbBtn.Click += new System.Windows.RoutedEventHandler(this.ClearTaskAtsakingasSearchTbBtnClick);

            #line default
            #line hidden
                return;

            case 32:
                this.TaskAddedUsersDg = ((System.Windows.Controls.DataGrid)(target));
                return;

            case 34:
                this.TaskUsersDg = ((System.Windows.Controls.DataGrid)(target));
                return;

            case 36:
                this.TaskInvolvedSearchTb = ((System.Windows.Controls.TextBox)(target));

            #line 224 "..\..\..\windows\add_project.xaml"
                this.TaskInvolvedSearchTb.GotFocus += new System.Windows.RoutedEventHandler(this.TaskInvolvedSearchTb_GotFocus);

            #line default
            #line hidden

            #line 224 "..\..\..\windows\add_project.xaml"
                this.TaskInvolvedSearchTb.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.TaskInvolvedSearchTb_TextChanged);

            #line default
            #line hidden
                return;

            case 37:
                this.ClearTaskInvolvedSearchTb = ((System.Windows.Controls.Button)(target));

            #line 225 "..\..\..\windows\add_project.xaml"
                this.ClearTaskInvolvedSearchTb.Click += new System.Windows.RoutedEventHandler(this.ClearTaskInvolvedSearchTbBtnClick);

            #line default
            #line hidden
                return;

            case 38:
                this.RemoveTaskUsersBtn = ((System.Windows.Controls.Button)(target));

            #line 226 "..\..\..\windows\add_project.xaml"
                this.RemoveTaskUsersBtn.Click += new System.Windows.RoutedEventHandler(this.RemoveTaskUsersBtnClick);

            #line default
            #line hidden
                return;

            case 39:
                this.AddTaksUsersBtn = ((System.Windows.Controls.Button)(target));

            #line 227 "..\..\..\windows\add_project.xaml"
                this.AddTaksUsersBtn.Click += new System.Windows.RoutedEventHandler(this.AddTaskUsersBtnClick);

            #line default
            #line hidden
                return;

            case 40:
                this.RemoveTasksBtn = ((System.Windows.Controls.Button)(target));

            #line 229 "..\..\..\windows\add_project.xaml"
                this.RemoveTasksBtn.Click += new System.Windows.RoutedEventHandler(this.RemoveTasksBtnClick);

            #line default
            #line hidden
                return;

            case 41:
                this.Close_btn = ((System.Windows.Controls.Button)(target));

            #line 230 "..\..\..\windows\add_project.xaml"
                this.Close_btn.Click += new System.Windows.RoutedEventHandler(this.Close_btn_Click);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
Example #48
0
 protected abstract bool prepareInfo(string Key, System.Windows.Documents.FlowDocument Document);
Example #49
0
        public Action AddToFlowDocument(IResumeDataObject rdo, IResumeFormatObject rfo, Win.FlowDocument flowDoc)
        {
            return(() =>
            {
                var table = new Win.Table();
                table.RowGroups.Add(new Win.TableRowGroup());
                var rg = table.RowGroups[0];
                rg.Rows.Add(new Win.TableRow());
                rg.Rows.Add(new Win.TableRow());

                Win.TableCell add1Cell = new Win.TableCell(new Win.Paragraph(new Win.Run(rdo.AddressLine1)));
                Win.TableCell add2Cell = new Win.TableCell(new Win.Paragraph(new Win.Run(rdo.AddressLine2)));
                Win.TableCell phoneCell = new Win.TableCell(new Win.Paragraph(new Win.Run(rdo.Email)));
                Win.TableCell emailCell = new Win.TableCell(new Win.Paragraph(new Win.Run(rdo.PhoneNumber)));

                rg.Rows[0].Cells.Add(add1Cell);
                rg.Rows[1].Cells.Add(add2Cell);
                rg.Rows[0].Cells.Add(emailCell);
                rg.Rows[1].Cells.Add(phoneCell);

                add1Cell.TextAlignment = TextAlignment.Left;
                add2Cell.TextAlignment = TextAlignment.Left;
                phoneCell.TextAlignment = TextAlignment.Right;
                emailCell.TextAlignment = TextAlignment.Right;

                foreach (var row in rg.Rows)
                {
                    foreach (var cell in row.Cells)
                    {
                        cell.FontFamily = new FontFamily(rfo.BodyFontName);
                        cell.FontSize = rfo.BodyFontSizeWindows;
                    }
                }

                flowDoc.Blocks.Add(table);
            });
        }
Example #50
0
            protected override bool prepareInfo(string Key, System.Windows.Documents.FlowDocument Document)
            {
                // Clear the old text
                Document.Blocks.Clear();

                Run       run;
                Paragraph paragraph;

                #region Abilities list
                if (Key == "data://ABILITIES/")
                {
                    run            = new Run("Abilities");
                    run.FontSize   = 24;
                    run.FontWeight = FontWeights.Bold;
                    Document.Blocks.Add(new Paragraph(run));

                    run          = new Run("\"Abilities\" are what we call the things different items can do. Select an ability from the list below to read more about it.");
                    run.FontSize = 16;
                    Document.Blocks.Add(new Paragraph(run));

                    paragraph = new Paragraph();
                    foreach (VoidRatsAPI.Ability ability in VoidRatsAPI.Ability.ListAbilities())
                    {
                        run          = new Run(ability.Name + "\r\n");
                        run.FontSize = 16;
                        Hyperlink textLink = new Hyperlink(run);
                        textLink.NavigateUri      = new Uri("data://ABILITY/" + ability.ID, UriKind.Absolute);
                        textLink.RequestNavigate +=
                            new System.Windows.Navigation.RequestNavigateEventHandler(HandleAction);

                        paragraph.Inlines.Add(textLink);
                    }
                    ///run = new Run(builder.ToString());
                    ///run.FontSize = 16;
                    ///Document.Blocks.Add(new Paragraph(run));
                    Document.Blocks.Add(paragraph);
                    return(true);
                }
                #endregion
                #region Ability details
                if (Key.StartsWith("data://ABILITY/"))
                {
                    VoidRatsAPI.Ability ability;
                    try { ability = VoidRatsAPI.Ability.GetAbility(int.Parse(Key.Substring("data://ABILITY/".Length))); }
                    catch (Exception) { ability = null; }

                    if (ability == null)
                    {
                        run            = new Run("Ability");
                        run.FontSize   = 24;
                        run.FontWeight = FontWeights.Bold;
                        Document.Blocks.Add(new Paragraph(run));

                        run          = new Run("Ability not found.");
                        run.FontSize = 16;
                        Document.Blocks.Add(new Paragraph(run));
                    }
                    else
                    {
                        run            = new Run("Ability: " + ability.Name);
                        run.FontSize   = 24;
                        run.FontWeight = FontWeights.Bold;
                        Document.Blocks.Add(new Paragraph(run));

                        run          = new Run("Image: Not yet supported.");
                        run.FontSize = 16;
                        Document.Blocks.Add(new Paragraph(run));

                        paragraph = new Paragraph();
                        for (int i = 0; i < ability.FieldNames.Length; i++)
                        {
                            run          = new Run(ability.FieldNames[i] + "\r\n");
                            run.FontSize = 16;
                            paragraph.Inlines.Add(run);
                        }
                        Document.Blocks.Add(paragraph);

                        run          = new Run(ability.Description);
                        run.FontSize = 16;
                        Document.Blocks.Add(new Paragraph(run));
                    }
                    return(true);
                }
                #endregion
                #region Resources list
                if (Key == "data://RESOURCES/")
                {
                    run            = new Run("Resources");
                    run.FontSize   = 24;
                    run.FontWeight = FontWeights.Bold;
                    Document.Blocks.Add(new Paragraph(run));

                    run          = new Run("\"Resources\" are what you will need to build or buy anything. The most useful resource and most abundant, energy, is the defacto currency. Select an resource from the list below to read more about it.");
                    run.FontSize = 16;
                    Document.Blocks.Add(new Paragraph(run));

                    paragraph = new Paragraph();
                    foreach (VoidRatsAPI.Resource resource in VoidRatsAPI.Resource.ListResources())
                    {
                        run          = new Run(resource.Name + "\r\n");
                        run.FontSize = 16;
                        Hyperlink textLink = new Hyperlink(run);
                        textLink.NavigateUri      = new Uri("data://RESOURCE/" + resource.ID, UriKind.Absolute);
                        textLink.RequestNavigate +=
                            new System.Windows.Navigation.RequestNavigateEventHandler(HandleAction);

                        paragraph.Inlines.Add(textLink);
                    }
                    ///run = new Run(builder.ToString());
                    ///run.FontSize = 16;
                    ///Document.Blocks.Add(new Paragraph(run));
                    Document.Blocks.Add(paragraph);
                    return(true);
                }
                #endregion
                #region Resource details
                if (Key.StartsWith("data://RESOURCE/"))
                {
                    VoidRatsAPI.Resource resource;
                    try { resource = VoidRatsAPI.Resource.GetResource(int.Parse(Key.Substring("data://RESOURCE/".Length))); }
                    catch (Exception) { resource = null; }

                    if (resource == null)
                    {
                        run            = new Run("Resource");
                        run.FontSize   = 24;
                        run.FontWeight = FontWeights.Bold;
                        Document.Blocks.Add(new Paragraph(run));

                        run          = new Run("Resource not found.");
                        run.FontSize = 16;
                        Document.Blocks.Add(new Paragraph(run));
                    }
                    else
                    {
                        run            = new Run("Resource: " + resource.Name);
                        run.FontSize   = 24;
                        run.FontWeight = FontWeights.Bold;
                        Document.Blocks.Add(new Paragraph(run));

                        run          = new Run("Image: Not yet supported.");
                        run.FontSize = 16;
                        Document.Blocks.Add(new Paragraph(run));

                        run = new Run("Density: " + resource.Density.ToString("0.0") + " k.g./m^3\r\n" +
                                      "Nominal Price: " + resource.NominalPrice.ToString("0") + " watts/k.g. (a theoretical price for this resources, if the stock market stopped being run by people and all trade suddenly became mathematically fair and perfect overnight)\r\n" +
                                      "System Availability: " + resource.SystemAvailability.ToString("0") + "% (a relative value to express how common the resource is within the stellar system)\r\n" +
                                      "System Usage: " + resource.SystemUsage.ToString("0") + "% (a relative value to express how common use of this resource is within the stellar system)");
                        run.FontSize = 16;
                        Document.Blocks.Add(new Paragraph(run));

                        run          = new Run(resource.Description);
                        run.FontSize = 16;
                        Document.Blocks.Add(new Paragraph(run));
                    }
                    return(true);
                }
                #endregion

                #region World info list
                if (Key == "data://WORLDINFO/")
                {
                    run            = new Run("World Info");
                    run.FontSize   = 24;
                    run.FontWeight = FontWeights.Bold;
                    Document.Blocks.Add(new Paragraph(run));

                    run          = new Run("Here you can learn how to play the game, and read up on some of the official background storyline.");
                    run.FontSize = 16;
                    Document.Blocks.Add(new Paragraph(run));

                    paragraph = new Paragraph();
                    foreach (VoidRatsAPI.WorldInfo worldInfo in VoidRatsAPI.WorldInfo.ListChildren(0))
                    {
                        run          = new Run(worldInfo.Name + "\r\n");
                        run.FontSize = 16;
                        Hyperlink textLink = new Hyperlink(run);
                        textLink.NavigateUri      = new Uri("data://WORLDINFO/" + worldInfo.ID, UriKind.Absolute);
                        textLink.RequestNavigate +=
                            new System.Windows.Navigation.RequestNavigateEventHandler(HandleAction);

                        paragraph.Inlines.Add(textLink);
                    }
                    Document.Blocks.Add(paragraph);
                    return(true);
                }
                #endregion
                #region World info details
                if (Key.StartsWith("data://WORLDINFO/"))
                {
                    VoidRatsAPI.WorldInfo worldInfo;
                    try { worldInfo = VoidRatsAPI.WorldInfo.GetWorldInfo(int.Parse(Key.Substring("data://WORLDINFO/".Length))); }
                    catch (Exception) { worldInfo = null; }

                    if (worldInfo == null)
                    {
                        run            = new Run("World Info");
                        run.FontSize   = 24;
                        run.FontWeight = FontWeights.Bold;
                        Document.Blocks.Add(new Paragraph(run));

                        run          = new Run("World information not found.");
                        run.FontSize = 16;
                        Document.Blocks.Add(new Paragraph(run));
                    }
                    else
                    {
                        run            = new Run("World Info: " + worldInfo.Name);
                        run.FontSize   = 24;
                        run.FontWeight = FontWeights.Bold;
                        Document.Blocks.Add(new Paragraph(run));

                        run          = new Run(worldInfo.Description);
                        run.FontSize = 16;
                        Document.Blocks.Add(new Paragraph(run));

                        List <VoidRatsAPI.WorldInfo> seeAlso = new List <VoidRatsAPI.WorldInfo>();
                        if (worldInfo.Parent > 0)
                        {
                            seeAlso.Add(VoidRatsAPI.WorldInfo.GetWorldInfo(worldInfo.Parent));
                        }
                        else
                        {
                            seeAlso.AddRange(VoidRatsAPI.WorldInfo.ListChildren(0));
                        }
                        seeAlso.AddRange(VoidRatsAPI.WorldInfo.ListChildren(worldInfo.ID));

                        if (seeAlso.Count > 0)
                        {
                            paragraph      = new Paragraph();
                            run            = new Run("See Also:\r\n");
                            run.FontSize   = 20;
                            run.FontWeight = FontWeights.Bold;
                            paragraph.Inlines.Add(run);

                            foreach (VoidRatsAPI.WorldInfo also in seeAlso)
                            {
                                run          = new Run(also.Name + "\r\n");
                                run.FontSize = 16;
                                Hyperlink textLink = new Hyperlink(run);
                                textLink.NavigateUri      = new Uri("data://WORLDINFO/" + also.ID, UriKind.Absolute);
                                textLink.RequestNavigate +=
                                    new System.Windows.Navigation.RequestNavigateEventHandler(HandleAction);

                                paragraph.Inlines.Add(textLink);
                            }
                            Document.Blocks.Add(paragraph);
                        }
                    }
                    return(true);
                }
                #endregion



                Document.Blocks.Add(new Paragraph(new Run("Could not find the topic in question.")));
                Document.Blocks.Add(new Paragraph(new Run(Key)));

                return(true);
            }
Example #51
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.menu = ((System.Windows.Controls.Menu)(target));
                return;

            case 2:

            #line 35 "..\..\PetPostAddControl.xaml"
                ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.MenuItem_Click);

            #line default
            #line hidden
                return;

            case 3:
                this.btnBold = ((System.Windows.Controls.MenuItem)(target));
                return;

            case 4:
                this.btnItalic = ((System.Windows.Controls.MenuItem)(target));
                return;

            case 5:
                this.btnUnderline = ((System.Windows.Controls.MenuItem)(target));
                return;

            case 6:
                this.comFontFamily = ((System.Windows.Controls.ComboBox)(target));

            #line 57 "..\..\PetPostAddControl.xaml"
                this.comFontFamily.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.ComboBox_SelectionChanged);

            #line default
            #line hidden
                return;

            case 7:
                this.comFontSize = ((System.Windows.Controls.ComboBox)(target));

            #line 62 "..\..\PetPostAddControl.xaml"
                this.comFontSize.AddHandler(System.Windows.Controls.Primitives.TextBoxBase.TextChangedEvent, new System.Windows.Controls.TextChangedEventHandler(this.comFontSize_TextChanged));

            #line default
            #line hidden
                return;

            case 8:
                this.Title = ((System.Windows.Controls.TextBox)(target));
                return;

            case 9:
                this.Category = ((System.Windows.Controls.ComboBox)(target));
                return;

            case 10:
                this.richTextBox = ((System.Windows.Controls.RichTextBox)(target));

            #line 75 "..\..\PetPostAddControl.xaml"
                this.richTextBox.SelectionChanged += new System.Windows.RoutedEventHandler(this.richTextBox_SelectionChanged);

            #line default
            #line hidden
                return;

            case 11:
                this.rich1 = ((System.Windows.Documents.FlowDocument)(target));
                return;

            case 12:
                this.label1 = ((System.Windows.Controls.Label)(target));
                return;

            case 13:

            #line 89 "..\..\PetPostAddControl.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click);

            #line default
            #line hidden
                return;

            case 14:

            #line 90 "..\..\PetPostAddControl.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click_1);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
Example #52
0
        public Action AddToFlowDocument(IResumeDataObject rdo, IResumeFormatObject rfo, Win.FlowDocument flowDoc)
        {
            return(() =>
            {
                var para = new Win.Paragraph(new Win.Run(rdo.FullName));

                para.FontSize = rfo.NameFontSizeWindows;
                para.Foreground = rfo.NameColorBrush;
                para.TextAlignment = TextAlignment.Center;
                para.FontFamily = new FontFamily(rfo.NameFontName);
                para.Margin = rfo.HeaderMargin;

                flowDoc.Blocks.Add(para);
            });
        }
Example #53
0
        public Action AddToFlowDocument(IResumeDataObject rdo, IResumeFormatObject rfo, Win.FlowDocument flowDoc)
        {
            return(() =>
            {
                var list = new List <Win.Block>();

                if (rdo.PublicationEntities != null && rdo.PublicationEntities.Count > 0)
                {
                    Win.Paragraph pubTitle = new Win.Paragraph(new Win.Run("Publications"));
                    pubTitle.Foreground = rfo.HeaderColorBrush;
                    pubTitle.FontFamily = new FontFamily(rfo.HeaderFontName);
                    pubTitle.FontSize = rfo.HeaderFontSizeWindows;
                    pubTitle.Margin = rfo.HeaderMargin;
                    list.Add(pubTitle);

                    foreach (var item in rdo.PublicationEntities)
                    {
                        Win.Paragraph pItem = new Win.Paragraph();
                        pItem.Inlines.Add(new Win.Run(item.Publication));
                        pItem.FontFamily = new FontFamily(rfo.BodyFontName);
                        pItem.FontSize = rfo.BodyFontSizeWindows;
                        list.Add(pItem);
                    }
                }

                foreach (var item in list)
                {
                    flowDoc.Blocks.Add(item);
                }
            });
        }
Example #54
0
        public Action AddToFlowDocument(IResumeDataObject rdo, IResumeFormatObject rfo, Win.FlowDocument flowDoc)
        {
            return(() =>
            {
                var list = new List <Win.Block>();

                // "Experience" header
                Win.Paragraph expTitlePara = new Win.Paragraph();
                expTitlePara.Inlines.Add(new Win.Run("Experience"));

                expTitlePara.Margin = new System.Windows.Thickness(0, 20, 0, 20);
                expTitlePara.Foreground = rfo.HeaderColorBrush;
                expTitlePara.FontFamily = new FontFamily(rfo.HeaderFontName);
                expTitlePara.FontSize = rfo.HeaderFontSizeWindows;
                expTitlePara.Margin = rfo.HeaderMargin;

                list.Add(expTitlePara);

                for (int i = 0; i < rdo.ExperienceEntities.Count; i++)
                {
                    var expItem = rdo.ExperienceEntities[i];

                    // Employer Name
                    Win.Paragraph empName = new Win.Paragraph(new Win.Run(expItem.Employer));
                    empName.Foreground = rfo.JobInfoColorBrush;
                    empName.FontFamily = new FontFamily(rfo.JobInfoFontName);
                    empName.FontSize = rfo.JobInfoFontSizeWindows;
                    list.Add(empName);

                    // Title
                    Win.Paragraph title = new Win.Paragraph(new Win.Run(expItem.Titles.FirstOrDefault()));
                    title.Foreground = rfo.JobInfoColorBrush;
                    title.FontFamily = new FontFamily(rfo.JobInfoFontName);
                    title.FontSize = rfo.JobInfoFontSizeWindows;
                    list.Add(title);

                    // Dates
                    Win.Paragraph dates = new Win.Paragraph(new Win.Run(expItem.StartDate + " - " + expItem.EndDate));
                    dates.Foreground = rfo.JobInfoColorBrush;
                    dates.FontFamily = new FontFamily(rfo.JobInfoFontName);
                    dates.FontSize = rfo.JobInfoFontSizeWindows;
                    list.Add(dates);

                    // List of experience items
                    Win.List bullets = new Win.List();
                    for (int j = 0; j < rdo.ExperienceEntities[i].Details.Count; j++)
                    {
                        var item = new Win.ListItem(new Win.Paragraph(new Win.Run(rdo.ExperienceEntities[i].Details[j])));
                        bullets.ListItems.Add(item);
                        item.FontFamily = new FontFamily(rfo.BodyFontName);
                        item.FontSize = rfo.BodyFontSizeWindows;
                        bullets.Margin = bulletMargin;
                        list.Add(bullets);
                    }
                }

                foreach (var item in list)
                {
                    flowDoc.Blocks.Add(item);
                }
            });
        }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 11 "..\..\Dashboard.xaml"
                ((Project_Transport.Dashboard)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded);

            #line default
            #line hidden
                return;

            case 2:
                this.lbl = ((System.Windows.Controls.Label)(target));
                return;

            case 3:
                this.lbl1 = ((System.Windows.Controls.Label)(target));
                return;

            case 4:
                this.tableView = ((System.Windows.Documents.FlowDocument)(target));
                return;

            case 5:
                this.tableView1 = ((System.Windows.Documents.FlowDocument)(target));
                return;

            case 6:
                this.sticky = ((System.Windows.Controls.StackPanel)(target));
                return;

            case 7:
                this.rtbox = ((System.Windows.Controls.RichTextBox)(target));

            #line 62 "..\..\Dashboard.xaml"
                this.rtbox.GotFocus += new System.Windows.RoutedEventHandler(this.rtbox_GotFocus);

            #line default
            #line hidden

            #line 62 "..\..\Dashboard.xaml"
                this.rtbox.LostFocus += new System.Windows.RoutedEventHandler(this.rtbox_LostFocus);

            #line default
            #line hidden
                return;

            case 8:
                this.columnChart = ((System.Windows.Controls.DataVisualization.Charting.Chart)(target));
                return;

            case 9:
                this.areaChart = ((System.Windows.Controls.DataVisualization.Charting.Chart)(target));
                return;

            case 10:

            #line 97 "..\..\Dashboard.xaml"
                ((System.Windows.Documents.Hyperlink)(target)).Click += new System.Windows.RoutedEventHandler(this.Diesel_Payment_Click);

            #line default
            #line hidden
                return;

            case 11:

            #line 115 "..\..\Dashboard.xaml"
                ((System.Windows.Documents.Hyperlink)(target)).Click += new System.Windows.RoutedEventHandler(this.Lpg_trip_Click);

            #line default
            #line hidden
                return;

            case 12:

            #line 132 "..\..\Dashboard.xaml"
                ((System.Windows.Documents.Hyperlink)(target)).Click += new System.Windows.RoutedEventHandler(this.Load_Trailer_Click);

            #line default
            #line hidden
                return;

            case 13:

            #line 149 "..\..\Dashboard.xaml"
                ((System.Windows.Documents.Hyperlink)(target)).Click += new System.Windows.RoutedEventHandler(this.Lpg_Payment_Click);

            #line default
            #line hidden
                return;

            case 14:

            #line 162 "..\..\Dashboard.xaml"
                ((System.Windows.Documents.Hyperlink)(target)).Click += new System.Windows.RoutedEventHandler(this.Load_Payment_Click);

            #line default
            #line hidden
                return;

            case 15:

            #line 175 "..\..\Dashboard.xaml"
                ((System.Windows.Documents.Hyperlink)(target)).Click += new System.Windows.RoutedEventHandler(this.Profit_Click);

            #line default
            #line hidden
                return;

            case 16:

            #line 177 "..\..\Dashboard.xaml"
                ((System.Windows.Documents.Hyperlink)(target)).Click += new System.Windows.RoutedEventHandler(this.Poweredby_Clicked);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
Example #56
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 11 "..\..\..\Reports\QuotationReport.xaml"
                ((ShortBody.Reports.QuotationReport)(target)).Closing += new System.ComponentModel.CancelEventHandler(this.Window_Closing);

            #line default
            #line hidden
                return;

            case 2:
                this.MainGrid = ((System.Windows.Controls.Grid)(target));
                return;

            case 3:
                this.TopPanel = ((System.Windows.Controls.StackPanel)(target));
                return;

            case 4:

            #line 139 "..\..\..\Reports\QuotationReport.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click);

            #line default
            #line hidden
                return;

            case 5:

            #line 142 "..\..\..\Reports\QuotationReport.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.PrintPreview_Click);

            #line default
            #line hidden
                return;

            case 6:
                this.Document = ((System.Windows.Controls.FlowDocumentScrollViewer)(target));

            #line 148 "..\..\..\Reports\QuotationReport.xaml"
                this.Document.Loaded += new System.Windows.RoutedEventHandler(this.FlowDocumentPageViewer_Loaded);

            #line default
            #line hidden
                return;

            case 7:
                this.FD = ((System.Windows.Documents.FlowDocument)(target));
                return;

            case 8:
                this.helperPanel = ((System.Windows.Controls.StackPanel)(target));
                return;

            case 9:
                this.btnFsIncrease = ((System.Windows.Controls.Button)(target));

            #line 265 "..\..\..\Reports\QuotationReport.xaml"
                this.btnFsIncrease.Click += new System.Windows.RoutedEventHandler(this.btnFsIncrease_Click);

            #line default
            #line hidden
                return;

            case 10:
                this.btnFsDecrease = ((System.Windows.Controls.Button)(target));

            #line 269 "..\..\..\Reports\QuotationReport.xaml"
                this.btnFsDecrease.Click += new System.Windows.RoutedEventHandler(this.btnFsDecrease_Click);

            #line default
            #line hidden
                return;

            case 11:
                this.btnClearFormatting = ((System.Windows.Controls.Button)(target));

            #line 273 "..\..\..\Reports\QuotationReport.xaml"
                this.btnClearFormatting.Click += new System.Windows.RoutedEventHandler(this.btnClearFormatting_Click);

            #line default
            #line hidden
                return;

            case 12:
                this.btnBolden = ((System.Windows.Controls.Button)(target));

            #line 277 "..\..\..\Reports\QuotationReport.xaml"
                this.btnBolden.Click += new System.Windows.RoutedEventHandler(this.btnBolden_Click);

            #line default
            #line hidden
                return;

            case 13:
                this.btnUnderline = ((System.Windows.Controls.Button)(target));

            #line 281 "..\..\..\Reports\QuotationReport.xaml"
                this.btnUnderline.Click += new System.Windows.RoutedEventHandler(this.btnUnderline_Click);

            #line default
            #line hidden
                return;

            case 14:
                this.btnItalicize = ((System.Windows.Controls.Button)(target));

            #line 286 "..\..\..\Reports\QuotationReport.xaml"
                this.btnItalicize.Click += new System.Windows.RoutedEventHandler(this.btnItalicize_Click);

            #line default
            #line hidden
                return;

            case 15:
                this.btnDeleteItem = ((System.Windows.Controls.Button)(target));

            #line 291 "..\..\..\Reports\QuotationReport.xaml"
                this.btnDeleteItem.Click += new System.Windows.RoutedEventHandler(this.DeleteButton_Click);

            #line default
            #line hidden
                return;

            case 16:
                this.ItemsDataGrid = ((System.Windows.Controls.DataGrid)(target));

            #line 309 "..\..\..\Reports\QuotationReport.xaml"
                this.ItemsDataGrid.BeginningEdit += new System.EventHandler <System.Windows.Controls.DataGridBeginningEditEventArgs>(this.ItemsDataGrid_BeginningEdit);

            #line default
            #line hidden

            #line 309 "..\..\..\Reports\QuotationReport.xaml"
                this.ItemsDataGrid.Sorting += new System.Windows.Controls.DataGridSortingEventHandler(this.ItemsDataGrid_Sorting);

            #line default
            #line hidden

            #line 310 "..\..\..\Reports\QuotationReport.xaml"
                this.ItemsDataGrid.PreviewMouseWheel += new System.Windows.Input.MouseWheelEventHandler(this.ItemsDataGrid_PreviewMouseWheel);

            #line default
            #line hidden

            #line 313 "..\..\..\Reports\QuotationReport.xaml"
                this.ItemsDataGrid.KeyUp += new System.Windows.Input.KeyEventHandler(this.ItemsDataGrid_KeyUp);

            #line default
            #line hidden

            #line 313 "..\..\..\Reports\QuotationReport.xaml"
                this.ItemsDataGrid.CellEditEnding += new System.EventHandler <System.Windows.Controls.DataGridCellEditEndingEventArgs>(this.ItemsDataGrid_CellEditEnding);

            #line default
            #line hidden

            #line 315 "..\..\..\Reports\QuotationReport.xaml"
                this.ItemsDataGrid.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.ItemsDataGrid_SelectionChanged);

            #line default
            #line hidden

            #line 315 "..\..\..\Reports\QuotationReport.xaml"
                this.ItemsDataGrid.LoadingRow += new System.EventHandler <System.Windows.Controls.DataGridRowEventArgs>(this.ItemsDataGrid_LoadingRow);

            #line default
            #line hidden
                return;

            case 17:
                this.tbVatAmount = ((System.Windows.Controls.TextBox)(target));
                return;

            case 18:
                this.tbSubTotal = ((System.Windows.Controls.TextBox)(target));
                return;

            case 19:
                this.tbVat = ((System.Windows.Controls.TextBox)(target));
                return;

            case 20:
                this.tbTotal = ((System.Windows.Controls.TextBox)(target));
                return;

            case 21:
                this.SpAccountNavigator = ((System.Windows.Controls.StackPanel)(target));
                return;

            case 22:
                this.btnUp = ((System.Windows.Controls.Button)(target));

            #line 435 "..\..\..\Reports\QuotationReport.xaml"
                this.btnUp.Click += new System.Windows.RoutedEventHandler(this.CounterBtn_Click);

            #line default
            #line hidden
                return;

            case 23:
                this.tbCounter = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 24:
                this.btnDown = ((System.Windows.Controls.Button)(target));

            #line 441 "..\..\..\Reports\QuotationReport.xaml"
                this.btnDown.Click += new System.Windows.RoutedEventHandler(this.CounterBtn_Click);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
Example #57
0
 public string GetText(System.Windows.Documents.FlowDocument document)
 {
     return(ReplaceLastOccurrence(new TextRange(document.ContentStart, document.ContentEnd).Text, Environment.NewLine, String.Empty));
 }
Example #58
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 4 "..\..\..\MainWindow.xaml"
                ((TwitchIrcChat.MainWindow)(target)).Closing += new System.ComponentModel.CancelEventHandler(this.Window_Closing);

            #line default
            #line hidden

            #line 4 "..\..\..\MainWindow.xaml"
                ((TwitchIrcChat.MainWindow)(target)).Closed += new System.EventHandler(this.Window_Closed);

            #line default
            #line hidden
                return;

            case 2:
                this.image_test = ((System.Windows.Controls.Image)(target));
                return;

            case 3:
                this.textBox1 = ((System.Windows.Controls.TextBox)(target));

            #line 8 "..\..\..\MainWindow.xaml"
                this.textBox1.KeyUp += new System.Windows.Input.KeyEventHandler(this.Window_KeyUp);

            #line default
            #line hidden
                return;

            case 4:
                this.grid1 = ((System.Windows.Controls.Grid)(target));
                return;

            case 5:
                this.chat_area = ((System.Windows.Controls.RichTextBox)(target));
                return;

            case 6:
                this.chat_flow = ((System.Windows.Documents.FlowDocument)(target));
                return;

            case 7:
                this.Text_UserList = ((System.Windows.Controls.RichTextBox)(target));
                return;

            case 8:
                this.textBlock1 = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 9:
                this.text_user = ((System.Windows.Controls.TextBox)(target));

            #line 25 "..\..\..\MainWindow.xaml"
                this.text_user.KeyUp += new System.Windows.Input.KeyEventHandler(this.Window_KeyUpJoin);

            #line default
            #line hidden
                return;

            case 10:
                this.textBlock2 = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 11:
                this.textBlock3 = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 12:
                this.text_chan = ((System.Windows.Controls.TextBox)(target));

            #line 28 "..\..\..\MainWindow.xaml"
                this.text_chan.KeyUp += new System.Windows.Input.KeyEventHandler(this.Window_KeyUpJoin);

            #line default
            #line hidden
                return;

            case 13:
                this.button_join = ((System.Windows.Controls.Button)(target));

            #line 29 "..\..\..\MainWindow.xaml"
                this.button_join.Click += new System.Windows.RoutedEventHandler(this.button_join_Click);

            #line default
            #line hidden
                return;

            case 14:
                this.button_part = ((System.Windows.Controls.Button)(target));

            #line 30 "..\..\..\MainWindow.xaml"
                this.button_part.Click += new System.Windows.RoutedEventHandler(this.button_part_Click);

            #line default
            #line hidden
                return;

            case 15:
                this.text_pass = ((System.Windows.Controls.PasswordBox)(target));

            #line 31 "..\..\..\MainWindow.xaml"
                this.text_pass.KeyUp += new System.Windows.Input.KeyEventHandler(this.Window_KeyUpJoin);

            #line default
            #line hidden
                return;

            case 16:
                this.Button_Clear = ((System.Windows.Controls.Button)(target));

            #line 32 "..\..\..\MainWindow.xaml"
                this.Button_Clear.Click += new System.Windows.RoutedEventHandler(this.Button_Clear_Click);

            #line default
            #line hidden
                return;

            case 17:
                this.DateFormat = ((System.Windows.Controls.TextBox)(target));
                return;

            case 18:
                this.textBlock4 = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 19:
                this.RememberMe = ((System.Windows.Controls.CheckBox)(target));
                return;
            }
            this._contentLoaded = true;
        }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 9 "..\..\..\vtnUsuarios.xaml"
                ((Vistas.vtnUsuarios)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded);

            #line default
            #line hidden
                return;

            case 2:

            #line 23 "..\..\..\vtnUsuarios.xaml"
                ((System.Windows.Data.CollectionViewSource)(target)).Filter += new System.Windows.Data.FilterEventHandler(this.CollectionViewSource_Filter);

            #line default
            #line hidden
                return;

            case 3:
                this.Principal = ((System.Windows.Controls.Grid)(target));
                return;

            case 4:
                this.grdAdmin = ((System.Windows.Controls.Grid)(target));
                return;

            case 5:
                this.btnExitADM = ((System.Windows.Controls.Button)(target));

            #line 52 "..\..\..\vtnUsuarios.xaml"
                this.btnExitADM.Click += new System.Windows.RoutedEventHandler(this.CerrarAdmin);

            #line default
            #line hidden
                return;

            case 6:
                this.btnLogoutADM = ((System.Windows.Controls.Button)(target));

            #line 61 "..\..\..\vtnUsuarios.xaml"
                this.btnLogoutADM.Click += new System.Windows.RoutedEventHandler(this.LogoutADM);

            #line default
            #line hidden
                return;

            case 7:
                this.btnUsuario = ((System.Windows.Controls.Button)(target));

            #line 70 "..\..\..\vtnUsuarios.xaml"
                this.btnUsuario.Click += new System.Windows.RoutedEventHandler(this.ClickUsuario);

            #line default
            #line hidden
                return;

            case 8:
                this.imgUsuario = ((System.Windows.Controls.Image)(target));
                return;

            case 9:
                this.btnAutoBus = ((System.Windows.Controls.Button)(target));

            #line 72 "..\..\..\vtnUsuarios.xaml"
                this.btnAutoBus.Click += new System.Windows.RoutedEventHandler(this.ClickAutoBus);

            #line default
            #line hidden
                return;

            case 10:
                this.imgAutoBus = ((System.Windows.Controls.Image)(target));
                return;

            case 11:
                this.btnCiudad = ((System.Windows.Controls.Button)(target));

            #line 74 "..\..\..\vtnUsuarios.xaml"
                this.btnCiudad.Click += new System.Windows.RoutedEventHandler(this.ClickCiudad);

            #line default
            #line hidden
                return;

            case 12:
                this.imgCiudad = ((System.Windows.Controls.Image)(target));
                return;

            case 13:
                this.btnTerminal = ((System.Windows.Controls.Button)(target));

            #line 76 "..\..\..\vtnUsuarios.xaml"
                this.btnTerminal.Click += new System.Windows.RoutedEventHandler(this.ClickTerminal);

            #line default
            #line hidden
                return;

            case 14:
                this.imgTerminal = ((System.Windows.Controls.Image)(target));
                return;

            case 15:
                this.btnEmpresa = ((System.Windows.Controls.Button)(target));

            #line 78 "..\..\..\vtnUsuarios.xaml"
                this.btnEmpresa.Click += new System.Windows.RoutedEventHandler(this.ClickEmpresa);

            #line default
            #line hidden
                return;

            case 16:
                this.imgEmpresa = ((System.Windows.Controls.Image)(target));
                return;

            case 17:
                this.grdUsuario = ((System.Windows.Controls.Grid)(target));
                return;

            case 18:
                this.label1 = ((System.Windows.Controls.Label)(target));
                return;

            case 19:
                this.label2 = ((System.Windows.Controls.Label)(target));
                return;

            case 20:
                this.label3 = ((System.Windows.Controls.Label)(target));
                return;

            case 21:
                this.label4 = ((System.Windows.Controls.Label)(target));
                return;

            case 22:
                this.label5 = ((System.Windows.Controls.Label)(target));
                return;

            case 23:
                this.txtID = ((System.Windows.Controls.TextBox)(target));
                return;

            case 24:
                this.txtAyN = ((System.Windows.Controls.TextBox)(target));
                return;

            case 25:
                this.txtUsername = ((System.Windows.Controls.TextBox)(target));
                return;

            case 26:
                this.txtPassword = ((System.Windows.Controls.TextBox)(target));
                return;

            case 27:
                this.txtRol = ((System.Windows.Controls.TextBox)(target));
                return;

            case 28:
                this.btnAddUser = ((System.Windows.Controls.Button)(target));

            #line 101 "..\..\..\vtnUsuarios.xaml"
                this.btnAddUser.Click += new System.Windows.RoutedEventHandler(this.btnAddUser_Click);

            #line default
            #line hidden
                return;

            case 29:
                this.btnEditUser = ((System.Windows.Controls.Button)(target));

            #line 102 "..\..\..\vtnUsuarios.xaml"
                this.btnEditUser.Click += new System.Windows.RoutedEventHandler(this.btnEditUser_Click);

            #line default
            #line hidden
                return;

            case 30:
                this.btnDeleteUser = ((System.Windows.Controls.Button)(target));

            #line 103 "..\..\..\vtnUsuarios.xaml"
                this.btnDeleteUser.Click += new System.Windows.RoutedEventHandler(this.btnDeleteUser_Click);

            #line default
            #line hidden
                return;

            case 31:
                this.btnListUsers = ((System.Windows.Controls.Button)(target));

            #line 104 "..\..\..\vtnUsuarios.xaml"
                this.btnListUsers.Click += new System.Windows.RoutedEventHandler(this.btnListUsers_Click);

            #line default
            #line hidden
                return;

            case 32:
                this.btnFirst = ((System.Windows.Controls.Button)(target));

            #line 106 "..\..\..\vtnUsuarios.xaml"
                this.btnFirst.Click += new System.Windows.RoutedEventHandler(this.btnFirst_Click);

            #line default
            #line hidden
                return;

            case 33:
                this.btnPrevious = ((System.Windows.Controls.Button)(target));

            #line 107 "..\..\..\vtnUsuarios.xaml"
                this.btnPrevious.Click += new System.Windows.RoutedEventHandler(this.btnPrevious_Click);

            #line default
            #line hidden
                return;

            case 34:
                this.btnNext = ((System.Windows.Controls.Button)(target));

            #line 108 "..\..\..\vtnUsuarios.xaml"
                this.btnNext.Click += new System.Windows.RoutedEventHandler(this.btnNext_Click);

            #line default
            #line hidden
                return;

            case 35:
                this.btnLast = ((System.Windows.Controls.Button)(target));

            #line 109 "..\..\..\vtnUsuarios.xaml"
                this.btnLast.Click += new System.Windows.RoutedEventHandler(this.btnLast_Click);

            #line default
            #line hidden
                return;

            case 36:
                this.grdListaUsuarios = ((System.Windows.Controls.Grid)(target));
                return;

            case 37:
                this.txtFiltrar = ((System.Windows.Controls.TextBox)(target));

            #line 114 "..\..\..\vtnUsuarios.xaml"
                this.txtFiltrar.GotFocus += new System.Windows.RoutedEventHandler(this.Focus);

            #line default
            #line hidden
                return;

            case 38:
                this.btnFiltrar = ((System.Windows.Controls.Button)(target));

            #line 116 "..\..\..\vtnUsuarios.xaml"
                this.btnFiltrar.Click += new System.Windows.RoutedEventHandler(this.btnFiltrar_Click);

            #line default
            #line hidden
                return;

            case 39:
                this.userList = ((System.Windows.Controls.ListView)(target));
                return;

            case 40:
                this.btnVista = ((System.Windows.Controls.Button)(target));

            #line 129 "..\..\..\vtnUsuarios.xaml"
                this.btnVista.Click += new System.Windows.RoutedEventHandler(this.btnVistaPrevia_Click);

            #line default
            #line hidden
                return;

            case 41:
                this.btnVolver = ((System.Windows.Controls.Button)(target));

            #line 130 "..\..\..\vtnUsuarios.xaml"
                this.btnVolver.Click += new System.Windows.RoutedEventHandler(this.btnVolver_Click);

            #line default
            #line hidden
                return;

            case 42:
                this.grdUsuarioAlta = ((System.Windows.Controls.Grid)(target));
                return;

            case 43:
                this.txtAyNAlta = ((System.Windows.Controls.TextBox)(target));
                return;

            case 44:
                this.txtUsernameAlta = ((System.Windows.Controls.TextBox)(target));
                return;

            case 45:
                this.txtPasswordAlta = ((System.Windows.Controls.TextBox)(target));
                return;

            case 46:
                this.cmbRolAlta = ((System.Windows.Controls.ComboBox)(target));
                return;

            case 47:
                this.btnCancelar = ((System.Windows.Controls.Button)(target));

            #line 164 "..\..\..\vtnUsuarios.xaml"
                this.btnCancelar.Click += new System.Windows.RoutedEventHandler(this.btnCancelar_Click);

            #line default
            #line hidden
                return;

            case 48:
                this.btnAceptar = ((System.Windows.Controls.Button)(target));

            #line 165 "..\..\..\vtnUsuarios.xaml"
                this.btnAceptar.Click += new System.Windows.RoutedEventHandler(this.btnAceptar_Click);

            #line default
            #line hidden
                return;

            case 49:
                this.grdUsuarioEditar = ((System.Windows.Controls.Grid)(target));
                return;

            case 50:
                this.txtIDEditar = ((System.Windows.Controls.TextBox)(target));
                return;

            case 51:
                this.txtAyNEditar = ((System.Windows.Controls.TextBox)(target));
                return;

            case 52:
                this.txtUsernameEditar = ((System.Windows.Controls.TextBox)(target));
                return;

            case 53:
                this.txtPasswordEditar = ((System.Windows.Controls.TextBox)(target));
                return;

            case 54:
                this.cmbRolEditar = ((System.Windows.Controls.ComboBox)(target));
                return;

            case 55:
                this.btnCancelarEditar = ((System.Windows.Controls.Button)(target));

            #line 188 "..\..\..\vtnUsuarios.xaml"
                this.btnCancelarEditar.Click += new System.Windows.RoutedEventHandler(this.btnCancelar_Click);

            #line default
            #line hidden
                return;

            case 56:
                this.btnGuardar = ((System.Windows.Controls.Button)(target));

            #line 189 "..\..\..\vtnUsuarios.xaml"
                this.btnGuardar.Click += new System.Windows.RoutedEventHandler(this.btnGuardar_Click);

            #line default
            #line hidden
                return;

            case 57:
                this.grdVistaPrevia = ((System.Windows.Controls.Grid)(target));
                return;

            case 58:
                this.DocPrueba = ((System.Windows.Documents.FlowDocument)(target));
                return;

            case 59:
                this.userListPreview = ((System.Windows.Controls.ListView)(target));
                return;

            case 60:

            #line 209 "..\..\..\vtnUsuarios.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.btnPrint_Click);

            #line default
            #line hidden
                return;

            case 61:
                this.btnVolverFiltro = ((System.Windows.Controls.Button)(target));

            #line 210 "..\..\..\vtnUsuarios.xaml"
                this.btnVolverFiltro.Click += new System.Windows.RoutedEventHandler(this.btnVolverFiltro_Click);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
Example #60
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 10 "..\..\UnaTesisWin.xaml"
                ((BusquedaLatinos.UnaTesisWin)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded);

            #line default
            #line hidden
                return;

            case 2:
                this.MainRibbon = ((Telerik.Windows.Controls.RadRibbonView)(target));
                return;

            case 3:
                this.Navega = ((Telerik.Windows.Controls.RadRibbonGroup)(target));
                return;

            case 4:
                this.RbtnInicio = ((Telerik.Windows.Controls.RadRibbonButton)(target));

            #line 37 "..\..\UnaTesisWin.xaml"
                this.RbtnInicio.Click += new System.Windows.RoutedEventHandler(this.RibbonButton_Click);

            #line default
            #line hidden
                return;

            case 5:
                this.RbtnPrevious = ((Telerik.Windows.Controls.RadRibbonButton)(target));

            #line 43 "..\..\UnaTesisWin.xaml"
                this.RbtnPrevious.Click += new System.Windows.RoutedEventHandler(this.RibbonButton_Click);

            #line default
            #line hidden
                return;

            case 6:
                this.RbtnNext = ((Telerik.Windows.Controls.RadRibbonButton)(target));

            #line 49 "..\..\UnaTesisWin.xaml"
                this.RbtnNext.Click += new System.Windows.RoutedEventHandler(this.RibbonButton_Click);

            #line default
            #line hidden
                return;

            case 7:
                this.RbtnFin = ((Telerik.Windows.Controls.RadRibbonButton)(target));

            #line 55 "..\..\UnaTesisWin.xaml"
                this.RbtnFin.Click += new System.Windows.RoutedEventHandler(this.RibbonButton_Click);

            #line default
            #line hidden
                return;

            case 8:
                this.LblContador = ((System.Windows.Controls.Label)(target));
                return;

            case 9:
                this.DocsRel = ((Telerik.Windows.Controls.RadRibbonGroup)(target));
                return;

            case 10:
                this.BtnDelRelacion = ((Telerik.Windows.Controls.RadRibbonButton)(target));

            #line 78 "..\..\UnaTesisWin.xaml"
                this.BtnDelRelacion.Click += new System.Windows.RoutedEventHandler(this.BtnDelRelacion_Click);

            #line default
            #line hidden
                return;

            case 11:
                this.RbtnClipboard = ((Telerik.Windows.Controls.RadRibbonButton)(target));

            #line 91 "..\..\UnaTesisWin.xaml"
                this.RbtnClipboard.Click += new System.Windows.RoutedEventHandler(this.RibbonButton_Click);

            #line default
            #line hidden
                return;

            case 12:
                this.RBtnWord = ((Telerik.Windows.Controls.RadRibbonButton)(target));

            #line 98 "..\..\UnaTesisWin.xaml"
                this.RBtnWord.Click += new System.Windows.RoutedEventHandler(this.ExportarGroupClick);

            #line default
            #line hidden
                return;

            case 13:
                this.RbtJurisp = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 14:
                this.RbtAislada = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 15:
                this.TxtMat1 = ((System.Windows.Controls.TextBox)(target));
                return;

            case 16:
                this.TxtMat2 = ((System.Windows.Controls.TextBox)(target));
                return;

            case 17:
                this.TxtMat3 = ((System.Windows.Controls.TextBox)(target));
                return;

            case 18:
                this.TxtIus = ((System.Windows.Controls.TextBox)(target));
                return;

            case 19:
                this.TxtEpoca = ((System.Windows.Controls.TextBox)(target));
                return;

            case 20:
                this.TxtTesis = ((System.Windows.Controls.TextBox)(target));
                return;

            case 21:
                this.TxtVolumen = ((System.Windows.Controls.TextBox)(target));
                return;

            case 22:
                this.TxtPagina = ((System.Windows.Controls.TextBox)(target));
                return;

            case 23:
                this.TxtInstancia = ((System.Windows.Controls.TextBox)(target));
                return;

            case 24:
                this.TxtFuente = ((System.Windows.Controls.TextBox)(target));
                return;

            case 25:
                this.TxtGenealogia = ((System.Windows.Controls.TextBox)(target));
                return;

            case 26:
                this.TxtObservaciones = ((System.Windows.Controls.TextBox)(target));
                return;

            case 27:
                this.TxtConcordancia = ((System.Windows.Controls.TextBox)(target));
                return;

            case 28:
                this.flowDocViewer = ((System.Windows.Controls.FlowDocumentScrollViewer)(target));
                return;

            case 29:
                this.flowDoc = ((System.Windows.Documents.FlowDocument)(target));
                return;
            }
            this._contentLoaded = true;
        }