Skip to content

Commit

Permalink
WpfContainerUtils Harmonization
Browse files Browse the repository at this point in the history
  • Loading branch information
tg authored and tg committed Oct 11, 2023
1 parent d06456a commit 47fd749
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
7 changes: 2 additions & 5 deletions WindowsFormsApp1/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,12 @@ public Form1()
private void button1_Click(object sender, EventArgs e)
{
var jeanclaude = "jeanclaude";
WpfContainer.DisplayPopupWpfTest(jeanclaude);
WpfContainerUtils.DisplayPopupWpfTest(jeanclaude);
}

private void button2_Click(object sender, EventArgs e)
{
var uc = new UcWpfIntegration();
uc.Size = new Size(Width - 194, Height);
uc.Location = new Point(194, 0);
uc.DisplayIntegratedWpfUc(this, "jakituning");
WpfContainerUtils.DisplayIntegratedWpfUc(this, "jakifendlabise", Width - 194 -200, Height -100, 194,25);
}

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using System;
using System.Linq;
using System.Drawing;
using System.Windows.Forms;

namespace WpfControlLibrary1
{
public static class WpfContainer
public static class WpfContainerUtils
{
public static void DisplayPopupWpfTest(string text)
{
Expand All @@ -16,8 +18,11 @@ public static void DisplayPopupWpfTest(string text)
window.Show();
}

public static void DisplayIntegratedWpfUc(this IWpfContainer wpfContainer, Form form, string text)
public static void DisplayIntegratedWpfUc(Form form, string text, int width, int height, int x, int y)
{
var wpfContainer = new UcWpfIntegration();
wpfContainer.Size = new Size(width - 194, height);
wpfContainer.Location = new Point(x, y);
var uc = new UserControl1();
var vm = uc.DataContext as TestViewModel;
if (vm == null)
Expand Down
2 changes: 1 addition & 1 deletion WpfControlLibrary1/WpfControlLibrary1.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
<DependentUpon>Window1.xaml</DependentUpon>
</Compile>
<Compile Include="WpfContainer2.cs" />
<Compile Include="WpfContainer.cs" />
<Compile Include="WpfContainerUtils.cs" />
<Page Include="UserControl1.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down

0 comments on commit 47fd749

Please sign in to comment.