Commits

Dmitri Nesteruk  committed 40340f1

got rid of extraneous browsers - they are useless

  • Participants
  • Parent commits ed8cf6c
  • Branches intel

Comments (0)

Files changed (3)

File MainWindow.xaml

             <TabItem>
               <TabItem.Header>
                 <TextBlock>
-            <Image Source="/Resources/codeproject.ico" Width="16" Height="16"/>
-            <Run Foreground="Black" BaselineAlignment="Center">CodeProject Preview</Run>
-                </TextBlock>
-              </TabItem.Header>
-              <WebBrowser Name="CodeProjectWebBrowser"/>
-            </TabItem>
-            <TabItem>
-              <TabItem.Header>
-                <TextBlock>
             <Image Source="/Resources/info.png" Width="16" Height="16"/>
             <Run Foreground="Black" BaselineAlignment="Center">Feature Guide</Run>
                 </TextBlock>
               </TabItem.Header>
               <WebBrowser Name="UnicodeMapBrowser"/>
             </TabItem>
-            <TabItem>
-              <TabItem.Header>
-                <TextBlock>
-                  <Image Source="/Resources/info.png" Width="16" Height="16"/>
-                  <Run Foreground="Black" BaselineAlignment="Center">Habrahabr Preview</Run>
-                </TextBlock>
-              </TabItem.Header>
-              <WebBrowser Name="HabrahabrBrowser"/>
-            </TabItem>
             <TabItem Visibility="Visible">
               <TabItem.Header>
                 <TextBlock>

File MainWindow.xaml.cs

 
     private readonly string[] imageExtensions = new[] { ".png", ".jpg", ".jpeg", ".gif" };
 
+    private bool webControlContentsInitialized = false;
+
     /// <summary>
     /// Initializes a new instance of the <see cref="MainWindow"/> class.
     /// </summary>
       updateRequired = false;
 
       const string style = "<style type=\"text/css\">" +
-        @"
-body, p, td, li, a { font: 1em 'Octava', 'Georgia'; }
+        @"body, p, td, li, a { font: 1em 'Octava', 'Georgia'; }
 body { font-size: 12pt; }
 p { font-size: 12pt; /* 12px */
 line-height: 18pt; /* 18px */
 margin-top: 1.929em;
 margin-bottom: 0.643em; }" + "</style>";
 
-      const string cpStyle =
-        "<link type=\"text/css\" rel=\"stylesheet\" href=\"http://www.codeproject.com/App_Themes/NetCommunity/CodeProject.css\" />";
-
-      const string habrStyle = "<link type=\"text/css\" rel=\"stylesheet\" href=\"http://habrahabr.ru/css/styles.css\" />";
-
       string inputText = tbIn.Text;
 
       Func<Generator, string, Triple<string, string, ConversionStatus>> process = (gp, text) =>
+      {
+        var results = new Triple<string, string, ConversionStatus>();
+        ConversionStatus cs = ConversionStatus.Failure;
+        string msg = "An exception has occurred";
+        try
         {
-          var results = new Triple<string, string, ConversionStatus>();
-          ConversionStatus cs = ConversionStatus.Failure;
-          string msg = "An exception has occurred";
-          try
-          {
-            results.Element1 = gp.Generate(text, App.ConversionOptions, 5000, true, out cs, out msg);
-          }
-          catch (Exception ex)
-          {
-            var sb = new StringBuilder();
-            sb.AppendLine("<pre>");
-            for (Exception e = ex; e != null; e = e.InnerException)
-              sb.AppendLine(e.Message);
-            sb.AppendLine(ex.StackTrace);
-            sb.AppendLine("</pre>");
-            results.Element1 = sb.ToString();
-          }
-          results.Element2 = msg;
-          results.Element3 = cs;
-          return results;
-        };
+          results.Element1 = gp.Generate(text, App.ConversionOptions, 5000, true, out cs, out msg);
+        }
+        catch (Exception ex)
+        {
+          var sb = new StringBuilder();
+          sb.AppendLine("<pre>");
+          for (Exception e = ex; e != null; e = e.InnerException)
+            sb.AppendLine(e.Message);
+          sb.AppendLine(ex.StackTrace);
+          sb.AppendLine("</pre>");
+          results.Element1 = sb.ToString();
+        }
+        results.Element2 = msg;
+        results.Element3 = cs;
+        return results;
+      };
 
       // fire off async
       process.BeginInvoke(iocContainer.Resolve<Generator>(), inputText,
           const string encoding = "<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\" />";
           const string template = "<html><head>{0}{2}</head><body scroll='auto'>{1}</body></html>";
           string text = string.Format(template, style, result.Element1, encoding);
-          string cpText = string.Format(template, cpStyle, result.Element1, encoding);
-          string habrText = string.Format(template, habrStyle, result.Element1, encoding);
-          SetGeneratedData(result.Element3, result.Element2, result.Element1, text, cpText, habrText);
+          SetGeneratedData(result.Element3, result.Element2, result.Element1, text);
         }, null);
     }
 
       ShowResultPane = !ShowResultPane;
     }
 
-    private void SetGeneratedData(ConversionStatus status, string message, string processedHtml, string previewHtml, string codeProjectHtml, string habrHtml)
+    private void SetGeneratedData(ConversionStatus status, string message, string processedHtml, string previewHtml)
     {
       Dispatcher.Invoke(new Action(() =>
       {
         ConversionMessage = message;
         tbOut.Text = processedHtml;
         PreviewWebBrowser.NavigateToString(previewHtml);
-        CodeProjectWebBrowser.NavigateToString(codeProjectHtml);
-        HabrahabrBrowser.NavigateToString(habrHtml);
         PrintableDocument = Generator.Transform(tbIn.Text, App.PrintOptions, 5000);
-        SymbolCount =
-          StripTagsCharArray(processedHtml).Count(
-            c => char.IsLetterOrDigit(c) || char.IsPunctuation(c));
+        SymbolCount = StripTagsCharArray(processedHtml).Count(c => char.IsLetterOrDigit(c) || char.IsPunctuation(c));
       }));
     }
 

File Typografix.Bitmap/Typografix.Bitmap.cpp

   }
   wstring allText(vTemp.begin(), vTemp.end());
 
-  hr = CoCreateInstance(
-    CLSID_WICImagingFactory,
-    NULL,
-    CLSCTX_INPROC_SERVER,
-    IID_IWICImagingFactory,
-    reinterpret_cast<void **>(&pWICFactory));
+  hr = CoCreateInstance(CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER, IID_IWICImagingFactory, reinterpret_cast<void **>(&pWICFactory));
 
   if (SUCCEEDED(hr))
   {