File size: 2,255 Bytes
b1b3bae
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
using DWSIM.Interfaces;
using System;
using System.Windows.Forms;

namespace DWSIM.ProFeatures
{

    public partial class FormBridgeToPro : Form
    {

        public IFlowsheet CurrentFlowsheet;
        public IAnalyticsProvider AnalyticsProvider;
        private bool Transitioning = false;

        public FormBridgeToPro(IAnalyticsProvider analytics, bool? skipIntro = false)
        {
            InitializeComponent();
            AnalyticsProvider = analytics;
            formPortal.AnalyticsProvider = analytics;
            lblFeature = _lblFeature;
            _lblFeature.Name = "lblFeature";

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

        private void FormBridgeToPro_Load(object sender, EventArgs e)
        {
            ExtensionMethods.FormExtensions.ChangeDefaultFont(this);
        }

        private void Button1_Click(object sender, EventArgs e)
        {
            CurrentFlowsheet.FlowsheetOptions.FlowsheetTransitionObject = null;

            Close();
        }

        private void SwitchToFormPortal()
        {
            BridgeToProPanel.Visible = false;
            formPortal.Visible = true;
            formPortal.SetFlowsheet(CurrentFlowsheet);
            formPortal.featurename = lblFeature.Text;
            formPortal.OnInitialize();
        }

        private void Button2_Click(object sender, EventArgs e)
        {

            AnalyticsProvider?.RegisterEvent("Portal Window: User Clicked 'Switch to Pro'", lblFeature.Text, null);

            Transitioning = true;
            SwitchToFormPortal();

            // Functions.ProcessTransition(CurrentFlowsheet);

            //Close();

        }

        private void FormBridgeToPro_FormClosing(object sender, System.Windows.Forms.FormClosingEventArgs e)
        {

            if (!Transitioning && CurrentFlowsheet != null)
            {
                AnalyticsProvider?.RegisterEvent("Portal Window: Closed by User", lblFeature.Text, null);
                CurrentFlowsheet.FlowsheetOptions.FlowsheetTransitionObject = null;
            }

        }

        private void formPortal_VisibleChanged(object sender, EventArgs e)
        {

        }
    }
}