Removed unnecessary code

This commit is contained in:
ZestyTS 2020-10-01 23:47:35 -07:00
parent 94242023a3
commit b76699669e
2 changed files with 27 additions and 66 deletions

View file

@ -6,7 +6,7 @@
xmlns:local="clr-namespace:UWUVCI_AIO_WPF"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d"
Title="MAIN" Width="1194.525" WindowStyle="None" materialDesign:ShadowAssist.CacheMode="{x:Null}" WindowStartupLocation="CenterOwner" Foreground="White" Background="LightGray" MouseDown="MoveWindow" ResizeMode="NoResize" Height="670" Loaded="Window_Loaded" Icon="/UWUVCI AIO WPF;component/a.ico" Closing="wind_Closing" Closed="wind_Closed">
Title="MAIN" Width="1194.525" WindowStyle="None" materialDesign:ShadowAssist.CacheMode="{x:Null}" WindowStartupLocation="CenterOwner" Foreground="White" Background="LightGray" MouseDown="MoveWindow" ResizeMode="NoResize" Height="670" Icon="/UWUVCI AIO WPF;component/a.ico" Closing="wind_Closing" Closed="wind_Closed">

View file

@ -1,22 +1,10 @@
using GameBaseClassLibrary;
using System;
using System.Collections.Generic;
using System;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using UWUVCI_AIO_WPF.UI.Frames;
using UWUVCI_AIO_WPF.UI.Frames.KeyFrame;
namespace UWUVCI_AIO_WPF.UI.Windows
{
@ -31,14 +19,14 @@ namespace UWUVCI_AIO_WPF.UI.Windows
MainViewModel mvm = FindResource("mvm") as MainViewModel;
try
{
if (this.Owner?.GetType() != typeof(MainWindow))
if (Owner?.GetType() != typeof(MainWindow))
{
this.WindowStartupLocation = WindowStartupLocation.CenterScreen;
WindowStartupLocation = WindowStartupLocation.CenterScreen;
}
}
catch (Exception)
{
this.WindowStartupLocation = WindowStartupLocation.CenterScreen;
WindowStartupLocation = WindowStartupLocation.CenterScreen;
}
string fullurl = "";
try
@ -58,10 +46,10 @@ namespace UWUVCI_AIO_WPF.UI.Windows
}
catch (Exception)
{
// left empty on purpose
}
cm.ShowDialog();
this.Close();
Close();
mvm.mw.Show();
}
@ -72,8 +60,6 @@ namespace UWUVCI_AIO_WPF.UI.Windows
InitializeComponent();
this.url = url;
}
public TitleKeys(string url, string title)
{
@ -83,7 +69,6 @@ namespace UWUVCI_AIO_WPF.UI.Windows
t.SetApartmentState(ApartmentState.STA);
t.Start();
tbTitleBar.Text = title.Replace(" Inject "," ");
}
private void MoveWindow(object sender, MouseButtonEventArgs e)
{
@ -91,8 +76,8 @@ namespace UWUVCI_AIO_WPF.UI.Windows
{
if (e.ChangedButton == MouseButton.Left)
{
this.Owner.PointToScreen(new Point(this.Left, this.Top));
this.DragMove();
Owner.PointToScreen(new Point(Left, Top));
DragMove();
// this.Owner.PointFromScreen(new Point(this.Left, this.Top));
//(FindResource("mvm") as MainViewModel).mw.PointFromScreen(new Point(this.Left, this.Top));
}
@ -102,7 +87,7 @@ namespace UWUVCI_AIO_WPF.UI.Windows
}
catch (Exception)
{
// left empty on purpose
}
}
@ -113,7 +98,7 @@ namespace UWUVCI_AIO_WPF.UI.Windows
try
{
fullurl = mvm.GetURL(url);
if (fullurl == "" || fullurl == null)
if (string.IsNullOrEmpty(fullurl))
{
throw new Exception();
}
@ -127,14 +112,14 @@ namespace UWUVCI_AIO_WPF.UI.Windows
}
catch (Exception)
{
// left empty on purpose
}
cm.Show();
this.Close();
Close();
mvm.mw.Show();
}
this.Dispatcher.Invoke(() =>
Dispatcher.Invoke(() =>
{
wb.Source = new Uri(fullurl, UriKind.Absolute);
clsWebbrowser_Errors.SuppressscriptErrors(wb, true);
@ -150,10 +135,10 @@ namespace UWUVCI_AIO_WPF.UI.Windows
private void Window_Close(object sender, RoutedEventArgs e)
{
this.Owner.Left = this.Left;
this.Owner.Top = this.Top;
this.Owner.Show();
this.Close();
Owner.Left =Left;
Owner.Top = Top;
Owner.Show();
Close();
}
private void Window_Minimize(object sender, RoutedEventArgs e)
@ -161,11 +146,6 @@ namespace UWUVCI_AIO_WPF.UI.Windows
this.WindowState = WindowState.Minimized;
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
}
private void wb_LoadCompleted(object sender, System.Windows.Navigation.NavigationEventArgs e)
{
load.Visibility = Visibility.Hidden;
@ -176,29 +156,21 @@ namespace UWUVCI_AIO_WPF.UI.Windows
private void wb_Navigating(object sender, System.Windows.Navigation.NavigatingCancelEventArgs e)
{
if (!e.Uri.ToString().Contains("flumpster"))
if (!e.Uri.ToString().Contains("flumpster"))
{
e.Cancel = true;
var startInfo = new ProcessStartInfo
{
e.Cancel = true;
FileName = e.Uri.ToString()
};
var startInfo = new ProcessStartInfo
{
FileName = e.Uri.ToString()
};
Process.Start(startInfo);
}
Process.Start(startInfo);
}
// cancel navigation to the clicked link in the webBrowser control
}
private void wb_LoadCompleted_1(object sender, System.Windows.Navigation.NavigationEventArgs e)
{
}
private void wind_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
(FindResource("mvm") as MainViewModel).mw.Topmost = true;
@ -210,36 +182,25 @@ namespace UWUVCI_AIO_WPF.UI.Windows
}
}
public static class clsWebbrowser_Errors
{
//*set wpf webbrowser Control to silent
//*code source: https://social.msdn.microsoft.com/Forums/vstudio/en-US/4f686de1-8884-4a8d-8ec5-ae4eff8ce6db
public static void SuppressscriptErrors(this WebBrowser webBrowser, bool hide)
{
FieldInfo fiComWebBrowser = typeof(WebBrowser).GetField("_axIWebBrowser2", BindingFlags.Instance | BindingFlags.NonPublic);
if (fiComWebBrowser == null)
return;
object objComWebBrowser = fiComWebBrowser.GetValue(webBrowser);
if (objComWebBrowser == null)
return;
objComWebBrowser.GetType().InvokeMember("Silent", BindingFlags.SetProperty, null, objComWebBrowser, new object[] { hide });
}
}
}