ui/wpf/UIcore/Application.cs

changeset 108
77254bd6dccb
parent 107
b34bd1557c6c
child 109
c3dfcb8f0be7
--- a/ui/wpf/UIcore/Application.cs	Sat Apr 05 17:57:04 2025 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,106 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using System.Windows;
-
-namespace UI
-{  
-    public class Application
-    {
-        private static Application instance;
-
-        private System.Windows.Application application;
-
-        private Thread thread;
-
-        public String Name;
-
-        public IApplicationCallbacks callbacks;
-
-        public List<Window> Windows = new List<Window>();
-        public ApplicationMenu Menu = new ApplicationMenu();
-        public MainToolBar ToolBar = new MainToolBar();
-        
-        private Application() : base()
-        {
-            thread = new Thread(() => RunApplication());
-            thread.SetApartmentState(ApartmentState.STA);
-        }
-
-        public static Application GetInstance()
-        {
-            if (instance == null)
-            {
-                instance = new Application();
-                GC.KeepAlive(instance);
-            }
-            return instance;
-        }
-
-        public Thread Start()
-        {
-            thread.Start();
-            return thread;
-        }
-
-        private void RunApplication()
-        {
-            application = new System.Windows.Application();
-
-            if(callbacks != null)
-            {
-                callbacks.OnStartup();
-            }
-            application.Run();
-            if(callbacks != null)
-            {
-                callbacks.OnExit();
-            }
-        }
-
-        public void AddWindow(Window window)
-        {
-            Windows.Add(window);
-        }
-
-        public void RemoveWindow(Window window)
-        {
-            Windows.Remove(window);
-            if (Windows.Count == 0)
-            {
-                application.Shutdown();
-            }
-        }
-    }
-
-    public class ResultExec<T>
-    {
-        public T Result;
-        public Func<T> Func;
-
-        public void Exec()
-        {
-            Result = Func.Invoke();
-        }
-    }
-
-    public class VoidExec
-    {
-        public Action Action;
-
-        public void Exec()
-        {
-            Action.Invoke();
-        }
-    }
-
-    public interface IApplicationCallbacks
-    {
-        void OnStartup();
-        void OnOpen();
-        void OnExit();
-    }
-}

mercurial