0% found this document useful (0 votes)
7 views2 pages

MainWindow Xaml

The document contains the code for a WPF application named 'Isabelle', specifically the MainWindow class. It initializes an ActorViewModel and an Actor class, setting up event handlers for mouse interactions with an Actor image. Additionally, it includes a ConfigLoader class to load configuration settings from a JSON file.

Uploaded by

obamna1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

MainWindow Xaml

The document contains the code for a WPF application named 'Isabelle', specifically the MainWindow class. It initializes an ActorViewModel and an Actor class, setting up event handlers for mouse interactions with an Actor image. Additionally, it includes a ConfigLoader class to load configuration settings from a JSON file.

Uploaded by

obamna1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

using System.

Diagnostics;
using System.Text;
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.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.IO;
using Newtonsoft.Json;

//Different NameSpaces Needed


using Isabelle.CSDataFiles;
using System.ComponentModel;
using static Isabelle.MainWindow;
using Isabelle.Scripts.ViewModels;
using Isabelle.Scripts.SpecificScripts;

namespace Isabelle
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
///

public partial class MainWindow : Window


{

/// #Actor Vars


/// Options
private bool actorFloat = false;

Actor actorClass;

public MainWindow()
{
InitializeComponent();
SetUpConfigStuff();

ActorViewModel viewModel = new ActorViewModel();


this.DataContext = viewModel;

actorClass = new Actor(viewModel);


}

public void SetUpConfigStuff()


{

}
public class ConfigLoader
{
private static readonly Lazy<AppConfig> _instance = new
Lazy<AppConfig>(LoadConfig);

public static AppConfig Instance => _instance.Value;

private static AppConfig LoadConfig()


{

var jsonString = File.ReadAllText(".\\ConfigFiles\\


ActorConfig.json");
return JsonConvert.DeserializeObject<AppConfig>(jsonString);
}
}

private void ActorImage_MouseRightButtonDown(object sender,


MouseButtonEventArgs e)
{
actorClass.ActorOpenMenu(this);
}

private void ActorImage_MouseLeftButtonDown(object sender,


MouseButtonEventArgs e)
{
actorClass.ActorHold(this, e);
}

private void ActorImage_MouseMove(object sender, MouseEventArgs e)


{
actorClass.ActorMove(this, e);
}

private void ActorImage_MouseLeftButtonUp(object sender,


MouseButtonEventArgs e)
{
actorClass.ActorDrop(this);
}
}
}

You might also like