Beispiel #1
0
    static void CreateWindow()
    {
        EditorApplication.update -= CreateWindow;

        // This will get called when the editor is loaded and also when any script is recompiled, so it uses a temporary editor pref to avoid showing the
        // window whenever scripts are compiled.
        bool skipAnnoucement = EditorPrefs.GetBool("NPT2_Announcement" + announcementVersion);

        if (skipAnnoucement == false)
        {
            StartupWindow window = EditorWindow.GetWindow(typeof(StartupWindow), false, "NpToolkit2 Info", false) as StartupWindow;

            window.minSize = new Vector2(400, 400);
        }
    }
Beispiel #2
0
        public MainWindow()
        {
            var startupWindow = new StartupWindow();

            startupWindow.ShowDialog();
            _cooker.CookingTime = startupWindow.CookingTime;

            //put next pizza on conveyor belt
            _dispatcherTimer.Tick    += new EventHandler(StartCookingOrder);
            _dispatcherTimer.Interval = new TimeSpan(0, 0, Convert.ToInt32(_cooker.CookingTime / 10));//time to get into cooker
            _dispatcherTimer.Start();

            InitializeComponent();
            SetSource();
            Refresh();
        }
Beispiel #3
0
        internal static void Main()
        {
#if !DEBUG
            // check if another instance is already running
            if (Mutex.WaitOne(TimeSpan.Zero, true))
            {
                App           app           = new App();
                StartupWindow startupWindow = new StartupWindow();
                app.Run(startupWindow);

                Mutex.ReleaseMutex();
            }
            else
            {
                // send message to maximize existing window
                NativeMethods.PostMessage((IntPtr)NativeMethods.HWND_BROADCAST, NativeMethods.WM_SHOWME, IntPtr.Zero, IntPtr.Zero);
            }
#else
            App           app           = new App();
            StartupWindow startupWindow = new StartupWindow();
            app.Run(startupWindow);
#endif
        }
Beispiel #4
0
        private void App_OnStartup(object sender, StartupEventArgs e)
        {
            StaticMessageBoxSpawner.Spawner = new WpfMessageBoxSpawner();
            StaticUiUpdateNotifier.Notifier = new WpfUiUpdateNotifier();
            var clipboard = new WpfClipboard();

            var startWindow = new StartupWindow {
                ApplicationName = "File uploader"
            };

            startWindow.Show();
            var apiConfiguration = new ApiConfiguration(
                Settings.Default.ApiServerAddress,
                Settings.Default.ApiServerPort);
            var dataApiClient = new DataApiClient(apiConfiguration);

            if (!dataApiClient.IsAvailable())
            {
                MessageBox.Show($"Cannot contact DataAPI @ '{apiConfiguration.ServerAddress}:{apiConfiguration.ServerPort}'. Shutting down...");
                Current.Shutdown(-1);
                return;
            }
            try
            {
                dataApiClient.Login();
            }
            catch
            {
                // Ignore. If Active Directory is not available, in some other way later.
            }

            var imageDatabase                 = new GenericDatabase <Image>(dataApiClient);
            var shortIdDatabase               = new GenericDatabase <ShortId>(dataApiClient);
            var dataSetDatabase               = new GenericDatabase <DataSet>(dataApiClient);
            var tagDatabase                   = new GenericDatabase <DataTag>(dataApiClient);
            var projectDatabase               = new GenericDatabase <DataProject>(dataApiClient);
            var protocolDatabase              = new GenericDatabase <DataCollectionProtocol>(dataApiClient);
            var protocolParameterDatabase     = new GenericDatabase <DataCollectionProtocolParameter>(dataApiClient);
            var dataBlobDatabase              = new GenericDatabase <DataBlob>(dataApiClient);
            var dataProjectUploadInfoDatabase = new GenericDatabase <DataProjectUploadInfo>(dataApiClient);

            var fileHandlers = new IFileHandler[]
            {
                new ImageFileHandler(imageDatabase)
            };
            var additionalInformationViewSpawner = new WpfAdditionalInformationViewSpawner();
            var fileManager = new UploadedFileProcessor(
                fileHandlers,
                dataApiClient,
                dataBlobDatabase,
                dataProjectUploadInfoDatabase,
                clipboard,
                additionalInformationViewSpawner);

            var mainWindow    = new MainWindow();
            var mainViewModel = new MainViewModel(
                mainWindow,
                dataApiClient,
                fileManager,
                dataSetDatabase,
                tagDatabase,
                projectDatabase,
                protocolDatabase,
                protocolParameterDatabase);

            mainWindow.ViewModel = mainViewModel;
            startWindow.Close();
            mainWindow.ShowDialog();
        }
Beispiel #5
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            var login = new StartupWindow();

            login.ShowDialog();
        }
Beispiel #6
0
        public static void Main(string[] args)
        {
            System.Console.SetOut(new DatedConsole());
            Console.WriteLine("Initialized output.");
            try
            {
                if (string.IsNullOrWhiteSpace(AppImagePath))
                {
                    Console.WriteLine("iCode is running outside of an AppImage.");
                }

                Directory.CreateDirectory(ConfigPath);
                Directory.CreateDirectory(SDKPath);
                Directory.CreateDirectory(DeveloperPath);
                Directory.CreateDirectory(UserDefinedTemplatesPath);
                Directory.CreateDirectory(ConfigPath);

                Gtk.Application.Init();

                GLib.Log.SetDefaultHandler(new GLib.LogFunc((domain, level, message) =>
                {
                    if (level != GLib.LogLevelFlags.Error && level != GLib.LogLevelFlags.FlagFatal)
                    {
                        return;
                    }

                    Console.WriteLine($"Gtk error: {message} ({domain})");
                }));

                Console.WriteLine("Initialized GTK and GDL.");

                if (!File.Exists(SettingsPath))
                {
                    var startup = StartupWindow.Create();
                    if ((ResponseType)startup.Run() != ResponseType.Ok)
                    {
                        return;
                    }

                    var jobj = new JObject();
                    jobj.Add("updateConsent", startup.Accepted);
                    File.WriteAllText(SettingsPath, jobj.ToString());
                    Console.WriteLine("Initialized settings file.");
                }
                else
                {
                    if (!string.IsNullOrWhiteSpace(AppImagePath))
                    {
                        var settings = JObject.Parse(File.ReadAllText(SettingsPath));
                        if ((bool)settings["updateConsent"])
                        {
                            var outp = Extensions.LaunchProcess(
                                Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
                                             "Updater"), $"--check-for-update \"{AppImagePath}\"", out int ret);
                            // TODO Updater
                            if (ret == 1)
                            {
                                Console.WriteLine("Update available.");
                                UpdateAvailable = true;
                            }
                        }
                    }
                }

                NativeLibraries.Load(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "tools/libs/"));
                Console.WriteLine("Initialized libimobiledevice.");
                Program.WinInstance = MainWindow.Create();
                Program.WinInstance.ShowAll();
                Console.WriteLine("Initialized window.");
                Gtk.Application.Run();
            }
            catch (Exception e)
            {
                ExceptionWindow.Create(e, null).ShowAll();
            }
        }