Esempio n. 1
0
    //Opens the sql connection
    public void OpenConnection()
    {
        StartupSettings settings = StartupSettings.Instance;

        string fileLocation = Environment.ExpandEnvironmentVariables(string.Format("{0}{1}",
                                                                                   settings.Resource_location, settings.Resource_db));

        if (File.Exists(fileLocation))
        {
            connectionString = string.Format("URI=file:{0}", fileLocation);

            dbcon = (IDbConnection) new SqliteConnection(connectionString);
            dbcon.Open();

            dbcmd = dbcon.CreateCommand();

            sqliteconnected = true;

            Debug.LogWarning("Open SQLite Connection");
        }
        else
        {
            sqliteconnected = false;
            Debug.LogWarning("Can't Find '" + fileLocation + "'");
        }
    }
Esempio n. 2
0
        /// <summary>
        /// Preparing IDE host enviorenment part 2
        /// </summary>
        private void ConfigureEnviorenment()
        {
            Console.WriteLine("ConfigureEnviorenment()");
            if (host == null)
            {
                startup = new StartupSettings
                {
                    ApplicationName = "zebSharpDevelop",
                    AllowUserAddIns = true,
                    ConfigDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                                                   "ICSharpCode/SharpDevelop3.0"),
                    DataDirectory       = dataDir,
                    ApplicationRootPath = baseDir
                };

                startup.AddAddInsFromDirectory(addInDir);
                //Loading customised #D config file
                startup.AddAddInFile(Path.Combine(Application.StartupPath, sdConfigFile));

                var currentDomain = AppDomain.CurrentDomain;
                currentDomain.AssemblyResolve += LoadAssemlbyFromProductInstallationFolder;

                host = new SharpDevelopHost(AppDomain.CurrentDomain, startup)
                {
                    InvokeTarget = invokeTarget
                };

                assignHandlers();

                workbenchSettings = new WorkbenchSettings();
            }
        }
Esempio n. 3
0
        private void ConfigureEnviorenment()
        {
            if (_sdHost != null)
            {
                return;
            }

            //TODO AA : review initialisation
            _startupSettings = new StartupSettings
            {
                ApplicationName     = "CustomSharpDevelop",
                AllowUserAddIns     = true,
                ConfigDirectory     = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "ICSharpCode/SharpDevelop3.0"),
                DataDirectory       = _sdDataDir,
                ApplicationRootPath = _sdRootDir
            };
            //TODO AA : implement loading custom addin configuration
            _startupSettings.AddAddInsFromDirectory(Path.Combine(_sdAddInDir, "AddIns"));

            //Loading customised #D config file
            _startupSettings.AddAddInFile(Path.Combine(Application.StartupPath, SDConfigFile));

            AppDomain.CurrentDomain.AssemblyResolve += LoadAssemlbyFromProductInstallationFolder;

            _sdHost            = new SharpDevelopHost(AppDomain.CurrentDomain, _startupSettings);
            _workbenchSettings = new WorkbenchSettings();

            assignHandlers();
        }
Esempio n. 4
0
        public override void Save()
        {
            StartupSettings settings = SettingsManager.Load <StartupSettings>();

            settings.StartupScreenNum = Selected - 1;
            SettingsManager.Save(settings);
        }
        public StartupPresenter(IStartupForm view, SidePanelActionsHandler sidePanelActionsHandler, IUserDialogs userDialogs, CollectionsManagerWithCounts collectionsManager)
        {
            _form = view;
            _view = view.StartupView;
            _sidePanelActionsHandler      = sidePanelActionsHandler;
            _userDialogs                  = userDialogs;
            _collectionsManager           = collectionsManager;
            _startupSettings              = JsonConvert.DeserializeObject <StartupSettings>(Settings.Default.StartupSettings);
            _cancellationTokenSource      = new CancellationTokenSource();
            _databaseLoadProgressReporter = new Progress <string>(report =>
            {
                if (string.IsNullOrEmpty(Initalizer.OsuDirectory))
                {
                    _view.LoadDatabaseStatusText = report;
                }
                else
                {
                    _view.LoadDatabaseStatusText = $"osu! location: \"{Initalizer.OsuDirectory}\"{Environment.NewLine}{report}";
                }
            });

            _view.UseSelectedOptionsOnStartup = _startupSettings.AutoLoadMode;
            _form.Closing += _view_Closing;
            _view.StartupCollectionOperation += _view_StartupCollectionOperation;
            _view.StartupDatabaseOperation   += _view_StartupDatabaseOperation;
        }
Esempio n. 6
0
        /// <summary>
        ///     The main entry point for the application.
        /// </summary>
        private static void Main()
        {
            StartupSettings.SetCurrentSettings(new CustomStartupSettings());

            var service = new MainService();

            Utilities.LoadNativeAssemblies(AppDomain.CurrentDomain.BaseDirectory);

            if (Environment.UserInteractive)
            {
                Console.Title = AppTitle;
                try
                {
                    ((IServiceApplication)service).Start();
                    var app = (ServerApplicationBase)GlobalContextManager.CurrentContext.Get <IApplication>();
                    Console.Title = string.Format(" {0} (application server node key: {1})", AppTitle, app.StartupSettings.CurrentNodeKey);
                    Console.WriteLine(@"The service is ready.");
                    Console.WriteLine(@"Press <ENTER> to terminate service.");

                    //Run windows app:
                    Monolit.Program.Main();
                    Console.ReadLine();
                }
                finally
                {
                    ((IServiceApplication)service).Stop();
                }
            }
            else
            {
                ServiceBase.Run(service);
            }
        }
Esempio n. 7
0
        private void SetupAuthentication(IServiceCollection services, StartupSettings settings)
        {
            var authBuilder = services.AddAuthentication(options => { options.DefaultAuthenticateScheme = "Identity.Application"; });

            authBuilder = ConfigureSaml2(authBuilder, settings);
            authBuilder.AddCookie();
        }
Esempio n. 8
0
        public void SaveXml(XmlWriter tw)
        {
            tw.WriteStartElement("Settings");
            tw.WriteAttributeString("Version", "1");

            StartupSettings.SaveXml(tw);
            BookSettings.SaveXml(tw);
            DictionarySettings.SaveXml(tw);
            SpeechSettings.SaveXml(tw);

            tw.WriteEndElement(); // Settings
        }
Esempio n. 9
0
        public void SaveXml(XmlWriter tw)
        {
            tw.WriteStartElement("Settings");
            tw.WriteAttributeString("Version", "2");

            StartupSettings.SaveXml(tw);
            BookSettings.SaveXml(tw);
            DictionarySettings.SaveXml(tw);
            SpeechSettings.SaveXml(tw);
            TranslationSettings.SaveXml(tw); // included in Version>=2

            tw.WriteEndElement();            // Settings
        }
Esempio n. 10
0
        private static void RunWorkbench(StartupSettings wbSettings, Action BeforeRunWorkbench, Action WorkbenchClosed)
        {
            var wbc = new WorkbenchStartup();

            Current.Log.Info("Initializing workbench...");
            wbc.InitializeWorkbench();

            RunWorkbenchInitializedCommands();

            Current.Log.Info("Starting workbench...");
            Exception exception = null;

            // finally start the workbench.
            try
            {
                BeforeRunWorkbench?.Invoke();
                if (Debugger.IsAttached)
                {
                    wbc.Run(wbSettings);
                }
                else
                {
                    try
                    {
                        wbc.Run(wbSettings);
                    }
                    catch (Exception ex)
                    {
                        exception = ex;
                    }
                }
            }
            finally
            {
            }
            Current.Log.Info("Finished running workbench.");
            WorkbenchClosed?.Invoke();
            if (exception != null)
            {
                const string errorText = "Unhandled exception terminated the workbench";
                Current.Log.Fatal(exception);
                if (wbSettings.UseExceptionBoxForErrorHandler)
                {
                    new ExceptionBox(exception, errorText, true).ShowDialog();
                }
                else
                {
                    throw new RunWorkbenchException(errorText, exception);
                }
            }
        }
Esempio n. 11
0
        private Option <StartupSettings> SetupStartupSettings()
        {
            var section = typeof(StartupSettings).GetCustomAttribute <ConfigSectionAttribute>();

            if (section != null)
            {
                var settings = new StartupSettings();
                Configuration.GetSection(section.SectionName).Bind(settings);

                return(Option <StartupSettings> .Some(settings));
            }

            return(Option <StartupSettings> .None());
        }
Esempio n. 12
0
        void RunWorkbench(WorkbenchSettings wbSettings)
        {
            if (host == null)
            {
                StartupSettings startup = new StartupSettings();
                startup.ApplicationName = "HostedSharpDevelop";
                startup.DataDirectory   = Path.Combine(Path.GetDirectoryName(typeof(SharpDevelopHost).Assembly.Location), "../data");
                string sdaDir = Path.Combine(Path.GetDirectoryName(typeof(MainForm).Assembly.Location), "SdaAddIns");
                startup.AddAddInFile(Path.Combine(sdaDir, "SdaBase.addin"));

                host = new SharpDevelopHost(AppDomain.CurrentDomain, startup);
                host.InvokeTarget        = this;
                host.BeforeRunWorkbench += delegate { groupBox1.Enabled = true; };
                host.WorkbenchClosed    += delegate { groupBox1.Enabled = false; runButton.Enabled = true; };
            }

            host.RunWorkbench(wbSettings);
        }
Esempio n. 13
0
        private void ConfigureEnviorenment()
        {
            if (host != null)
            {
                return;
            }

            startup = new StartupSettings {
                AllowUserAddIns = true, DataDirectory = dataDir
            };
            startup.AddAddInsFromDirectory(addInDir);

            host = new SharpDevelopHost(AppDomain.CurrentDomain, startup);

            workbenchSettings = new WorkbenchSettings();

            RunIDE();
        }
Esempio n. 14
0
        void RunWorkbench(WorkbenchSettings wbSettings)
        {
            if (host == null)
            {
                StartupSettings startup = new StartupSettings();
                startup.ApplicationName = "HostedSharpDevelop";
                startup.ConfigDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "ICSharpCode\\HostedSharpDevelop4");
                startup.DataDirectory   = Path.Combine(Path.GetDirectoryName(typeof(SharpDevelopHost).Assembly.Location), "../data");
                string sdaAddInDir = Path.Combine(Path.GetDirectoryName(typeof(MainForm).Assembly.Location), "SdaAddIns");
                startup.AddAddInsFromDirectory(sdaAddInDir);

                host = new SharpDevelopHost(startup);
                host.InvokeTarget        = this;
                host.BeforeRunWorkbench += delegate { groupBox1.Enabled = true; };
                host.WorkbenchClosed    += delegate { groupBox1.Enabled = false; };
            }

            host.RunWorkbench(wbSettings);
        }
Esempio n. 15
0
        private static SplashScreen CreateSplashScreen()
        {
            StartupSettings startupSettings = ServiceRegistration.Get <ISettingsManager>().Load <StartupSettings>();

            string        startupPath   = Path.GetDirectoryName(Application.ExecutablePath);
            List <string> testFileNames = new List <string>();

            if (!string.IsNullOrEmpty(startupSettings.AlternativeSplashScreen))
            {
                testFileNames.Add(startupSettings.AlternativeSplashScreen);
            }

            testFileNames.Add("MP2 Client Splashscreen.jpg");

            Image image = null;

            foreach (string testFileName in testFileNames)
            {
                try
                {
                    string fileName = Path.Combine(startupPath, testFileName);
                    image = Image.FromFile(fileName);
                    break;
                }
                catch (Exception ex)
                {
                    ServiceRegistration.Get <ILogger>().Error("SplashScreen: Error loading startup image '{0}'", ex, testFileName);
                }
            }

            SplashScreen result = new SplashScreen
            {
                StartupScreen         = startupSettings.StartupScreenNum,
                ScaleToFullscreen     = true,
                FadeInDuration        = TimeSpan.FromMilliseconds(300),
                FadeOutDuration       = TimeSpan.FromMilliseconds(200),
                SplashBackgroundImage = image
            };

            return(result);
        }
Esempio n. 16
0
        //BOT STARTING POINT
        public TarkovManager(StartupSettings config, EftApi api)
        {
            _config = config;

            //Create the Login Controller
            _loginController = new LoginController(_config, api);

            //Create the Profile Controller
            _profileController = new ProfileController();

            //Create the Market Controller
            _marketController = new MarketController(_profileController);

            //Create the Trader Controller
            _traderController = new TraderController();

            _botEndTime = DateTime.Now.AddHours(_hoursForBotToRestart);

            //Create a thread for a back-end task that the server will complete
            var botTask = new Task(StartTradingGrind);

            botTask.Start();
        }
Esempio n. 17
0
 public DesktopHomeViewModel(AnfSettings settings)
 {
     StartupSettings = settings.Startup;
     InitDatas();
 }
Esempio n. 18
0
 private static Lazy <TestServer> CreateTestServer(StartupSettings startupSettings)
 => Lazy.Create(() => new TestServer(new WebHostBuilder()
                                     .AddStartupSettings(startupSettings)
                                     .UseStartup <Startup>()));
Esempio n. 19
0
 public SettingsManager()
 {
     GetOptions      = new Options();
     StartupSettings = new StartupSettings();
 }
Esempio n. 20
0
 public LoginController(StartupSettings config, EftApi api)
 {
     _config = config;
     _api    = api;
 }
Esempio n. 21
0
        /// <summary>
        /// Initializes the application.
        /// </summary>
        /// <param name="startupSettings">The settings used for startup of the application.</param>
        public static void InitializeApplication(StartupSettings startupSettings)
        {
            // Initialize the most important services:
            var container = new AltaxoServiceContainer();

            container.AddFallbackProvider(Current.FallbackServiceProvider);
            container.AddService(typeof(IMessageService), new Altaxo.Main.Services.MessageServiceImpl());
            //			container.AddService(typeof(ILoggingService), new log4netLoggingService());
            Current.Services = container;

            Current.Log.Info("Initialize application...");
            var startup = new CoreStartup(startupSettings.ApplicationName);

            if (startupSettings.UseExceptionBoxForErrorHandler)
            {
                ExceptionBox.RegisterExceptionBoxForUnhandledExceptions();
            }
            string configDirectory = startupSettings.ConfigDirectory;
            string dataDirectory   = startupSettings.DataDirectory;
            string propertiesName;

            if (startupSettings.PropertiesName != null)
            {
                propertiesName = startupSettings.PropertiesName;
            }
            else
            {
                propertiesName = startupSettings.ApplicationName + "Properties";
            }

            if (startupSettings.ApplicationRootPath != null)
            {
                FileUtility.ApplicationRootPath = startupSettings.ApplicationRootPath;
            }

            if (configDirectory == null)
            {
                configDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                                               startupSettings.ApplicationName);
            }

            var propertyService = new Altaxo.Main.Services.PropertyService(
                DirectoryName.Create(configDirectory),
                DirectoryName.Create(dataDirectory ?? Path.Combine(FileUtility.ApplicationRootPath, "data")),
                propertiesName);

            startup.StartCoreServices(propertyService, startupSettings);

            var exe = Assembly.Load(startupSettings.ResourceAssemblyName);

            Current.ResourceService.RegisterNeutralStrings(new ResourceManager("Altaxo.Resources.StringResources", exe));
            Current.ResourceService.RegisterNeutralImages(new ResourceManager("Altaxo.Resources.BitmapResources", exe));
            Current.ResourceService.RegisterNeutralStrings(new ResourceManager("Altaxo.Resources.AltaxoString", exe));
            Current.ResourceService.RegisterNeutralImages(new ResourceManager("Altaxo.Resources.AltaxoBitmap", exe));

            CommandWrapper.LinkCommandCreator      = (link => new LinkCommand(link));                                  // creation of command for opening web sites
            CommandWrapper.WellKnownCommandCreator = MenuService.GetKnownCommand;                                      // creation of all other commands
            CommandWrapper.RegisterConditionRequerySuggestedHandler   = (eh => CommandManager.RequerySuggested += eh); // CommandWrapper has to know how to subscribe to the RequerySuggested event of the command manager
            CommandWrapper.UnregisterConditionRequerySuggestedHandler = (eh => CommandManager.RequerySuggested -= eh); // CommandWrapper must know how to unsubscribe to the RequerySuggested event of the command manager

            Current.Log.Info("Looking for AddIns...");
            foreach (string file in startupSettings._addInFiles)
            {
                startup.AddAddInFile(file);
            }
            foreach (string dir in startupSettings._addInDirectories)
            {
                startup.AddAddInsFromDirectory(dir);
            }

            if (startupSettings.AllowAddInConfigurationAndExternalAddIns)
            {
                startup.ConfigureExternalAddIns(Path.Combine(configDirectory, "AddIns.xml"));
            }
            if (startupSettings.AllowUserAddIns)
            {
                startup.ConfigureUserAddIns(Path.Combine(configDirectory, "AddInInstallTemp"),
                                            Path.Combine(configDirectory, "AddIns"));
            }

            Current.Log.Info("Loading AddInTree...");
            startup.RunInitialization();

            Current.Log.Info("Init application finished");
        }
Esempio n. 22
0
        private static void RunApplication(StartupArguments startupArguments)
        {
#if DEBUG
            // The output encoding differs based on whether the app is a console app (debug mode)
            // or Windows app (release mode). Because this flag also affects the default encoding
            // when reading from other processes' standard output, we explicitly set the encoding to get
            // consistent behaviour in debug and release builds.

            // Console apps use the system's OEM codepage, windows apps the ANSI codepage.
            // We'll always use the Windows (ANSI) codepage.
            try
            {
                Console.OutputEncoding = System.Text.Encoding.Default;
            }
            catch (IOException)
            {
                // can happen if the application doesn't have a console appended
            }
#endif

            Current.Log.Info(string.Format("Starting {0}...", startupArguments.ApplicationName));
            Altaxo.Main.Services.IAutoUpdateInstallationService updateInstaller = null;
            try
            {
                var startupSettings = new StartupSettings(startupArguments.ApplicationName, startupArguments.StartupArgs, startupArguments.RequestedFileList, startupArguments.ParameterList);

#if DEBUG
                startupSettings.UseExceptionBoxForErrorHandler = UseExceptionBox(startupArguments.StartupArgs);
#endif

                Assembly thisAssembly = typeof(StartupMain).Assembly;
                startupSettings.ApplicationRootPath = Path.Combine(Path.GetDirectoryName(thisAssembly.Location), "..");
                startupSettings.AllowUserAddIns     = true;

                string configDirectory = System.Configuration.ConfigurationManager.AppSettings["settingsPath"];
                if (string.IsNullOrEmpty(configDirectory))
                {
                    string relativeConfigDirectory = System.Configuration.ConfigurationManager.AppSettings["relativeSettingsPath"];
                    if (string.IsNullOrEmpty(relativeConfigDirectory))
                    {
                        startupSettings.ConfigDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), startupArguments.ApplicationName);
                    }
                    else
                    {
                        startupSettings.ConfigDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), startupArguments.ApplicationName, relativeConfigDirectory);
                    }
                }
                else
                {
                    startupSettings.ConfigDirectory = Path.Combine(Path.GetDirectoryName(thisAssembly.Location), configDirectory);
                }

                startupSettings.AddAddInsFromDirectory(Path.Combine(startupSettings.ApplicationRootPath, "AddIns"));

                // allows testing addins without having to install them, by providing them in a command line
                const string addinCommandStart = "addindir:";
                foreach (string parameter in startupSettings.ParameterList)
                {
                    if (parameter.StartsWith(addinCommandStart, StringComparison.OrdinalIgnoreCase))
                    {
                        startupSettings.AddAddInsFromDirectory(parameter.Substring(addinCommandStart.Length));
                    }
                }

                // Start ServiceSystem, PropertyService, ResourceService, Load Addins
                InitializeApplication(startupSettings); // initialize core, load all addins

                if (startupSettings.RequestedFileList.Length > 0)
                {
                    if (LoadFilesInPreviousInstance(startupSettings.RequestedFileList))
                    {
                        Current.Log.Info("Aborting startup, arguments will be handled by previous instance");
                        return;
                    }
                }

                updateInstaller = Altaxo.Current.GetService <Altaxo.Main.Services.IAutoUpdateInstallationService>();
                if (null != updateInstaller)
                {
                    if (updateInstaller.Run(true, startupArguments.StartupArgs))
                    {
                        return;
                    }
                }

                // Start Com
                var comManager = Altaxo.Current.GetService <Altaxo.Main.IComManager>();
                if (null != comManager)
                {
                    if (!comManager.ProcessStartupArguments(startupArguments.StartupArgs))
                    {
                        return;
                    }
                }

                RunWorkbench(
                    startupSettings,
                    () =>
                {
                    var splashScreen = SplashScreenForm.SplashScreen;
                    if (splashScreen != null)
                    {
                        splashScreen.BeginInvoke(new MethodInvoker(splashScreen.Dispose));
                        SplashScreenForm.SplashScreen = null;
                    }
                }, null);
            }
            finally
            {
                Current.Log.Info("Leaving RunApplication()");
            }

            updateInstaller?.Run(false, null);
        }
Esempio n. 23
0
        public MainForm(ScreenManager screenManager)
        {
            _adaptToSizeEnabled = false;
            _screenManager      = screenManager;

            ServiceRegistration.Get <ILogger>().Debug("SkinEngine MainForm: Registering DirectX MainForm as IScreenControl service");
            ServiceRegistration.Set <IScreenControl>(this);

            InitializeComponent();

            // Use the native method because the Icon.ExtractAssociatedIcon throws an exception when running from UNC paths
            ushort uicon;
            IntPtr handle = NativeMethods.ExtractAssociatedIcon(Handle, ServiceRegistration.Get <IPathManager>().GetPath("<APPLICATION_PATH>"), out uicon);

            Icon = Icon.FromHandle(handle);

            CheckForIllegalCrossThreadCalls = false;

            StartupSettings startupSettings = ServiceRegistration.Get <ISettingsManager>().Load <StartupSettings>();
            AppSettings     appSettings     = ServiceRegistration.Get <ISettingsManager>().Load <AppSettings>();

            _previousMousePosition = new Point(-1, -1);

            // Default screen for splashscreen is the one from where MP2 was started.
            System.Windows.Forms.Screen preferredScreen = System.Windows.Forms.Screen.FromControl(this);
            int numberOfScreens = System.Windows.Forms.Screen.AllScreens.Length;
            int validScreenNum  = GetScreenNum();

            // Force the splashscreen to be displayed on a specific screen.
            if (startupSettings.StartupScreenNum >= 0 && startupSettings.StartupScreenNum < numberOfScreens)
            {
                validScreenNum  = startupSettings.StartupScreenNum;
                preferredScreen = System.Windows.Forms.Screen.AllScreens[validScreenNum];
                StartPosition   = FormStartPosition.Manual;
            }

            // Store original desktop size
            _screenSize = preferredScreen.Bounds.Size;
            _screenBpp  = preferredScreen.BitsPerPixel;

            Size desiredWindowedSize;

            if (appSettings.WindowPosition.HasValue && appSettings.WindowSize.HasValue)
            {
                desiredWindowedSize = appSettings.WindowSize.Value;
                Location            = ValidatePosition(appSettings.WindowPosition.Value, preferredScreen.WorkingArea.Size, ref desiredWindowedSize);
            }
            else
            {
                Location            = new Point(preferredScreen.WorkingArea.X, preferredScreen.WorkingArea.Y);
                desiredWindowedSize = new Size(SkinContext.SkinResources.SkinWidth, SkinContext.SkinResources.SkinHeight);
            }

            _previousWindowLocation   = Location;
            _previousWindowClientSize = desiredWindowedSize;
            _previousWindowState      = FormWindowState.Normal;
            _previousMode             = ScreenMode.NormalWindowed;

            if (appSettings.ScreenMode == ScreenMode.FullScreen)
            {
                SwitchToFullscreen(validScreenNum);
            }
            else
            {
                SwitchToWindowedSize(appSettings.ScreenMode, Location, desiredWindowedSize, false);
            }

            SkinContext.WindowSize = ClientSize;

            // GraphicsDevice has to be initialized after the form was sized correctly
            ServiceRegistration.Get <ILogger>().Debug("SkinEngine MainForm: Initialize DirectX");
            GraphicsDevice.Initialize_MainThread(this);

            // Read and apply ScreenSaver settings
            _screenSaverTimeOut   = TimeSpan.FromMinutes(appSettings.ScreenSaverTimeoutMin);
            _isScreenSaverEnabled = appSettings.ScreenSaverEnabled;

            _applicationSuspendLevel = appSettings.SuspendLevel;
            UpdateSystemSuspendLevel_MainThread(); // Don't use UpdateSystemSuspendLevel() here because the window handle was not created yet

            Application.Idle   += OnApplicationIdle;
            _adaptToSizeEnabled = true;

            VideoPlayerSynchronizationStrategy = new SynchronizeToPrimaryPlayer();

            // Register touch events
            TouchDown += MainForm_OnTouchDown;
            TouchMove += MainForm_OnTouchMove;
            TouchUp   += MainForm_OnTouchUp;
        }
Esempio n. 24
0
 public UnoHomeViewModel()
 {
     StartupSettings = new StartupSettings();
     InitDatas();
 }
Esempio n. 25
0
        /// <summary>
        /// Read the Config.xml file
        /// </summary>
        private static void ReadConfig()
        {
            _startupSettings = new StartupSettings();
            string configFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config.xml");

            if (!File.Exists(configFile))
            {
                return;
            }

            try
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(configFile);

                // Check, if we got a config.xml
                if (doc.DocumentElement == null)
                {
                    return;
                }
                string strRoot = doc.DocumentElement.Name;
                if (strRoot != "config")
                {
                    return;
                }

                XmlNode portableNode = doc.DocumentElement.SelectSingleNode("/config/portable");
                if (portableNode != null)
                {
                    if (_portable == 0)
                    {
                        // Only use the value from Config, if not overriden by an argument
                        _portable = Convert.ToInt32(portableNode.InnerText);
                    }
                    _startupSettings.Portable = _portable != 0;
                }

                XmlNode maxSongsNode = doc.DocumentElement.SelectSingleNode("/config/MaximumNumberOfSongsInList");
                _startupSettings.MaxSongs = maxSongsNode != null?Convert.ToInt32(maxSongsNode.InnerText) : 500;

                XmlNode ravenDebugNode = doc.DocumentElement.SelectSingleNode("/config/RavenDebug");
                _startupSettings.RavenDebug = ravenDebugNode != null && Convert.ToInt32(ravenDebugNode.InnerText) != 0;

                XmlNode ravenStudioNode = doc.DocumentElement.SelectSingleNode("/config/RavenStudio");
                _startupSettings.RavenStudio = ravenStudioNode != null && Convert.ToInt32(ravenStudioNode.InnerText) != 0;

                XmlNode ravenPortNode = doc.DocumentElement.SelectSingleNode("/config/RavenStudioPort");
                _startupSettings.RavenStudioPort = ravenPortNode != null?Convert.ToInt32(ravenPortNode.InnerText) : 8080;

                XmlNode ravenDatabaseNode = doc.DocumentElement.SelectSingleNode("/config/MusicDatabaseFolder");
                var     dbPath            = ravenDatabaseNode?.InnerText ?? "%APPDATA%\\MPTagThat\\Databases";
                dbPath = CheckPath(dbPath);
                _startupSettings.DatabaseFolder = dbPath;

                XmlNode coverArtNode = doc.DocumentElement.SelectSingleNode("/config/CoverArtFolder");
                var     coverArtPath = coverArtNode?.InnerText ?? "%APPDATA%\\MPTagThat\\CoverArt";
                coverArtPath = CheckPath(coverArtPath);
                _startupSettings.CoverArtFolder = coverArtPath;
            }
            catch (Exception)
            {
                // ignored
            }
        }
Esempio n. 26
0
    private void SetPlayerDroneModel()
    {
        StartupSettings startUpSettings = FindObjectOfType <StartupSettings>();

        if (stateManager.currentPlayer == Player.Blue)
        {
            if (startUpSettings.player1DroneSelected == 0)
            {
                dronePrefab = droneModel01;
            }
            else if (startUpSettings.player1DroneSelected == 1)
            {
                dronePrefab = droneModel02;
            }
            else if (startUpSettings.player1DroneSelected == 2)
            {
                dronePrefab = droneModel03;
            }
            else if (startUpSettings.player1DroneSelected == 3)
            {
                dronePrefab = droneModel04;
            }
        }

        else if (stateManager.currentPlayer == Player.Red)
        {
            if (startUpSettings.player2DroneSelected == 0)
            {
                dronePrefab = droneModel01;
            }
            else if (startUpSettings.player2DroneSelected == 1)
            {
                dronePrefab = droneModel02;
            }
            else if (startUpSettings.player2DroneSelected == 2)
            {
                dronePrefab = droneModel03;
            }
            else if (startUpSettings.player2DroneSelected == 3)
            {
                dronePrefab = droneModel04;
            }
        }

        else if (stateManager.currentPlayer == Player.Green)
        {
            if (startUpSettings.player3DroneSelected == 0)
            {
                dronePrefab = droneModel01;
            }
            else if (startUpSettings.player3DroneSelected == 1)
            {
                dronePrefab = droneModel02;
            }
            else if (startUpSettings.player3DroneSelected == 2)
            {
                dronePrefab = droneModel03;
            }
            else if (startUpSettings.player3DroneSelected == 3)
            {
                dronePrefab = droneModel04;
            }
        }

        else if (stateManager.currentPlayer == Player.Yellow)
        {
            if (startUpSettings.player4DroneSelected == 0)
            {
                dronePrefab = droneModel01;
            }
            else if (startUpSettings.player4DroneSelected == 1)
            {
                dronePrefab = droneModel02;
            }
            else if (startUpSettings.player4DroneSelected == 2)
            {
                dronePrefab = droneModel03;
            }
            else if (startUpSettings.player4DroneSelected == 3)
            {
                dronePrefab = droneModel04;
            }
        }
    }
Esempio n. 27
0
        static void RunApplication()
        {
            LoggingService.Info("Starting SharpDevelop...");
            try {
                StartupSettings startup = new StartupSettings();
                                #if DEBUG
                startup.UseSharpDevelopErrorHandler = !Debugger.IsAttached;
                                #endif

                Assembly exe = typeof(SharpDevelopMain).Assembly;
                startup.ApplicationRootPath = Path.Combine(Path.GetDirectoryName(exe.Location), "..");
                startup.AllowUserAddIns     = true;
#if ModifiedForAltaxo
                startup.ConfigDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                                                       "Altaxo/Altaxo2");
                startup.ResourceAssemblyName = "AltaxoStartup";
#else
                startup.ConfigDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                                                       "ICSharpCode/SharpDevelop2.1");
#endif
                startup.AddAddInsFromDirectory(Path.Combine(startup.ApplicationRootPath, "AddIns"));

                SharpDevelopHost host = new SharpDevelopHost(AppDomain.CurrentDomain, startup);
#if ModifiedForAltaxo
                ResourceService.LoadUserStrings("AltaxoString.resources");
                ResourceService.LoadUserIcons("AltaxoBitmap.resources");
#endif

                string[] fileList = SplashScreenForm.GetRequestedFileList();
                if (fileList.Length > 0)
                {
                    if (LoadFilesInPreviousInstance(fileList))
                    {
                        LoggingService.Info("Aborting startup, arguments will be handled by previous instance");
                        return;
                    }
                }

                host.BeforeRunWorkbench += delegate {
                    if (SplashScreenForm.SplashScreen != null)
                    {
                        SplashScreenForm.SplashScreen.BeginInvoke(new MethodInvoker(SplashScreenForm.SplashScreen.Dispose));
                        SplashScreenForm.SplashScreen = null;
                    }
                };
#if ModifiedForAltaxo
                WorkbenchSingleton.InitializeWorkbench(typeof(Altaxo.Gui.SharpDevelop.AltaxoSDWorkbench));
                Altaxo.Current.SetWorkbench((Altaxo.Gui.Common.IWorkbench)WorkbenchSingleton.Workbench);
                new Altaxo.Main.Commands.AutostartCommand().Run();
#endif

                WorkbenchSettings workbenchSettings = new WorkbenchSettings();
                workbenchSettings.RunOnNewThread = false;
                workbenchSettings.UseTipOfTheDay = true;
                for (int i = 0; i < fileList.Length; i++)
                {
                    workbenchSettings.InitialFileList.Add(fileList[i]);
                }
                host.RunWorkbench(workbenchSettings);
            } finally {
                LoggingService.Info("Leaving RunApplication()");
            }
        }
Esempio n. 28
0
        private AuthenticationBuilder ConfigureSaml2(AuthenticationBuilder authBuilder, StartupSettings settings)
        {
            foreach (var provider in settings.Saml2.IdentityProviders)
            {
                authBuilder = authBuilder.AddSaml2(provider.Name,
                                                   options =>
                {
                    options.SignInScheme       = IdentityServerConstants.ExternalCookieAuthenticationScheme;
                    options.SPOptions.EntityId = new EntityId(settings.Saml2.EntityId);

                    var preferredIdp = settings.Saml2.IdentityProviders.Single(idp => idp.Name == provider.Name);
                    ConfigureSamlIdp(preferredIdp, options);

                    foreach (var identityProvider in settings.Saml2.IdentityProviders.Except(new[]
                    {
                        preferredIdp
                    }))
                    {
                        ConfigureSamlIdp(identityProvider, options);
                    }
                });
            }

            return(authBuilder);
        }
Esempio n. 29
0
        static void RunApplication()
        {
            // The output encoding differs based on whether SharpDevelop is a console app (debug mode)
            // or Windows app (release mode). Because this flag also affects the default encoding
            // when reading from other processes' standard output, we explicitly set the encoding to get
            // consistent behaviour in debug and release builds of SharpDevelop.

#if DEBUG
            // Console apps use the system's OEM codepage, windows apps the ANSI codepage.
            // We'll always use the Windows (ANSI) codepage.
            try
            {
                Console.OutputEncoding = System.Text.Encoding.Default;
            }
            catch (IOException)
            {
                // can happen if SharpDevelop doesn't have a console
            }
#endif

            LoggingService.Info("Starting...");
            try
            {
                StartupSettings startup = new StartupSettings();
#if DEBUG
                startup.UseSharpDevelopErrorHandler = UseExceptionBox;
#endif

                Assembly exe = typeof(StartUp).Assembly;
                //startup.ApplicationRootPath = Path.Combine(Path.GetDirectoryName(exe.Location), "..");
                startup.ApplicationRootPath = Path.GetDirectoryName(exe.Location);
                startup.AllowUserAddIns     = true;


                string configDirectory = ConfigurationManager.AppSettings["settingsPath"];
                if (String.IsNullOrEmpty(configDirectory))
                {
                    startup.ConfigDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                                                           "StarUp" + RevisionClass.Major);
                }
                else
                {
                    startup.ConfigDirectory = Path.Combine(Path.GetDirectoryName(exe.Location), configDirectory);
                }

//                startup.DomPersistencePath = ConfigurationManager.AppSettings["domPersistencePath"];
//                if (string.IsNullOrEmpty(startup.DomPersistencePath))
//                {
//                    startup.DomPersistencePath = Path.Combine(Path.GetTempPath(), "StarUp" + RevisionClass.Major + "." + RevisionClass.Minor);
//#if DEBUG
//                    startup.DomPersistencePath = Path.Combine(startup.DomPersistencePath, "Debug");
//#endif
//                }
//                else if (startup.DomPersistencePath == "none")
//                {
//                    startup.DomPersistencePath = null;
//                }

                startup.AddAddInsFromDirectory(Path.Combine(startup.ApplicationRootPath, "AddIns"));

                // allows testing addins without having to install them
                foreach (string parameter in SplashScreenForm.GetParameterList())
                {
                    if (parameter.StartsWith("addindir:", StringComparison.OrdinalIgnoreCase))
                    {
                        startup.AddAddInsFromDirectory(parameter.Substring(9));
                    }
                }

                StartUpHost host = new StartUpHost(AppDomain.CurrentDomain, startup);

                string[] fileList = SplashScreenForm.GetRequestedFileList();
                if (fileList.Length > 0)
                {
                    if (LoadFilesInPreviousInstance(fileList))
                    {
                        LoggingService.Info("Aborting startup, arguments will be handled by previous instance");
                        return;
                    }
                }

                host.BeforeRunWorkbench += delegate
                {
                    if (SplashScreenForm.SplashScreen != null)
                    {
                        SplashScreenForm.SplashScreen.BeginInvoke(new MethodInvoker(SplashScreenForm.SplashScreen.Dispose));
                        SplashScreenForm.SplashScreen = null;
                    }
                };

                WorkbenchSettings workbenchSettings = new WorkbenchSettings();
                workbenchSettings.RunOnNewThread = false;
                for (int i = 0; i < fileList.Length; i++)
                {
                    workbenchSettings.InitialFileList.Add(fileList[i]);
                }
                host.RunWorkbench(workbenchSettings);
            }
            finally
            {
                LoggingService.Info("Leaving RunApplication()");
            }
        }
Esempio n. 30
0
 public UnoHomeViewModel(AnfSettings settings)
 {
     StartupSettings             = settings.Startup;
     StartupSettings.StartupType = StartupTypes.Providers;
     InitDatas();
 }