Skip to content

Commit e30cdba

Browse files
shiroinekotfsVo Luu Tuong Anh
andauthored
New template (#1)
* initial commit Co-Authored-By: Vo Luu Tuong Anh <[email protected]> * update wmi exceptions Co-Authored-By: Vo Luu Tuong Anh <[email protected]> * update app Co-Authored-By: Vo Luu Tuong Anh <[email protected]> * Update MainWindow.xaml.cs Co-Authored-By: Vo Luu Tuong Anh <[email protected]> * update docs Co-Authored-By: Vo Luu Tuong Anh <[email protected]> --------- Co-authored-by: Vo Luu Tuong Anh <[email protected]>
1 parent fd31796 commit e30cdba

20 files changed

+1193
-22
lines changed

App.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
5+
</startup>
6+
</configuration>

App.xaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Application x:Class="GetWMIBasic.App"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:local="clr-namespace:GetWMIBasic"
5+
StartupUri="MainWindow.xaml">
6+
<Application.Resources>
7+
8+
</Application.Resources>
9+
</Application>

App.xaml.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using System.Windows;
2+
3+
namespace GetWMIBasic
4+
{
5+
/// <summary>
6+
/// Interaction logic for App.xaml
7+
/// </summary>
8+
public partial class App : Application
9+
{
10+
}
11+
}

CODE_OF_CONDUCT.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Community Guidelines
2+
3+
At TheFlightSims, we recognize and celebrate the creativity and collaboration of open
4+
source contributors and the diversity of skills, experiences, cultures, and
5+
opinions they bring to the projects and communities they participate in.
6+
7+
Every one of the communities is an inclusive environment, based on treating
8+
all individuals respectfully, regardless of
9+
gender identity and expression, sexual orientation, and disabilities,
10+
neurodiversity, physical appearance, body size, ethnicity, nationality, race,
11+
age, religion, or similar personal characteristics.
12+
13+
We value diverse opinions, but we value respectful behavior more.
14+
15+
Respectful behavior includes:
16+
17+
* Being considerate, kind, constructive, and helpful.
18+
* Not engaging in demeaning, discriminatory, harassing, hateful, sexualized, or
19+
physically threatening behavior, speech, and imagery.
20+
* Not engaging in unwanted physical contact.
21+
22+
Some of TheFlightSims' open-source projects may adopt an explicit project code of
23+
conduct, which may have additional detailed expectations for participants. Most
24+
of those projects will use our modified Contributor Covenant.
25+
26+
## Resolve peacefully
27+
28+
We do not believe that all conflict is necessarily bad; healthy debate and
29+
disagreement often yield positive results. However, it is never okay to be
30+
disrespectful.
31+
32+
If you see someone behaving disrespectfully, you are encouraged to address the
33+
behavior directly with those involved. Many issues can be resolved quickly and
34+
easily, and this gives people more control over the outcome of their disputes.
35+
If you are unable to resolve the matter for any reason, or if the behavior is
36+
threatening or harassing, report it. We are dedicated to providing an
37+
environment where participants feel welcome and safe.
38+
39+
## Reporting problems
40+
41+
Some of TheFlightSims' open-source projects may adopt a project-specific code of conduct.
42+
In those cases, a TheFlightSims employee will be identified as the Project Steward,
43+
who will receive and handle reports of code of conduct violations. If a project hasn’t identified a Project Steward, you can report problems by
44+
emailing mailto:[email protected]
45+
46+
We will investigate every complaint, but you may not receive a direct response.
47+
We will use our discretion in determining when and how to follow up on reported
48+
incidents, which may range from not taking action to permanent expulsion from
49+
the project and project-sponsored spaces. We will notify the accused of the
50+
report and provide them an opportunity to discuss it before any action is
51+
taken. The identity of the reporter will be omitted from the details of the
52+
report supplied to the accused. In potentially harmful situations, such as
53+
ongoing harassment or threats to anyone's safety, we may take action without
54+
notice.

CONTRIBUTING.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Contributing
2+
3+
## Environment requirements
4+
5+
### Git repo
6+
7+
To clone the repo, run, use this command
8+
9+
```bash
10+
git clone https://github.com/tfslabs/get-wmi-basic.git
11+
```
12+
13+
### Build with Visual Studio (only for Windows)
14+
15+
To contribute, you may need Visual Studio 2022. Required Visual Studio 2022 SDKs:
16+
17+
* .NET 4.8 SDK and targeting pack
18+
* Windows 10 SDK (10.0.18362.0) (if applicable)
19+
20+
## Build from source
21+
22+
You can open the `Get WMI Basic.csproj` to open the project in Visual Studio
23+
24+
However, since this project is a part of [Windows Server Management Tool](https://github.com/TheFlightSims/windowsserver-mgmttools), you may need to clone the whole repo, before using Visual Studio, because the full Visual Studio Solution are already configured with valid build configurations.

ConnectForm.xaml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<Window x:Class="GetWMIBasic.ConnectForm"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6+
xmlns:local="clr-namespace:GetWMIBasic"
7+
mc:Ignorable="d"
8+
Title="Connect To Another Computer"
9+
Height="160"
10+
Width="400" ResizeMode="NoResize"
11+
SizeToContent="WidthAndHeight">
12+
<Grid Width="400">
13+
<Grid.Margin>
14+
<Thickness Bottom="5" Top="2"></Thickness>
15+
</Grid.Margin>
16+
<Grid.RowDefinitions>
17+
<RowDefinition/>
18+
<RowDefinition/>
19+
<RowDefinition/>
20+
<RowDefinition/>
21+
<RowDefinition/>
22+
</Grid.RowDefinitions>
23+
<Grid Grid.Row="0" Margin="10,0,10,0">
24+
<Label VerticalAlignment="Center">Connect to another computer using domain or IP</Label>
25+
</Grid>
26+
<Grid Grid.Row="1" Margin="10,0,10,0">
27+
<Grid.ColumnDefinitions>
28+
<ColumnDefinition Width="120"/>
29+
<ColumnDefinition Width="260"/>
30+
</Grid.ColumnDefinitions>
31+
<Label Grid.Column="0" VerticalAlignment="Center">Computer Name</Label>
32+
<TextBox x:Name="ComputerName_TextBox" Grid.Column="1" VerticalAlignment="Center"/>
33+
</Grid>
34+
<Grid Grid.Row="2" Margin="10,0,10,0">
35+
<Grid.ColumnDefinitions>
36+
<ColumnDefinition Width="120"/>
37+
<ColumnDefinition Width="260"/>
38+
</Grid.ColumnDefinitions>
39+
<Label Grid.Column="0" VerticalAlignment="Center">User Name</Label>
40+
<TextBox x:Name="UserName_TextBox" Grid.Column="1" VerticalAlignment="Center"/>
41+
</Grid>
42+
<Grid Grid.Row="3" Margin="10,0,10,0">
43+
<Grid.ColumnDefinitions>
44+
<ColumnDefinition Width="120"/>
45+
<ColumnDefinition Width="260"/>
46+
</Grid.ColumnDefinitions>
47+
<Label Grid.Column="0" VerticalAlignment="Center">Password</Label>
48+
<PasswordBox x:Name="Password_TextBox" Grid.Column="1" VerticalAlignment="Center"/>
49+
</Grid>
50+
<Grid Grid.Row="4" Margin="10,0,10,0">
51+
<Grid.ColumnDefinitions>
52+
<ColumnDefinition Width="90"/>
53+
<ColumnDefinition Width="200"/>
54+
<ColumnDefinition Width="90"/>
55+
</Grid.ColumnDefinitions>
56+
<Button Margin="0,0,5,0" Grid.Column="0" VerticalAlignment="Center" Click="ConnetToExternal_Button">Connect</Button>
57+
<Button Margin="5,0,5,0" Grid.Column="1" VerticalAlignment="Center" Click="ConnectToLocal_Button">Connect to Local Computer</Button>
58+
<Button Margin="5,0,0,0" Grid.Column="2" VerticalAlignment="Center" Click="Cancel_Button">Cancel</Button>
59+
</Grid>
60+
</Grid>
61+
</Window>

ConnectForm.xaml.cs

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
using System.Security;
2+
using System.Windows;
3+
4+
namespace GetWMIBasic
5+
{
6+
public partial class ConnectForm : Window
7+
{
8+
/*
9+
* Global properties
10+
*/
11+
private bool isConnectLocally;
12+
13+
public ConnectForm()
14+
{
15+
isConnectLocally = false;
16+
InitializeComponent();
17+
}
18+
19+
/*
20+
* Button-based methods
21+
*/
22+
23+
private void ConnetToExternal_Button(object sender, RoutedEventArgs e)
24+
{
25+
if (
26+
ComputerName_TextBox.Text.Length == 0 ||
27+
UserName_TextBox.Text.Length == 0 ||
28+
Password_TextBox.Password.Length == 0)
29+
{
30+
MessageBox.Show("Please don't leave anything empty", "Error", MessageBoxButton.OK, MessageBoxImage.Warning);
31+
}
32+
else
33+
{
34+
DialogResult = true;
35+
}
36+
}
37+
38+
private void ConnectToLocal_Button(object sender, RoutedEventArgs e)
39+
{
40+
isConnectLocally = true;
41+
DialogResult = true;
42+
}
43+
44+
private void Cancel_Button(object sender, RoutedEventArgs e)
45+
{
46+
Close();
47+
}
48+
49+
/*
50+
* Non-button methods
51+
*/
52+
public (string, string, SecureString) ReturnValue()
53+
{
54+
ShowDialog();
55+
56+
string computerName = (isConnectLocally) ? "localhost" : ComputerName_TextBox.Text;
57+
string userName = (isConnectLocally) ? "" : UserName_TextBox.Text;
58+
SecureString password = new SecureString();
59+
60+
if (!isConnectLocally)
61+
{
62+
foreach (char c in Password_TextBox.Password)
63+
{
64+
password.AppendChar(c);
65+
}
66+
}
67+
68+
return (computerName, userName, password);
69+
}
70+
}
71+
}

0 commit comments

Comments
 (0)