static Program() { Program.fIsBeta = false; Program.SplashScreen = null; Program.ProjectFilter = "Masterplan Project|*.masterplan"; Program.LibraryFilter = "Masterplan Library|*.library"; Program.EncounterFilter = "Masterplan Encounter|*.encounter"; Program.BackgroundFilter = "Masterplan Campaign Background|*.background"; Program.EncyclopediaFilter = "Masterplan Campaign Encyclopedia|*.encyclopedia"; Program.RulesFilter = "Masterplan Rules|*.crunch"; Program.CreatureAndMonsterFilter = "Creatures|*.creature;*.monster"; Program.MonsterFilter = "Adventure Tools Creatures|*.monster"; Program.CreatureFilter = "Creatures|*.creature"; Program.CreatureTemplateFilter = "Creature Template|*.creaturetemplate"; Program.ThemeFilter = "Themes|*.theme"; Program.CreatureTemplateAndThemeFilter = "Creature Templates and Themes|*.creaturetemplate;*.theme"; Program.TrapFilter = "Traps|*.trap"; Program.SkillChallengeFilter = "Skill Challenges|*.skillchallenge"; Program.MagicItemFilter = "Magic Items|*.magicitem"; Program.ArtifactFilter = "Artifacts|*.artifact"; Program.MapTileFilter = "Map Tiles|*.maptile"; Program.TerrainPowerFilter = "Terrain Powers|*.terrainpower"; Program.HTMLFilter = "HTML File|*.htm"; Program.ImageFilter = "Image File|*.bmp;*.jpg;*.jpeg;*.gif;*.png;*.tga"; }
public static Library LoadLibrary(string filename) { Library library; try { if (Program.SplashScreen != null) { Program.SplashScreen.CurrentSubAction = Utils.FileName.Name(filename); ProgressScreen splashScreen = Program.SplashScreen; splashScreen.Progress = splashScreen.Progress + 1; } string str = Program.SimplifySecurityData(Program.SecurityData); Library library1 = Serialisation <Library> .Load(filename, SerialisationMode.Binary); if (library1 == null) { LogSystem.Trace(string.Concat("Could not load ", Utils.FileName.Name(filename))); } else { library1.Name = Utils.FileName.Name(filename); library1.Update(); if (Program.CopyProtection) { if (library1.SecurityData == null || library1.SecurityData == "") { library1.SecurityData = str; if (!Serialisation <Library> .Save(filename, library1, SerialisationMode.Binary)) { LogSystem.Trace(string.Concat("Could not save ", library1.Name)); } } string str1 = Program.SimplifySecurityData(library1.SecurityData); if (str1 != str) { string[] name = new string[] { "Could not load ", library1.Name, ": ", str1, " vs ", str }; LogSystem.Trace(string.Concat(name)); Session.DisabledLibraries.Add(library1.Name); library = null; return(library); } } else if (library1.SecurityData != "") { library1.SecurityData = ""; Serialisation <Library> .Save(filename, library1, SerialisationMode.Binary); } Session.Libraries.Add(library1); } library = library1; } catch (Exception exception) { LogSystem.Trace(exception); return(null); } return(library); }
static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); try { init_logging(); SplashScreen = new ProgressScreen("Masterplan", 0); SplashScreen.CurrentAction = "Loading..."; SplashScreen.Show(); load_preferences(); load_libraries(); foreach (string arg in args) { handle_arg(arg); } SplashScreen.CurrentAction = "Starting Masterplan..."; SplashScreen.Actions = 0; try { MainForm main_form = new MainForm(); Application.Run(main_form); } catch (Exception ex) { LogSystem.Trace(ex); } List <Form> forms = new List <Form>(); foreach (Form form in Application.OpenForms) { forms.Add(form); } foreach (Form form in forms) { form.Close(); } save_preferences(); if (IsBeta) { check_for_logs(); } } catch (Exception ex) { LogSystem.Trace(ex); } }
public void RecycleInitialScreens() { if (_logonScreen != null) { _logonScreen.Recycle(); } _logonScreen = null; if (_progressScreen != null) { _progressScreen.Recycle(); } _progressScreen = null; }
private static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); try { Program.init_logging(); Program.SplashScreen = new ProgressScreen("Masterplan", 0) { CurrentAction = "Loading..." }; Program.SplashScreen.Show(); Program.load_preferences(); Program.load_libraries(); string[] strArrays = args; for (int i = 0; i < (int)strArrays.Length; i++) { Program.handle_arg(strArrays[i]); } Program.SplashScreen.CurrentAction = "Starting Masterplan..."; Program.SplashScreen.Actions = 0; try { Application.Run(new MainForm()); } catch (Exception exception) { LogSystem.Trace(exception); } List <Form> forms = new List <Form>(); foreach (Form openForm in Application.OpenForms) { forms.Add(openForm); } foreach (Form form in forms) { form.Close(); } Program.save_preferences(); if (Program.IsBeta) { Program.check_for_logs(); } } catch (Exception exception1) { LogSystem.Trace(exception1); } }
void StartApplication(Settings settings) { Settings = settings; Settings.ReadSettings(); Settings.WriteSettings(); _logonScreen = new LogonScreen(_baseActivity, Settings, LoadApplication); _progressScreen = new ProgressScreen(_baseActivity, Settings); AppContext = new ApplicationContext(_baseActivity, Settings, LoadComplete); AppContext.LoadingProgress += _progressScreen.Progress; AppContext.ReturnToStartMenu += OpenStartScreen; ExceptionHandler = new ExceptionHandler(Settings, _baseActivity, AppContext); HandleLastError(Prepare); }
void RefreshSelectButton(string address) { //Do not verify same address as config file if (address == Settings.Default.AspNetSqlProviderService) { m_SelectMenuItem.Enabled = m_SelectButton.Enabled = true; return; } ProgressScreen progress = new ProgressScreen(Resources.Progress); m_SelectMenuItem.Enabled = m_SelectButton.Enabled = false; try { if (address == String.Empty) { return; } if (!MetadataHelper.QueryContract(address, typeof(IApplicationManager))) { return; } if (!MetadataHelper.QueryContract(address, typeof(IMembershipManager))) { return; } if (!MetadataHelper.QueryContract(address, typeof(IPasswordManager))) { return; } if (!MetadataHelper.QueryContract(address, typeof(IRoleManager))) { return; } if (!MetadataHelper.QueryContract(address, typeof(IUserManager))) { return; } m_SelectMenuItem.Enabled = m_SelectButton.Enabled = true; } finally { progress.Close(); } }
public virtual bool Send() { if (!Program2.SiteOptions.NetworkEnabled) { return(false); } progress = ProgressScreen.RegisterOperation(); try { // If security is turned on, We need to have an Index from the server in order to proceed if (secure && Community.SymmetricIndex == null) { Hello hello = new Hello(Callback_Hello, null); return(hello.Send()); } else { if (ISend()) { return(true); } else { progress.Complete(); return(false); } } } catch { progress.Complete(); return(false); } }
void RefreshSelectButton(string address) { //Do not verify same address as config file if(address == Settings.Default.AspNetSqlProviderService) { m_SelectMenuItem.Enabled = m_SelectButton.Enabled = true; return; } ProgressScreen progress = new ProgressScreen(Resources.Progress); m_SelectMenuItem.Enabled = m_SelectButton.Enabled = false; try { if(address == String.Empty) { return; } if(!MetadataHelper.QueryContract(address,typeof(IApplicationManager))) { return; } if(!MetadataHelper.QueryContract(address,typeof(IMembershipManager))) { return; } if(!MetadataHelper.QueryContract(address,typeof(IPasswordManager))) { return; } if(!MetadataHelper.QueryContract(address,typeof(IRoleManager))) { return; } if(!MetadataHelper.QueryContract(address,typeof(IUserManager))) { return; } m_SelectMenuItem.Enabled = m_SelectButton.Enabled = true; } finally { progress.Close(); } }
private void StartUpdate() { WriteLog(Strings.MESSAGE_START_UPDATE); // Instantiate gui. _differences = new Diff(); _progress = new Progress(); // Continue update. SettingsManager.Instance.ContinueUpdate = false; // If used, set gui to initial state and register events. if (SettingsManager.Instance.UseGUI) { _differences.Next += DifferencesNext; _differences.Finish += DifferencesFinish; _differences.Cancel += DifferencesCancel; _differences.ProductName = Strings.LOADING; _differences.CurrentVersion = Strings.LOADING; _differences.NewVersion = Strings.LOADING; _differences.ChangedFiles = Strings.LOADING; _differences.Show(); _progress.Cancel += ProgressCancel; _progress.Finish += ProgressFinish; } if (SettingsManager.Instance.ShowProgress) { _progressScreenViewModel = new ProgressScreenViewModel(); _progressScreenViewModel.AcknowledgeError += ProgressScreenViewModelAcknowledgeError; _progressScreen = new ProgressScreen(); _progressScreen.DataContext = _progressScreenViewModel; _progressScreenViewModel.ShowProgress(); _progressScreen.Show(); } // Get VersionManger instance. _verManager = VersionsManager.Instance; /** * Get local information. */ WriteLog(Strings.MESSAGE_AQUIRE_LOCAL_INFORMATION); // Get local version information. _verManager.GetLocalData(); // If an error occours during local information gathering discontinue update if (!SettingsManager.Instance.ContinueUpdate && SettingsManager.Instance.ErrorPosition == ErrorPosition.Localinformation) { OnError(Strings.ERROR_GET_LOCAL); } // If update continues and gui is in use set current version and product name. if (SettingsManager.Instance.ContinueUpdate) { if (SettingsManager.Instance.UseGUI) { _differences.CurrentVersion = _verManager.LocalInformation.CurrentVersion.ToString(); _differences.ProductName = _verManager.LocalInformation.ProductName; } } /** * Get remote overview. */ // If update continues get overview. if (SettingsManager.Instance.ContinueUpdate) { WriteLog(Strings.MESSAGE_AQUIRE_REMOTE_OVERIEW); _verManager.GetOverview(); } // If fetching remote overview failed cancel information gathering and discontinue. if (!SettingsManager.Instance.ContinueUpdate && SettingsManager.Instance.ErrorPosition == ErrorPosition.Overview) { OnError(Strings.ERROR_GET_OVERVIEW); } // If update continues and gu is in use, set newest avaiable version number. if (SettingsManager.Instance.ContinueUpdate) { if (SettingsManager.Instance.UseGUI) { _differences.NewVersion = _verManager.Overview.Versions[_verManager.Overview.Versions.Count - 1].ToString(); } } /** * Get remote version information. */ // If update continues get all remote versions from newest down to current local version. if (SettingsManager.Instance.ContinueUpdate) { if (VersionsManager.Instance.LocalInformation.CurrentVersion.ToString() != VersionsManager.Instance.Overview.Versions[VersionsManager.Instance.Overview.Versions.Count - 1].ToString()) { WriteLog(Strings.MESSAGE_AQUIRE_REMOTE_INFORMATION); _verManager.GetVersions(_verManager.Overview.Versions[_verManager.Overview.Versions.Count - 1].ToString()); } else { SettingsManager.Instance.NoNewVersions = true; WriteLog(Strings.MESSAGE_NO_NEW_VERSION); } } // If error occours during version fetching cancel information gathering and discontinue. if (!SettingsManager.Instance.ContinueUpdate && SettingsManager.Instance.ErrorPosition == ErrorPosition.Remoteinformation) { OnError(Strings.ERROR_GET_VERSIONS); } // If update continues and gui is in use set number of files that will be changed during update or inform about no new version. if (SettingsManager.Instance.ContinueUpdate) { if (SettingsManager.Instance.UseGUI) { if (SettingsManager.Instance.NoNewVersions) { _differences.ChangedFiles = Strings.NO_NEW_VERSION; } else { _differences.ChangedFiles = _verManager.RemoteVersions[0].Files.Count.ToString(); } } } /** * Enable next step in update process */ if ((!SettingsManager.Instance.UseGUI && !SettingsManager.Instance.ShowProgress) && SettingsManager.Instance.ContinueUpdate && !SettingsManager.Instance.NoNewVersions) { _updateResult = _userv.StartUpdate(); EndUpdate(); } else if (SettingsManager.Instance.ContinueUpdate && !SettingsManager.Instance.NoNewVersions && SettingsManager.Instance.ShowProgress) { _updateResult = _userv.StartUpdate(); EndUpdate(); } else if (SettingsManager.Instance.ContinueUpdate && !SettingsManager.Instance.NoNewVersions && SettingsManager.Instance.UseGUI) { _differences.SetStateNext(true); } else if (SettingsManager.Instance.NoNewVersions) { _userv.DeleteLocalInformations(); EndUpdate(); } }