Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ealbu committed May 24, 2022
2 parents ecc4890 + de82d73 commit feb2400
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;
using System.ComponentModel;
using System.Diagnostics;

namespace Sdl.CustomWizardSteps.Sample
{
internal class Browser
{
internal void OpenUrl(string url)
{
try
{
Process.Start(url);
}
catch (Win32Exception winEx) // noBrowser
{
Debug.WriteLine(winEx.Message);
}
catch (Exception ex) // other
{
Debug.WriteLine(ex.Message);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.Win32;
using Sdl.CustomWizardSteps.Sample;
using Sdl.CustomWizardSteps.Sample.CustomPages;
using Sdl.Desktop.IntegrationApi;
using Sdl.Desktop.IntegrationApi.Extensions;
Expand Down Expand Up @@ -42,10 +43,12 @@ protected override void Execute()
}
var filePath = fileDialog.FileName;

var browser = new Browser();

var initialWizardSteps = new List<StudioWizardPage>
{
new FirstPage(),
new SecondPage()
new FirstPage(browser),
new SecondPage(browser)
};

_eventAggregator.Publish(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ namespace Sdl.CustomWizardSteps.Sample.CustomPages
internal class FirstPage : StudioWizardPage
{
private readonly FirstPageViewModel _viewModel;
private readonly Browser _browser;

public FirstPage()
public FirstPage(Browser browser)
{
_viewModel = new FirstPageViewModel();
_browser = browser;
}

public override string Id => "FirstPage";
Expand All @@ -21,13 +23,16 @@ public FirstPage()
public override string Description => "First page description";

public override Icon Icon => PluginResources.FirstIcon;

public override string HelpId => null;


public override Type ViewType => typeof(FirstPageView);

public override INotifyPropertyChanged ViewModel => _viewModel;

public override void ShowHelp()
{
_browser.OpenUrl("https://docs.rws.com/");
}

public override bool Submit()
{
Data[CustomDataKeys.SelectedDate] = _viewModel.CurrentDate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ namespace Sdl.CustomWizardSteps.Sample.CustomPages
internal class SecondPage : StudioWizardPage
{
private readonly SecondPageViewModel _viewModel;
private readonly Browser _browser;

public SecondPage()
public SecondPage(Browser browser)
{
_viewModel = new SecondPageViewModel();
_browser = browser;
}

public override string Id => "SecondPage";
Expand All @@ -21,9 +23,7 @@ public SecondPage()
public override string Description => "Second page description";

public override Icon Icon => PluginResources.SecondIcon;

public override string HelpId => null;


public override Type ViewType => typeof(SecondPageView);

public override INotifyPropertyChanged ViewModel => _viewModel;
Expand All @@ -34,5 +34,10 @@ public override void OnShow()

_viewModel.SelectedDate = (DateTime)Data[CustomDataKeys.SelectedDate];
}

public override void ShowHelp()
{
_browser.OpenUrl("https://www.youtube.com/watch?v=dQw4w9WgXcQ");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="Browser.cs" />
<Compile Include="CustomPages\CustomDataKeys.cs" />
<Compile Include="CustomPages\FirstPage.cs" />
<Compile Include="CustomPages\SecondPage.cs" />
Expand Down

0 comments on commit feb2400

Please sign in to comment.