Exemplo n.º 1
0
        public MainWindow()
        {
            Logger.SetLoggingLevel();
            Logger.LogDirectory(DirectoryStructure.CLIENT_LOGS_LOCATION);

            TradeSharpLicenseManager.GetLicense();

            InitializeComponent();

            // Save UI thread reference
            _currentDispatcher = Dispatcher.CurrentDispatcher;

            DataContext = new BaseViewModel();
            AppDomain.CurrentDomain.UnhandledException +=
                new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

            if (!TradeSharpLicenseManager.GetLicense().IsActive)
            {
                WPFMessageBox.Show("The application license has expired.\n\nPlease contact TradeSharp support at: [email protected]", "TRADESHARP",
                                   MessageBoxButton.OK, MessageBoxImage.Error);
            }

            // Subscribe Events
            EventSystem.Subscribe <UiElement>(UpdateRelayCommands);
        }
Exemplo n.º 2
0
 private bool AddProviderCanExecute()
 {
     if (TradeSharpLicenseManager.GetLicense().IsDemo)
     {
         return(false);
     }
     return(true);
 }
Exemplo n.º 3
0
        private void AboutButton_Click(object sender, RoutedEventArgs e)
        {
            StringBuilder aboutMessage = new StringBuilder();

            aboutMessage.AppendLine("TradeSharp is a C# based data feed & broker neutral Algorithmic Trading Platform that lets trading firms or individuals automate any rules based trading strategies in stocks, forex and ETFs. TradeSharp has been developed and is being maintained by Aurora Solutions.");
            aboutMessage.AppendLine("\n\n");
            aboutMessage.AppendLine("This product is licensed to: " + TradeSharpLicenseManager.GetLicense().ClientDetails);
            aboutMessage.AppendLine("The licensed will expire on: " + TradeSharpLicenseManager.GetLicense().ExpirationDate.Date.ToString("D"));
            aboutMessage.AppendLine("\n");
            aboutMessage.Append("For queries contact: [email protected]");

            var metroDialog = new MetroDialogSettings();

            metroDialog.ColorScheme = MetroDialogColorScheme.Theme;

            this.ShowMessageAsync("TRADESHARP", aboutMessage.ToString(), MessageDialogStyle.Affirmative, metroDialog);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Open dialog to select license and then add it to the application
        /// </summary>
        private void AddLicense()
        {
            System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog();
            openFileDialog.Title           = "Import License";
            openFileDialog.CheckFileExists = true;
            openFileDialog.Filter          = "OBJ Files (.obj)|*.obj|All Files (*.*)|*.*";
            System.Windows.Forms.DialogResult result = openFileDialog.ShowDialog();
            if (result == System.Windows.Forms.DialogResult.OK)
            {
                File.Copy(openFileDialog.FileName, "TradeSharpLicense.obj", true);
                var newLicense = TradeSharpLicenseManager.UpdateLicense();

                if (newLicense.LicenseSubscriptionType.Equals(Common.ApplicationSecurity.LicenseType.Invalid.ToString()))
                {
                    WPFMessageBox.Show(MainWindow, "The license file is invalid.\n\nPlease contact TradeSharp support at: [email protected]", "TRADESHARP",
                                       MessageBoxButton.OK, MessageBoxImage.Error);
                }
                else
                {
                    WPFMessageBox.Show(MainWindow, "New License added.\n\nPlease restart the application", "TRADESHARP",
                                       MessageBoxButton.OK, MessageBoxImage.Information);
                }
            }
        }