Skip to content

Commit

Permalink
Fixed Dashboard get started link and Access Dwim pro link
Browse files Browse the repository at this point in the history
  • Loading branch information
Senad Mulaosmanovic committed Apr 11, 2024
1 parent cb72787 commit 0024519
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 21 deletions.
20 changes: 15 additions & 5 deletions DWSIM.ProFeatures/FormBridgeToPro.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,16 @@ public partial class FormBridgeToPro : Form
public IFlowsheet CurrentFlowsheet;
private bool Transitioning = false;

public FormBridgeToPro()
public FormBridgeToPro(bool? skipIntro = false)
{
InitializeComponent();
lblFeature = _lblFeature;
_lblFeature.Name = "lblFeature";

if (skipIntro.HasValue && skipIntro.Value)
{
SwitchToFormPortal();
}
}

private void FormBridgeToPro_Load(object sender, EventArgs e)
Expand All @@ -30,14 +35,19 @@ private void Button1_Click(object sender, EventArgs e)
Close();
}

private void Button2_Click(object sender, EventArgs e)
private void SwitchToFormPortal()
{

Transitioning = true;
BridgeToProPanel.Visible = false;
formPortal.Visible = true;
formPortal.SetFlowsheet(CurrentFlowsheet);
formPortal.OnInitialize();
}

private void Button2_Click(object sender, EventArgs e)
{

Transitioning = true;
SwitchToFormPortal();

// Functions.ProcessTransition(CurrentFlowsheet);

Expand All @@ -48,7 +58,7 @@ private void Button2_Click(object sender, EventArgs e)
private void FormBridgeToPro_FormClosing(object sender, System.Windows.Forms.FormClosingEventArgs e)
{

if (!Transitioning)
if (!Transitioning && CurrentFlowsheet != null)
CurrentFlowsheet.FlowsheetOptions.FlowsheetTransitionObject = null;

}
Expand Down
28 changes: 18 additions & 10 deletions DWSIM.ProFeatures/FormPortal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ private void UserService_OnUserLoggedIn(object sender, EventArgs e)

private void FormPortal_Load(object sender, EventArgs e)
{

}

public async Task OnInitialize()
{
// Debugger.Launch();
// Debugger.Launch();
var isLoggedIn = UserService.GetInstance()._IsLoggedIn();
if (!isLoggedIn)
{
Expand Down Expand Up @@ -192,11 +192,19 @@ private void SaveFlowsheet()
}
else
{
StatusMessage.Text = "To continue to DWSIM Pro, you must save your file to your Simulate 365 Dashboard.";
if (fsheet != null)
{
StatusMessage.Text = "To continue to DWSIM Pro, you must save your file to your Simulate 365 Dashboard.";
this.saveToDashboardBtn.Visible = true;
}
else
{
ShowSuccessPanel();
}
}
this.saveToDashboardBtn.Visible = true;





}
private async Task<bool> SaveDwsimProStartupAction()
Expand Down Expand Up @@ -264,7 +272,7 @@ private void openInDefaultBrowserLink_LinkClicked(object sender, LinkLabelLinkCl

private void openInIncognitoLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{

}

private string GetDefaultBrowserLocation()
Expand All @@ -274,14 +282,14 @@ private string GetDefaultBrowserLocation()
var runCommand = command?.GetValue(null) as string;
if (!string.IsNullOrWhiteSpace(runCommand))
{
var splitCommand=Regex.Split(runCommand,".exe");
var browserLocation= splitCommand[0].Replace("\"","");
return browserLocation+".exe";
var splitCommand = Regex.Split(runCommand, ".exe");
var browserLocation = splitCommand[0].Replace("\"", "");
return browserLocation + ".exe";

}
return string.Empty;
}


private static string GetStandardBrowserProgId()
{
Expand Down
4 changes: 2 additions & 2 deletions DWSIM.ProFeatures/Functions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ public static bool ProcessTransition(IFlowsheet flowsheet)

}

public static void DisplayTransitionForm(IFlowsheet flowsheet, string featurename)
public static void DisplayTransitionForm(IFlowsheet flowsheet, string featurename, bool? skipIntro = false)
{

var fp = new FormBridgeToPro();
var fp = new FormBridgeToPro(skipIntro);
fp.lblFeature.Text = featurename;
fp.CurrentFlowsheet = flowsheet;
fp.ShowDialog();
Expand Down
12 changes: 10 additions & 2 deletions DWSIM/Forms/FormWelcome.vb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Imports System.Linq
Imports System.Threading.Tasks
Imports System.Text
Imports DWSIM.SharedClassesCSharp.FilePicker.Windows
Imports DWSIM.Simulate365.Services

' Copyright 2008 Daniel Wagner O. de Medeiros
'
Expand Down Expand Up @@ -416,8 +417,15 @@ Public Class FormWelcome
End Sub

Private Sub LinkLabel14_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel14.LinkClicked
Dim loginForm As Simulate365.FormFactories.LoginForm = New Simulate365.FormFactories.LoginForm
loginForm.ShowDialog()
Dim userService As UserService = UserService.GetInstance()
Dim isLoggedIn As Boolean = userService._IsLoggedIn()
If (isLoggedIn = False) Then
Dim loginForm As Simulate365.FormFactories.LoginForm = New Simulate365.FormFactories.LoginForm
loginForm.ShowDialog()
Else
Process.Start("https://dashboard.simulate365.com")
End If

End Sub

Private Sub LinkLabel15_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs)
Expand Down
3 changes: 1 addition & 2 deletions DWSIM/Forms/MainWindow/FormMain.vb
Original file line number Diff line number Diff line change
Expand Up @@ -4928,8 +4928,7 @@ Label_00CC:
End Sub

Private Sub ToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles tsmiFreeProTrial.Click
Dim loginForm As LoginForm = New LoginForm
loginForm.ShowDialog()
Functions.DisplayTransitionForm(Nothing, "Access DWSIM Pro now", True)
End Sub

Private Sub AbrirDoDashboardToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles AbrirDoDashboardToolStripMenuItem.Click
Expand Down

0 comments on commit 0024519

Please sign in to comment.