Skip to content

Commit

Permalink
External tools feature concept #35
Browse files Browse the repository at this point in the history
  • Loading branch information
roman-yagodin committed Jul 13, 2021
1 parent b68eaff commit 31af6d0
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 0 deletions.
1 change: 1 addition & 0 deletions R7.Webmate.Xwt/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public MainWindow ()
notebook.Add (new TableCleanerWidget (), T.GetString ("Table Cleaner"));
notebook.Add (new CaseChangerWidget (), T.GetString ("Case Changer"));
notebook.Add (new UuidGeneratorWidget (), T.GetString ("UUID Generator"));
notebook.Add (new ExternalToolsWidget (), T.GetString ("External Tools"));
notebook.CurrentTabChanged += Notebook_CurrentTabChanged;

UpdateTitle (notebook.CurrentTab.Label);
Expand Down
76 changes: 76 additions & 0 deletions R7.Webmate.Xwt/Misc/ExternalToolsWidget.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
using System;
using NGettext;
using Xwt;
using System.Diagnostics;

namespace R7.Webmate.Xwt
{
public class ExternalToolsWidget: Widget
{
protected ICatalog T = TextCatalogKeeper.GetDefault ();

#region Controls

#endregion

public ExternalToolsWidget ()
{
var btnMergePdf = new Button ("Merge PDF");
btnMergePdf.Clicked += (sender, e) => {
Process.Start ("x-www-browser", "https://www.ilovepdf.com/merge_pdf");
};

var btnSplitPdf = new Button ("Split PDF");
btnSplitPdf.Clicked += (sender, e) => {
Process.Start ("x-www-browser", "https://www.ilovepdf.com/split_pdf");
};

var btnCompressPdf = new Button ("Compress PDF");
btnCompressPdf.Clicked += (sender, e) => {
Process.Start ("x-www-browser", "https://www.ilovepdf.com/compress_pdf");
};

var btnILovePdf = new Button ("More Tools...");
btnILovePdf.Clicked += (sender, e) => {
Process.Start ("x-www-browser", "https://www.ilovepdf.com");
};

var btnCharmap = new Button ("Character Map");
btnCharmap.Clicked += (sender, e) => {
Process.Start ("charmap");
};

var table1 = new Table ();
table1.Margin = Const.VBOX_MARGIN;
table1.Add (btnMergePdf, 0, 0);
table1.Add (btnSplitPdf, 1, 0);
table1.Add (btnCompressPdf, 2, 0);
table1.Add (btnILovePdf, 3, 0);

var table2 = new Table ();
table2.Margin = Const.VBOX_MARGIN;
table2.Add (btnCharmap, 0, 0);

var vbox = new VBox ();
vbox.Margin = Const.VBOX_MARGIN;

var expander1 = new Expander ();
expander1.Expanded = true;
expander1.Label = "I Love PDF";
expander1.Content = table1;

var expander2 = new Expander ();
expander2.Expanded = true;
expander2.Label = "Character map";
expander2.Content = table2;

vbox.PackStart (expander1, false, true);
vbox.PackStart (expander2, false, true);

var scrollView = new ScrollView (vbox);

Content = scrollView;
Content.Show ();
}
}
}
2 changes: 2 additions & 0 deletions R7.Webmate.Xwt/R7.Webmate.Xwt.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="..\R7.Webmate\Properties\SolutionInfo.cs" Link="Properties\SolutionInfo.cs" />
<Compile Include="Text\UuidGeneratorWidget.cs" />
<Compile Include="Misc\ExternalToolsWidget.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
Expand Down Expand Up @@ -155,6 +156,7 @@
<Folder Include="config\" />
<Folder Include="Text\" />
<Folder Include="Properties\" />
<Folder Include="Misc\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\R7.Webmate\R7.Webmate.csproj">
Expand Down

0 comments on commit 31af6d0

Please sign in to comment.