Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wpf conversion part three #1371

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions FRBDK/Glue/CompilerPlugin/Managers/Runner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
using System.Threading;
using GeneralResponse = ToolsUtilities.GeneralResponse;
using System.ComponentModel;
using GlueFormsCore.Controls;

namespace CompilerPlugin.Managers
{
Expand Down Expand Up @@ -561,12 +562,13 @@ private async void HandleProcessExit(object sender, EventArgs e)
this._compilerViewModel.DidRunnerStartProcess = false;


if (!global::Glue.MainGlueWindow.Self.IsDisposed)
if (!GlueCommands.Self.DialogCommands.IsMainWindowDisposed())
{
// This can get disposed in the meantime...
try
{
global::Glue.MainGlueWindow.Self.Invoke(() =>

MainPanelControl.Self.Invoke(() =>
{
IsRunning = runningGameProcess != null;
DidRunnerStartProcess = GetDidFrbEditorStartProcess();
Expand Down
5 changes: 3 additions & 2 deletions FRBDK/Glue/CompilerPlugin/Views/BuildTabView.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using CompilerPlugin.Managers;
using FlatRedBall.Math.Geometry;
using GlueFormsCore.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down Expand Up @@ -76,7 +77,7 @@ public void PrintOutput(string text)

try
{
Glue.MainGlueWindow.Self.Invoke(() =>
MainPanelControl.Self.Invoke(() =>
{
var paragraph = TextBox.Document.Blocks.LastOrDefault() as Paragraph;
if(paragraph == null)
Expand Down Expand Up @@ -117,7 +118,7 @@ public void PrintError(string text)

try
{
Glue.MainGlueWindow.Self.Invoke(() =>
MainPanelControl.Self.Invoke(() =>
{
var paragraph = TextBox.Document.Blocks.LastOrDefault() as Paragraph;
if (paragraph == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
using FlatRedBall.Glue.Plugins.ExportedInterfaces.CommandInterfaces;
using System.Security.Permissions;
using Microsoft.Xna.Framework.Graphics;
using GlueFormsCore.Controls;
using System.Windows.Threading;

namespace GameCommunicationPlugin.GlueControl
{
Expand Down Expand Up @@ -90,7 +92,7 @@ public override Version Version

bool ignoreViewModelChanges = false;

Timer dragDropTimer;
DispatcherTimer dragDropTimer;

System.Threading.SemaphoreSlim getCommandsSemaphore = new System.Threading.SemaphoreSlim(1, 1);

Expand Down Expand Up @@ -562,9 +564,9 @@ private void CreateGameTab()

// This was 250 but it wasn't fast enough to feel responsive
var dragDropTimerFrequency = 100; // ms
dragDropTimer = new Timer(dragDropTimerFrequency);
dragDropTimer.Elapsed += (not, used) => _dragDropManagerGameWindow.HandleDragDropTimerElapsed(gameHostView);
dragDropTimer.SynchronizingObject = MainGlueWindow.Self;
dragDropTimer = new DispatcherTimer();
dragDropTimer.Interval = TimeSpan.FromMilliseconds(dragDropTimerFrequency);
dragDropTimer.Tick += (not, used) => _dragDropManagerGameWindow.HandleDragDropTimerElapsed(gameHostView);
dragDropTimer.Start();

#endregion
Expand Down Expand Up @@ -1164,4 +1166,6 @@ public override void HandleEvent(string eventName, string payload)

}



}
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ private void GlueViewSettingsButtonClicked(object sender, RoutedEventArgs e)
// get solved, too high and the user sees long delays between the flickers.
const int msDelayBetweenResizes = 5;

int lastWidth;
double lastWidth;

private async void BottomStatusBar_ZoomMinusClick()
{
Expand Down Expand Up @@ -395,7 +395,7 @@ private void ToolsSidePanel_DragEnter(object sender, DragEventArgs e)
}
}

int lastHeight;
double lastHeight;
public async void ReactToMainWindowResizeEnd()
{
await ForceRefreshGameArea();
Expand All @@ -410,7 +410,7 @@ public async void ReactToMainWindowResizeEnd()
/// <returns>An awaitable task</returns>
public async Task ForceRefreshGameArea(bool force = false)
{
var window = MainGlueWindow.Self;
var window = MainPanelControl.Self;
var areSame = window.Width == lastWidth && window.Height == lastHeight;
var are0 = lastWidth == 0 && lastHeight == 0;

Expand Down
21 changes: 5 additions & 16 deletions FRBDK/Glue/Glue/AutomatedGlue/GlueGui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,31 +57,20 @@ public static void ShowMessageBox(string text, string caption)
{
GlueCommands.Self.DoOnUiThread(() =>
{
MessageBox.Show(MainGlueWindow.Self, text, caption);
// todo when we convert over:
//System.Windows.MessageBox.Show(MainWpfWindow, text, caption);
MessageBox.Show(GlueCommands.Self.DialogCommands.Win32Window, text, caption);
});
}
}

public static void ShowMessageBox(string text)
{
if (ShowGui)
{
GlueCommands.Self.DoOnUiThread(() =>
{
MessageBox.Show(MainGlueWindow.Self, text);
});
}
}
public static void ShowMessageBox(string text) => ShowMessageBox(text, string.Empty);

public static void ShowException(string text, string caption, Exception ex)
{
if (ShowGui)
{
GlueCommands.Self.DoOnUiThread(() =>
{
// We want to show the exception here so we can diagnose it better.
MessageBox.Show(MainGlueWindow.Self, text + "\n\n\nDetails:\n\n" + ex, caption);
});
ShowMessageBox(text + "\n\n\nDetails:\n\n" + ex, caption);
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion FRBDK/Glue/Glue/Build/BuildToolAssociationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public BuildToolAssociation GetBuildToolAssocationAndNameFor(string fileName, ou
nfw.ResultName = FileManager.RemoveExtension(FileManager.RemovePath(fileName));
DialogResult result = DialogResult.Cancel;

GlueCommands.Self.DoOnUiThread(() => result = nfw.ShowDialog(MainGlueWindow.Self));
GlueCommands.Self.DoOnUiThread(() => result = nfw.ShowDialog(GlueCommands.Self.DialogCommands.Win32Window));
//result = nfw.ShowDialog();
extraCommandLineArguments = "";

Expand Down
147 changes: 0 additions & 147 deletions FRBDK/Glue/Glue/Controls/FileAssociationWindow.Designer.cs

This file was deleted.

77 changes: 0 additions & 77 deletions FRBDK/Glue/Glue/Controls/FileAssociationWindow.cs

This file was deleted.

Loading
Loading