Exemplo n.º 1
0
        internal void NotAConstructor()
        {
            try
            {
                if (!this.DesignMode)
                {
                    TemplateDisplaySurface.Initialize(this);

                    this.Settings = esSettings.Load();
                    esPlugIn plugin = new esPlugIn(settings);

                    this.ucSettings.Settings = this.Settings;

                    userControlCollection.Add(ucProjects);
                    userControlCollection.Add(ucTemplates);
                    userControlCollection.Add(ucMetadata);
                    userControlCollection.Add(ucMappings);

                    this.ucProjects.MainWindow  = this;
                    this.ucTemplates.MainWindow = this;
                    this.ucMetadata.MainWindow  = this;
                    this.ucMappings.MainWindow  = this;
                }
            }
            catch (Exception ex)
            {
                this.ShowError(ex);
            }
            finally
            {
                userControlCollection.Add(ucSettings);
                this.ucSettings.MainWindow = this;
            }
        }
Exemplo n.º 2
0
        internal void NotAConstructor()
        {
            try
            {
                if (!this.DesignMode)
                {
                    TemplateDisplaySurface.Initialize(this);

                    this.Settings = esSettings.Load();
                    esPlugIn plugin = new esPlugIn(settings);

//#if TRIAL
//                    Licensing licensing = new Licensing();
//                    string id = licensing.getUniqueID("C");

//                    bool canRunOffline = false;

//                    int result = licensing.ValidateLicense("trial", "b69e3783-9f56-47a7-82e0-6eee6d0779bf", System.Environment.MachineName, id, esVersion, GetProxySettings(Settings));

//                    if (1 != result)
//                    {
//                        result = licensing.RegisterLicense("trial", "b69e3783-9f56-47a7-82e0-6eee6d0779bf", System.Environment.MachineName, id, esVersion, GetProxySettings(Settings));
//                    }
//#else
//                    Crypto crypto = new Crypto();

//                    string id = licensing.getUniqueID("C");
//                    string serialNumber = "";
//                    bool canRunOffline = false;

//                    RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\EntitySpaces 2019", true);
//                    if (key != null)
//                    {
//                        try
//                        {
//                            serialNumber = (string)key.GetValue("Serial_Number");
//                        }
//                        catch { }
//                    }


//                    string offlinePath = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
//                    offlinePath += @"\EntitySpaces\ES2019\Interop.ADODBX.dll";

//                    // See if we have registered our license
//                    int result = licensing.ValidateLicense("developer", serialNumber, System.Environment.MachineName, id, plugin.esVersion, GetProxySettings(Settings));

//                    switch (result)
//                    {
//                        case 0:

//                            // Try Registering it ...
//                            int newResult = licensing.RegisterLicense("developer", serialNumber, System.Environment.MachineName, id, plugin.esVersion, GetProxySettings(Settings));

//                            if (newResult == 1)
//                            {
//                                licensing.CreateSerialNumber2Key(key, "Serial_Number2", id, false);
//                                result = 1;
//                            }
//                            else
//                            {
//                                result = 0;
//                            }
//                            break;

//                        case 1:

//                            licensing.CreateSerialNumber2Key(key, "Serial_Number2", id, false);
//                            try
//                            {
//                                File.Delete(offlinePath);
//                            }
//                            catch { }

//                            break;

//                        case -1:

//                            bool isOffLine = false;
//                            DateTime offLineDate = DateTime.MinValue;
//                            if (licensing.ReadSerialNumber2Key(key, "Serial_Number2", id, out isOffLine, out offLineDate))
//                            {
//                                if (isOffLine)
//                                {
//                                    if (File.Exists(offlinePath))
//                                    {
//                                        DateTime fileDate = licensing.OpenOfflineFile(offlinePath);

//                                        if (DateTime.Now > offLineDate)
//                                        {
//                                            TimeSpan ts = DateTime.Now.Subtract(offLineDate);
//                                            if (ts.Days < licensing.DaysTheyCanRunOffline)
//                                            {
//                                                if (fileDate < DateTime.Now)
//                                                {
//                                                    canRunOffline = true;
//                                                }
//                                            }
//                                        }
//                                    }
//                                }
//                                else
//                                {
//                                    licensing.CreateSerialNumber2Key(key, "Serial_Number2", id, true);
//                                    licensing.CreateOfflineFile(offlinePath);
//                                    canRunOffline = true;
//                                }
//                            }
//                            break;
//                    }
//#endif

                    this.ucSettings.Settings = this.Settings;

                    //if (result == 1 || (canRunOffline && result == -1))
                    //{
                    userControlCollection.Add(ucProjects);
                    userControlCollection.Add(ucTemplates);
                    userControlCollection.Add(ucMetadata);
                    userControlCollection.Add(ucMappings);

                    this.ucProjects.MainWindow  = this;
                    this.ucTemplates.MainWindow = this;
                    this.ucMetadata.MainWindow  = this;
                    this.ucMappings.MainWindow  = this;
                    //}
                    //else
                    //{
                    //    this.tabControl.TabPages.Remove(this.tabProjects);
                    //    this.tabControl.TabPages.Remove(this.tabMetadata);
                    //    this.tabControl.TabPages.Remove(this.tabProjects);
                    //    this.tabControl.TabPages.Remove(this.tabTemplates);
                    //    this.tabControl.TabPages.Remove(this.tabLanguageMappings);
                    //}
                }
            }
            catch (Exception ex)
            {
                this.ShowError(ex);
            }
            finally
            {
                //userControlCollection.Add(ucWhatsNew);
                //this.ucWhatsNew.MainWindow = this;

                userControlCollection.Add(ucSettings);
                this.ucSettings.MainWindow = this;
            }
        }