Skip to content

Commit da3f15e

Browse files
committed
add socket port options page, issue 14
1 parent 4d21dd9 commit da3f15e

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

iTraceVS/itrace_windowControl.xaml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public itrace_windowControl() {
3030

3131
private void attemptConnection(object sender, RoutedEventArgs e) {
3232
if (!connected) {
33+
socket_manager.port = OptionPageGrid.portNum;
3334
socket_manager.getSocket();
3435
if (connected)
3536
button1.Content = "Disconnect";

iTraceVS/itrace_windowPackage.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
11
using System;
2+
using System.ComponentModel;
23
using System.Diagnostics.CodeAnalysis;
34
using System.Runtime.InteropServices;
45
using Microsoft.VisualStudio.Shell;
56

67
namespace iTraceVS
78
{
9+
10+
public class OptionPageGrid : DialogPage {
11+
public static int portNum = 8008;
12+
13+
[Category("iTrace Settings")]
14+
[DisplayName("iTrace Port Number")]
15+
[Description("Designate which localhost port iTrace should use.")]
16+
public int portNumber {
17+
get { return portNum; }
18+
set { portNum = value; }
19+
}
20+
}
821
/// <summary>
922
/// This is the class that implements the package exposed by this assembly.
1023
/// </summary>
@@ -27,6 +40,7 @@ namespace iTraceVS
2740
[ProvideMenuResource("Menus.ctmenu", 1)]
2841
[ProvideToolWindow(typeof(itrace_window))]
2942
[Guid(itrace_windowPackage.PackageGuidString)]
43+
[ProvideOptionPage(typeof(OptionPageGrid), "iTrace", "iTrace Settings", 0, 0, true)]
3044
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", Justification = "pkgdef, VS and vsixmanifest are valid VS terms")]
3145
public sealed class itrace_windowPackage : Package
3246
{
@@ -46,6 +60,13 @@ public itrace_windowPackage()
4660
// initialization is the Initialize method.
4761
}
4862

63+
public int PortNumber {
64+
get {
65+
OptionPageGrid page = (OptionPageGrid)GetDialogPage(typeof(OptionPageGrid));
66+
return page.portNumber;
67+
}
68+
}
69+
4970
#region Package Members
5071

5172
/// <summary>

iTraceVS/socket_manager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace iTraceVS
77
{
88
class socket_manager
99
{
10-
private static int port = 8008;
10+
public static int port = 8008;
1111
public static bool active = false;
1212

1313
static TcpClient client;

0 commit comments

Comments
 (0)