/// <summary>
 /// Show the new project dialog:
 /// </summary>
 public static void ShowNewProject()
 {
     Login(() =>
     {
         ShowInputBox("Create New Project", "Please enter the project name:", (projectName) => {
             FormCreateProject form = new FormCreateProject();
             form.ProjectName       = projectName;
             form.Show();
         }, null);
     });
 }
        /// <summary>
        /// Create a new project.
        /// </summary>
        public void CreateProject(bool retry = false)
        {
            progressBar.Value = 10;
            labelMessage.Text = "Creating Project on QuantConnect...";

            // Create New Project on QC
            Async.Add(new APIJob(APICommand.NewProject, (projectIdObj, errors) =>
            {
                // Handle login and API errors:
                switch (QuantConnectPlugin.HandleErrors(errors))
                {
                    // Handle project specific actions with a login error:
                    case APIErrors.NotLoggedIn:
                        this.SafeInvoke(d => d.ShowLogin(() => { FormCreateProject form = new FormCreateProject(); form.StartPosition = FormStartPosition.CenterScreen; form.Show(); }));
                        this.SafeInvoke(d => d.Close());
                        return;
                }

                int projectId = projectIdObj == null ? 0 : Convert.ToInt32(projectIdObj);
                if (projectId == 0)
                {
                    //Show the error form
                    labelMessage.SafeInvoke(d => d.Text = "Sorry there was an error with your request. ");
                    pictureError.SafeInvoke(d => d.Visible = true);
                }
                else
                { 
                    //Else we have a new id, time to load the template:
                    labelMessage.SafeInvoke(d => d.Text = "Project Created, Opening...");
                    progressBar.SafeInvoke(d => d.Value = 90);

                    //Open the project and close the loading dialog.
                    QuantConnectPlugin.OpenProject(projectId, ProjectName, () => {
                        this.SafeInvoke(d => d.Close());
                        QuantConnectPlugin.SetButtonsState(true);
                    });
                }
            }, ProjectName));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Create a new project.
        /// </summary>
        public void CreateProject(bool retry = false)
        {
            progressBar.Value = 10;
            labelMessage.Text = "Creating Project on QuantConnect...";

            // Create New Project on QC
            Async.Add(new APIJob(APICommand.NewProject, (projectIdObj, errors) =>
            {
                // Handle login and API errors:
                switch (QuantConnectPlugin.HandleErrors(errors))
                {
                // Handle project specific actions with a login error:
                case APIErrors.NotLoggedIn:
                    this.SafeInvoke(d => d.ShowLogin(() => { FormCreateProject form = new FormCreateProject(); form.StartPosition = FormStartPosition.CenterScreen; form.Show(); }));
                    this.SafeInvoke(d => d.Close());
                    return;
                }

                int projectId = projectIdObj == null ? 0 : Convert.ToInt32(projectIdObj);
                if (projectId == 0)
                {
                    //Show the error form
                    labelMessage.SafeInvoke(d => d.Text    = "Sorry there was an error with your request. ");
                    pictureError.SafeInvoke(d => d.Visible = true);
                }
                else
                {
                    //Else we have a new id, time to load the template:
                    labelMessage.SafeInvoke(d => d.Text = "Project Created, Opening...");
                    progressBar.SafeInvoke(d => d.Value = 90);

                    //Open the project and close the loading dialog.
                    QuantConnectPlugin.OpenProject(projectId, ProjectName, () => {
                        this.SafeInvoke(d => d.Close());
                        QuantConnectPlugin.SetButtonsState(true);
                    });
                }
            }, ProjectName));
        }
        /// <summary>
        /// Show the new project dialog:
        /// </summary>
        public static void ShowNewProject()
        {
            Login(() =>
            {
                ShowInputBox("Create New Project", "Please enter the project name:", (projectName) => {

                    FormCreateProject form = new FormCreateProject();
                    form.ProjectName = projectName;
                    form.Show();

                }, null);
            });  
        }