-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start SolidityProjectWizard implementation. Can popup dialog on proje…
…ct create.
- Loading branch information
Showing
6 changed files
with
125 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Microsoft.VisualStudio.TemplateWizard; | ||
using System.Windows.Forms; | ||
using EnvDTE; | ||
|
||
namespace Stratis.VS.StratisEVM | ||
{ | ||
public class WizardImplementation : IWizard | ||
{ | ||
private SolidityProjectWizardUserInputForm inputForm; | ||
private string customMessage; | ||
|
||
// This method is called before opening any item that | ||
// has the OpenInEditor attribute. | ||
public void BeforeOpeningFile(ProjectItem projectItem) | ||
{ | ||
} | ||
|
||
public void ProjectFinishedGenerating(Project project) | ||
{ | ||
} | ||
|
||
// This method is only called for item templates, | ||
// not for project templates. | ||
public void ProjectItemFinishedGenerating(ProjectItem | ||
projectItem) | ||
{ | ||
} | ||
|
||
// This method is called after the project is created. | ||
public void RunFinished() | ||
{ | ||
} | ||
|
||
public void RunStarted(object automationObject, | ||
Dictionary<string, string> replacementsDictionary, | ||
WizardRunKind runKind, object[] customParams) | ||
{ | ||
try | ||
{ | ||
// Display a form to the user. The form collects | ||
// input for the custom message. | ||
inputForm = new SolidityProjectWizardUserInputForm(); | ||
inputForm.ShowDialog(); | ||
|
||
customMessage = SolidityProjectWizardUserInputForm.CustomMessage; | ||
|
||
// Add custom parameters. | ||
replacementsDictionary.Add("$custommessage$", | ||
customMessage); | ||
} | ||
catch (Exception ex) | ||
{ | ||
MessageBox.Show(ex.ToString()); | ||
} | ||
} | ||
|
||
// This method is only called for item templates, | ||
// not for project templates. | ||
public bool ShouldAddProjectItem(string filePath) | ||
{ | ||
return true; | ||
} | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
src/Stratis.VS.StratisEVM/SolidityProjectWizardUserInputForm.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System.Windows.Forms; | ||
using System; | ||
|
||
namespace Stratis.VS.StratisEVM | ||
{ | ||
public partial class SolidityProjectWizardUserInputForm : Form | ||
{ | ||
private static string customMessage; | ||
private TextBox textBox1; | ||
private Button button1; | ||
|
||
public SolidityProjectWizardUserInputForm() | ||
{ | ||
this.Size = new System.Drawing.Size(155, 265); | ||
|
||
button1 = new Button(); | ||
button1.Location = new System.Drawing.Point(90, 25); | ||
button1.Size = new System.Drawing.Size(50, 25); | ||
button1.Click += button1_Click; | ||
this.Controls.Add(button1); | ||
|
||
textBox1 = new TextBox(); | ||
textBox1.Location = new System.Drawing.Point(10, 25); | ||
textBox1.Size = new System.Drawing.Size(70, 20); | ||
this.Controls.Add(textBox1); | ||
} | ||
public static string CustomMessage | ||
{ | ||
get | ||
{ | ||
return customMessage; | ||
} | ||
set | ||
{ | ||
customMessage = value; | ||
} | ||
} | ||
private void button1_Click(object sender, EventArgs e) | ||
{ | ||
customMessage = textBox1.Text; | ||
this.Close(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters