source: trunk/CrypPlugins/StreamComparator/StreamComparatorPresentation.xaml.cs @ 2527

Last change on this file since 2527 was 1259, checked in by Matthäus Wander, 12 years ago

shortened license text to boilerplate notice in all source files

File size: 2.7 KB
Line 
1/*
2   Copyright 2008 Thomas Schmid, University of Siegen
3
4   Licensed under the Apache License, Version 2.0 (the "License");
5   you may not use this file except in compliance with the License.
6   You may obtain a copy of the License at
7
8       http://www.apache.org/licenses/LICENSE-2.0
9
10   Unless required by applicable law or agreed to in writing, software
11   distributed under the License is distributed on an "AS IS" BASIS,
12   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   See the License for the specific language governing permissions and
14   limitations under the License.
15*/
16
17using System;
18using System.Collections.Generic;
19using System.Linq;
20using System.Text;
21using System.Windows;
22using System.Windows.Controls;
23using System.Windows.Data;
24using System.Windows.Documents;
25using System.Windows.Input;
26using System.Windows.Media;
27using System.Windows.Media.Imaging;
28using System.Windows.Navigation;
29using System.Windows.Shapes;
30using System.IO;
31using System.Windows.Threading;
32using System.Threading;
33using System.Windows.Markup;
34using Cryptool.PluginBase;
35using Cryptool.PluginBase.IO;
36
37namespace Cryptool.StreamComparator
38{
39  /// <summary>
40  /// Interaction logic for StreamComparatorPresentation.xaml
41  /// </summary>
42  public partial class StreamComparatorPresentation : UserControl
43  {
44    public StreamComparatorPresentation()
45    {
46      InitializeComponent();
47      Height = double.NaN;
48      Width = double.NaN;
49      documentReader.Height = double.NaN;
50      documentReader.Width = double.NaN;
51      SetNoComparisonYetDocument();
52    }
53
54    public void SetContent(CryptoolStream stream)
55    {
56      Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate
57      {
58        try
59        {
60          FlowDocument flowDocumentNew = (FlowDocument)XamlReader.Load((Stream)stream);
61          documentReader.Document = flowDocumentNew;
62        }
63        catch (Exception ex)
64        {
65          documentReader.Document = null;
66        }
67      }, documentReader);       
68    }
69
70    public void SetBinaryDocument()
71    {
72      Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate
73      {
74        FlowDocument fd = Resources["documentBinaryInput"] as FlowDocument;
75        documentReader.Document = fd;
76      }, documentReader);       
77    }
78   
79    public void SetNoComparisonYetDocument()
80    {
81      Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate
82      {
83        FlowDocument fd = Resources["documentNoComparsionYet"] as FlowDocument;
84        documentReader.Document = fd;
85      }, documentReader);       
86    }
87
88  }
89}
Note: See TracBrowser for help on using the repository browser.