Exemplo n.º 1
0
        /// <summary>
        /// This is where we inject our custom characters into the load screen.
        /// </summary>
        public override void OpenLoadDialog()
        {
            OptionsDialog optionsDialog = new OptionsDialog();

            var selections = Data.GetPlayerSelectionsAvailable().ToList();
            selections.AddRange(ContentManagerHook.AdditionalCharacters());

            foreach (ICharacterClass playerClass in selections)
            {
                if (Game1.Instance.SaveGameExists(playerClass))
                {
                    string fileName = Game1.GetSaveGameFileName(playerClass);
                    optionsDialog.AddOption(playerClass.DisplayName, (System.Action)(() => this.Context.GameMessages.Post(Names.GameMessages.LoadGame, (object)fileName)));
                }
                else
                {
                    var btn = optionsDialog.AddOption("Empty", (System.Action)null);
                    btn.Enabled = false;
                }
            }
            optionsDialog.AutoOpen();
        }
Exemplo n.º 2
0
        private void Options_Click(object sender, EventArgs e)
        {
            OptionsDialog options = new OptionsDialog();

            if ((ToolStripMenuItem)sender == this.Options)
            {
                options.ShowDialog();

                if (options.DialogResult == DialogResult.Cancel)
                {
                    return;
                }
            }
            if (!Game.GameOver & !Game.Finished & !IsFirst)
            {
                return;
            }

            switch (OptionsDialog.Level)
            {
            case 1:
            {
                this.Clock.Location               = new Point(20, 265);
                this.RemainingMines.Location      = new Point(225, 270);
                this.ClockLabel.Location          = new Point(50, 270);
                this.RemainingMinesLabel.Location = new Point(190, 270);

                Game = new Game()
                {
                    Rows    = 10,
                    Columns = 10,
                    Bombs   = 10
                };

                Game.Location       = new Point(15, 25);
                Game.RemainingItems = 100;
                Game.RemainingBombs = 10;
                Game.Size           = new Size(240, 240);

                this.Size = new Size(285, 335);
                this.RemainingMinesLabel.Text = "10";
                this.ClockLabel.Text          = "0";
                this.Controls.RemoveAt(5);
                this.Controls.Add(Game);

                Game.MouseClick      += new MouseEventHandler(Game_MouseClick);
                Game.PropertyChanged += new PropertyChangedEventHandler(Game_PropertyChanged);

                Timer          = new Timer();
                Timer.Tick    += new EventHandler(Time_Tick);
                Timer.Interval = 1000;
                IsFirst        = true;
                TimeSeconds    = 1;
                break;
            }

            case 2:
            {
                this.Clock.Location               = new Point(20, 385);
                this.RemainingMines.Location      = new Point(350, 390);
                this.ClockLabel.Location          = new Point(50, 390);
                this.RemainingMinesLabel.Location = new Point(315, 390);

                Game = new Game()
                {
                    Rows    = 15,
                    Columns = 15,
                    Bombs   = 30
                };

                Game.Location       = new Point(15, 25);
                Game.RemainingItems = 15 * 15;
                Game.RemainingBombs = 30;
                Game.Size           = new Size(24 * 15, 24 * 15);

                this.Size = new Size(410, 460);
                this.RemainingMinesLabel.Text = "30";
                this.ClockLabel.Text          = "0";
                this.Controls.RemoveAt(5);
                this.Controls.Add(Game);

                Game.MouseClick      += new MouseEventHandler(Game_MouseClick);
                Game.PropertyChanged += new PropertyChangedEventHandler(Game_PropertyChanged);

                Timer          = new Timer();
                Timer.Tick    += new EventHandler(Time_Tick);
                Timer.Interval = 1000;
                IsFirst        = true;
                TimeSeconds    = 1;
                break;
            }

            case 3:
            {
                this.Clock.Location               = new Point(20, 505);
                this.RemainingMines.Location      = new Point(465, 510);
                this.ClockLabel.Location          = new Point(50, 510);
                this.RemainingMinesLabel.Location = new Point(430, 510);

                Game = new Game()
                {
                    Rows    = 20,
                    Columns = 20,
                    Bombs   = 50
                };

                Game.Location       = new Point(15, 25);
                Game.RemainingItems = 20 * 20;
                Game.RemainingBombs = 50;
                Game.Size           = new Size(24 * 20, 24 * 20);

                this.Size = new Size(527, 575);
                this.UpdateBounds();
                this.RemainingMinesLabel.Text = "50";
                this.ClockLabel.Text          = "0";
                this.Controls.RemoveAt(5);
                this.Controls.Add(Game);

                Game.MouseClick      += new MouseEventHandler(Game_MouseClick);
                Game.PropertyChanged += new PropertyChangedEventHandler(Game_PropertyChanged);

                Timer          = new Timer();
                Timer.Tick    += new EventHandler(Time_Tick);
                Timer.Interval = 1000;
                IsFirst        = true;
                TimeSeconds    = 1;
                break;
            }
            }
        }
 public void Initialize(OptionsDialog dialog, object dataObject)
 {
     obj = dataObject as IWorkspaceObject;
 }
Exemplo n.º 4
0
        public HybrasylDialog NewOptionsDialog(String displayText, dynamic optionsStructure, dynamic handler = null, dynamic callback = null)
        {
            var dialog = new OptionsDialog(displayText);
            dialog.SetCallbackHandler(callback);

            if (optionsStructure is IronPython.Runtime.List)
            {
                // A simple options dialog with a callback handler for the response
                var optionlist = optionsStructure as IronPython.Runtime.List;
                foreach (var option in optionsStructure)
                {
                    if (option is String)
                    {
                        dialog.AddDialogOption(option as String);
                    }
                }
                if (handler != null)
                {
                    dialog.setInputHandler(handler);
                    Logger.InfoFormat("Input handler associated with dialog");
                }
            }
            else if (optionsStructure is IronPython.Runtime.PythonDictionary)
            {
                var hash = optionsStructure as IronPython.Runtime.PythonDictionary;
                foreach (var key in hash.Keys)
                {
                    if (key is String)
                    {
                        dialog.AddDialogOption(key as String, hash[key]);
                    }
                }

            }
            return new HybrasylDialog(dialog);
        }
Exemplo n.º 5
0
 public void Initialize(OptionsDialog dialog, object dataObject)
 {
 }
Exemplo n.º 6
0
 public void Initialize(OptionsDialog dialog, object dataObject)
 {
     this.dialog = dialog;
 }
Exemplo n.º 7
0
        static public void Main(string[] Args)
        {
            //Upgrade settings
            Assembly a                = Assembly.GetExecutingAssembly();
            Version  appVersion       = a.GetName().Version;
            string   appVersionString = appVersion.ToString();

            log.DebugFormat("Application version of new settings {0}", appVersionString);

            try
            {
                if (Properties.Settings.Default.ApplicationVersion != appVersion.ToString())
                {
                    log.Debug("Upgrading settings...");
                    Properties.Settings.Default.Upgrade();

                    // if program's hash has changed (e.g. by upgrading to .NET 4.0), then Upgrade() doesn't import the previous application settings
                    // because it cannot locate a previous user.config file. In this case a new user.config file is created with the default settings.
                    // We will try and find a config file from a previous installation and update the settings from it
                    if (Properties.Settings.Default.ApplicationVersion == "" && Properties.Settings.Default.DoUpgrade)
                    {
                        SettingsUpdate.Update();
                    }
                    log.DebugFormat("Settings upgraded from '{0}' to '{1}'", Properties.Settings.Default.ApplicationVersion, appVersionString);
                    Properties.Settings.Default.ApplicationVersion = appVersionString;
                    Settings.TrySaveSettings();
                }
            }
            catch (ConfigurationErrorsException ex)
            {
                log.Error("Could not load settings.", ex);
                var msg = string.Format("{0}\n\n{1}", Messages.MESSAGEBOX_LOAD_CORRUPTED_TITLE,
                                        string.Format(Messages.MESSAGEBOX_LOAD_CORRUPTED, Settings.GetUserConfigPath()));
                using (var dlg = new ThreeButtonDialog(new ThreeButtonDialog.Details(SystemIcons.Error, msg, Messages.XENCENTER))
                {
                    StartPosition = FormStartPosition.CenterScreen,
                    //For reasons I do not fully comprehend at the moment, the runtime
                    //overrides the above StartPosition with WindowsDefaultPosition if
                    //ShowInTaskbar is false. However it's a good idea anyway to show it
                    //in the taskbar since the main form is not launcched at this point.
                    ShowInTaskbar = true
                })
                {
                    dlg.ShowDialog();
                }
                Application.Exit();
                return;
            }

            // Reset statics, because XenAdminTests likes to call Main() twice.
            TestExceptionString = null;
            Exiting             = false;
            // Clear XenConnections and History so static classes like OtherConfigAndTagsWatcher
            // listening to changes still work when Main is called more than once.
            ConnectionsManager.XenConnections.Clear();
            ConnectionsManager.History.Clear();

            Search.InitSearch(Branding.Search);
            TreeSearch.InitSearch();

            ArgType argType = ArgType.None;

            AppDomain.CurrentDomain.UnhandledException -= CurrentDomain_UnhandledException;
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            Application.ThreadException -= Application_ThreadException;
            Application.ThreadException += Application_ThreadException;
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            try
            {
                if (SystemInformation.FontSmoothingType == 2) // ClearType
                {
                    TransparentUsually = SystemColors.Window;
                }
            }
            catch (NotSupportedException)
            {
                // Leave TransparentUsually == Color.Transparent.  This is an old platform
                // without FontSmoothingType support.
            }

            switch (Environment.OSVersion.Version.Major)
            {
            case 6:     // Vista, 2K8, Win7.
                if (Application.RenderWithVisualStyles)
                {
                    // Vista, Win7 with styles.
                    TitleBarStartColor      = Color.FromArgb(242, 242, 242);
                    TitleBarEndColor        = Color.FromArgb(207, 207, 207);
                    TitleBarBorderColor     = Color.FromArgb(160, 160, 160);
                    TitleBarForeColor       = Color.FromArgb(60, 60, 60);
                    HeaderGradientForeColor = Color.White;
                    HeaderGradientFont      = new Font(DefaultFont.FontFamily, 11.25f);
                    TabbedDialogHeaderFont  = HeaderGradientFont;
                    TabPageRowBorder        = Color.Gainsboro;
                    TabPageRowHeader        = Color.WhiteSmoke;
                }
                else
                {
                    // 2K8 and Vista, Win7 without styles.
                    TitleBarStartColor      = ProfessionalColors.OverflowButtonGradientBegin;
                    TitleBarEndColor        = ProfessionalColors.OverflowButtonGradientEnd;
                    TitleBarBorderColor     = TitleBarEndColor;
                    TitleBarForeColor       = SystemColors.ControlText;
                    HeaderGradientForeColor = SystemColors.ControlText;
                    HeaderGradientFont      = new Font(DefaultFont.FontFamily, DefaultFont.Size + 1f, FontStyle.Bold);
                    TabbedDialogHeaderFont  = HeaderGradientFont;
                    TabPageRowBorder        = Color.DarkGray;
                    TabPageRowHeader        = Color.Silver;
                }
                break;

            default:
                TitleBarStartColor      = ProfessionalColors.OverflowButtonGradientBegin;
                TitleBarEndColor        = ProfessionalColors.OverflowButtonGradientEnd;
                TitleBarBorderColor     = TitleBarEndColor;
                TitleBarForeColor       = SystemColors.ControlText;
                HeaderGradientForeColor = Application.RenderWithVisualStyles ? Color.White : SystemColors.ControlText;
                HeaderGradientFont      = new Font(DefaultFont.FontFamily, DefaultFont.Size + 1f, FontStyle.Bold);
                TabbedDialogHeaderFont  = new Font(DefaultFont.FontFamily, DefaultFont.Size + 1.75f, FontStyle.Bold);
                TabPageRowBorder        = Color.DarkGray;
                TabPageRowHeader        = Color.Silver;
                break;
            }

            // Force the current culture, to make the layout the same whatever the culture of the underlying OS (CA-46983).
            Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture = new CultureInfo(InvisibleMessages.LOCALE, false);

            if (string.IsNullOrEmpty(Thread.CurrentThread.Name))
            {
                Thread.CurrentThread.Name = "Main program thread";
            }

            ServicePointManager.DefaultConnectionLimit = 20;
            ServicePointManager.ServerCertificateValidationCallback = SSL.ValidateServerCertificate;
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
            Session.UserAgent = string.Format("XenCenter/{0}", ClientVersion());
            RememberProxyAuthenticationModules();
            ReconfigureConnectionSettings();

            log.Info("Application started");
            logSystemDetails();
            OptionsDialog.Log();

            if (Args.Length > 0)
            {
                log.InfoFormat("Args[0]: {0}", Args[0]);
            }

            List <string> sanitizedArgs = new List <string>(Args);

            // Remove the '--wait' argument, which may have been passed to the splash screen
            sanitizedArgs.Remove("--wait");
            string[] args = null;
            if (sanitizedArgs.Count > 1)
            {
                argType = ParseFileArgs(sanitizedArgs, out args);

                if (argType == ArgType.Passwords)
                {
                    log.DebugFormat("Handling password request using '{0}'", args[0]);
                    try
                    {
                        PasswordsRequest.HandleRequest(args[0]);
                    }
                    catch (Exception exn)
                    {
                        log.Fatal(exn, exn);
                    }
                    Application.Exit();
                    return;
                }
            }
            else if (sanitizedArgs.Count == 1 && sanitizedArgs[0] == "messageboxtest")
            {
                new MessageBoxTest().ShowDialog();
                Application.Exit();
                return;
            }
            else if (sanitizedArgs.Count > 0)
            {
                log.Warn("Unrecognised command line options");
            }

            try
            {
                ConnectPipe();
            }
            catch (Win32Exception exn)
            {
                log.Error("Creating named pipe failed. Continuing to launch XenCenter.", exn);
            }

            Application.ApplicationExit -= Application_ApplicationExit;
            Application.ApplicationExit += Application_ApplicationExit;

            MainWindow mainWindow = new MainWindow(argType, args);

            Application.Run(mainWindow);

            log.Info("Application main thread exited");
        }
Exemplo n.º 8
0
 private void optionsToolStripButton_Click(object sender, EventArgs e)
 {
     //Create Options Dialog
     using (OptionsDialog optDlg = new OptionsDialog())
         optDlg.ShowDialog();
 }
Exemplo n.º 9
0
 private void toolsOptionsMenuItem_Click(object sender, EventArgs e)
 {
     OptionsDialog.Display(this);
 }
Exemplo n.º 10
0
        private Window PrepareWindow(ViewModelBase viewModel, ViewModelBase owner)
        {
            Window windowToOpen = null;

            if (viewModel is MainViewModel)
            {
                windowToOpen = new MainWindow();
            }
            else if (viewModel is EncodingViewModel)
            {
                windowToOpen = new EncodingWindow();
            }
            else if (viewModel is SubtitleDialogViewModel)
            {
                windowToOpen = new SubtitleDialog();
            }
            else if (viewModel is ChoosePresetNameViewModel)
            {
                windowToOpen = new ChoosePresetName();
            }
            else if (viewModel is OptionsDialogViewModel)
            {
                windowToOpen = new OptionsDialog();
            }
            else if (viewModel is ChapterMarkersDialogViewModel)
            {
                windowToOpen = new ChapterMarkersDialog();
            }
            else if (viewModel is PreviewViewModel)
            {
                windowToOpen = new PreviewWindow();
            }
            else if (viewModel is AboutDialogViewModel)
            {
                windowToOpen = new AboutDialog();
            }
            else if (viewModel is LogViewModel)
            {
                windowToOpen = new LogWindow();
            }
            else if (viewModel is QueueColumnsViewModel)
            {
                windowToOpen = new QueueColumnsDialog();
            }
            else if (viewModel is ScanMultipleDialogViewModel)
            {
                windowToOpen = new ScanMultipleDialog();
            }
            else if (viewModel is QueueTitlesDialogViewModel)
            {
                windowToOpen = new QueueTitlesDialog();
            }
            else if (viewModel is AddAutoPauseProcessDialogViewModel)
            {
                windowToOpen = new AddAutoPauseProcessDialog();
            }
            else if (viewModel is FileConflictDialogViewModel)
            {
                windowToOpen = new FileConflictDialog();
            }
            else if (viewModel is EncodeDetailsViewModel)
            {
                windowToOpen = new EncodeDetailsWindow();
            }
            else if (viewModel is ShutdownWarningViewModel)
            {
                windowToOpen = new ShutdownWarningWindow();
            }

            if (owner != null)
            {
                windowToOpen.Owner = openWindows[owner];
            }

            windowToOpen.DataContext = viewModel;
            windowToOpen.Closing    += this.OnClosing;

            this.openWindows.Add(viewModel, windowToOpen);
            return(windowToOpen);
        }
Exemplo n.º 11
0
        public GeneralProjectOptionsWidget(Project project, OptionsDialog dialog)
        {
            Build();

            this.project = project;
            this.dialog  = dialog;

            nameLabel.UseUnderline = true;

            descriptionLabel.UseUnderline = true;

            projectNameEntry.Text = project.Name;
            projectDescriptionTextView.Buffer.Text = project.Description;

            // TODO msbuild Move to build panel?
            if (project is DotNetProject)
            {
                projectDefaultNamespaceEntry.Text = ((DotNetProject)project).DefaultNamespace;

                bool byDefault, require;
                MSBuildProjectService.CheckHandlerUsesMSBuildEngine(project, out byDefault, out require);
                if (require)
                {
                    this.msbuildOptionsSection.Visible = false;
                    this.msbuildHeaderLabel.Visible    = false;
                }
                else
                {
                    this.msbuildCheck.Active = project.UseMSBuildEngine ?? byDefault;
                    if (byDefault)
                    {
                        msbuildCheck.Label = GettextCatalog.GetString("Use MSBuild build engine (recommended for this project type)");
                    }
                    else
                    {
                        msbuildCheck.Label = GettextCatalog.GetString("Use MSBuild build engine (unsupported for this project type)");
                    }
                }
            }
            else
            {
                defaultNamespaceLabel.Visible        = false;
                projectDefaultNamespaceEntry.Visible = false;
                this.msbuildOptionsSection.Visible   = false;
                this.msbuildHeaderLabel.Visible      = false;
            }

            switch (project.NewFileSearch)
            {
            case NewFileSearch.None:
                newFilesOnLoadCheckButton.Active     = false;
                autoInsertNewFilesCheckButton.Active = false;
                break;

            case NewFileSearch.OnLoad:
                newFilesOnLoadCheckButton.Active     = true;
                autoInsertNewFilesCheckButton.Active = false;
                break;

            default:
                newFilesOnLoadCheckButton.Active     = true;
                autoInsertNewFilesCheckButton.Active = true;
                break;
            }

            entryVersion.Text           = project.Version;
            checkSolutionVersion.Active = project.SyncVersionWithSolution;
            entryVersion.Sensitive      = !project.SyncVersionWithSolution;

            newFilesOnLoadCheckButton.Clicked += new EventHandler(AutoLoadCheckBoxCheckedChangeEvent);
            AutoLoadCheckBoxCheckedChangeEvent(null, null);
        }
Exemplo n.º 12
0
 protected virtual void OnEinstellungenActivated(object sender, System.EventArgs e)
 {
     OptionsDialog opt = new OptionsDialog();
 }
        void ButtonBase_OnClick(object sender, RoutedEventArgs e)
        {
            if (dialog == null)
            {
                dialog = new OptionsDialog(CompositionContainerBuilder.Container);

                dialog.IsVisibleChanged += DialogOnIsVisibleChanged;
            }

            dialog.Show();
        }
Exemplo n.º 14
0
    /// <summary>
    /// Create a new options dialog (a dialog that displays clickable options to the player).
    /// </summary>
    /// <param name="displayText">The text to be displayed in the dialog</param>
    /// <param name="dialogOptions">A collection of dialog options (eg HybrasylDialogOptions) associated with this dialog</param>
    /// <param name="callback">A callback function or expression that will fire when this dialog is shown to a player</param>
    /// <param name="handler">A callback function or expression that will handle the response once a player selects (clicks) an option</param>
    /// <returns>The constructed dialog</returns>
    public HybrasylDialog NewOptionsDialog(string displayText, HybrasylDialogOptions dialogOptions, string callback = "", string handler = "")
    {
        if (string.IsNullOrEmpty(displayText))
        {
            GameLog.ScriptingError("NewOptionsDialog: display text (first argument) cannot be null or empty");
            return(null);
        }

        if (dialogOptions is null || dialogOptions.Options.Count == 0)
        {
            GameLog.ScriptingError("NewOptionsDialog: dialogOptions (second or greater argument(s)) null, or had no options");
            return(null);
        }

        var dialog = new OptionsDialog(displayText);

        foreach (DictionaryEntry entry in dialogOptions.Options)
        {
            if (entry.Value is string)
            {
                // Callback
                dialog.AddDialogOption(entry.Key as string, entry.Value as string);
            }
            else if (entry.Value is HybrasylDialog)
            {
                var hd = entry.Value as HybrasylDialog;
                if (hd.DialogType == typeof(JumpDialog))
                {
                    // Dialog jump
                    dialog.AddDialogOption(entry.Key as string, hd.Dialog as JumpDialog);
                }
                else
                {
                    GameLog.ScriptingError("NewOptionsDialog: one or more passed option(s) uses type {type} - only jump dialogs are allowed currently",
                                           entry.Value.GetType().Name);
                }
            }
            else if (entry.Value is null)
            {
                // This is JUST an option, with no callback or jump dialog. The dialog handler will process the option itself.
                dialog.AddDialogOption(entry.Key as string);
            }
            else if (entry.Value is HybrasylDialogSequence)
            {
                var hds = entry.Value as HybrasylDialogSequence;
                dialog.AddDialogOption(entry.Key as string, hds.Sequence);
            }
            else
            {
                GameLog.ScriptingError("NewOptionsDialog: one or more passed option(s) was an unknown type {type} - this will not work",
                                       entry.Value.GetType().Name);
            }
        }
        if (dialog.OptionCount == 0)
        {
            GameLog.ScriptingError("NewOptionsDialog: no options were passed or created. This dialog WILL NOT render. DisplayText follows: {displayText}",
                                   displayText);
        }
        dialog.SetInputHandler(handler);
        dialog.SetCallbackHandler(callback);
        return(new HybrasylDialog(dialog));
    }
Exemplo n.º 15
0
        private void OnOpenScreenSaverOptions(object sender, EventArgs e)
        {
            Form dialog = new OptionsDialog();

            dialog.ShowDialog();
        }
Exemplo n.º 16
0
 public override void Initialize(OptionsDialog dialog, object dataObject)
 {
     base.Initialize(dialog, dataObject);
 }
Exemplo n.º 17
0
        private void HandleEditOptions([NotNull] object sender, [NotNull] RoutedEventArgs e)
        {
            Assert.ArgumentNotNull(sender, "sender");
            Assert.ArgumentNotNull(e, "e");

            var model = new OptionsViewModel()
            {
                AutoClearInput     = SettingsHolder.Instance.Settings.AutoClearInput,
                AutoReconnect      = SettingsHolder.Instance.Settings.AutoReconnect,
                CommandChar        = SettingsHolder.Instance.Settings.CommandChar,
                CommandDelimiter   = SettingsHolder.Instance.Settings.CommandDelimiter,
                StartOfLine        = SettingsHolder.Instance.Settings.CursorPosition == CursorPositionHistory.StartOfLine,
                EndOfLine          = SettingsHolder.Instance.Settings.CursorPosition == CursorPositionHistory.EndOfLine,
                HistorySize        = SettingsHolder.Instance.Settings.CommandsHistorySize.ToString(),
                MinLengthHistory   = SettingsHolder.Instance.Settings.MinLengthHistory.ToString(),
                ScrollBuffer       = SettingsHolder.Instance.Settings.ScrollBuffer.ToString(),
                SettingsFolder     = SettingsHolder.Instance.SettingsFolder == SettingsFolder.DocumentsAndSettings,
                AutoConnect        = SettingsHolder.Instance.Settings.AutoConnect,
                SelectedFont       = SettingsHolder.Instance.Settings.MUDFontName,
                SelectedFontSize   = SettingsHolder.Instance.Settings.MUDFontSize,
                SelectedFontWeight = SettingsHolder.Instance.Settings.MudFontWeight,
            };

            var optionsDialog = new OptionsDialog()
            {
                DataContext = model, Owner = this
            };
            var dialogResult = optionsDialog.ShowDialog();

            if (dialogResult.HasValue && dialogResult.Value)
            {
                SettingsHolder.Instance.Settings.AutoClearInput   = model.AutoClearInput;
                SettingsHolder.Instance.Settings.AutoReconnect    = model.AutoReconnect;
                SettingsHolder.Instance.Settings.CommandChar      = model.CommandChar;
                SettingsHolder.Instance.Settings.CommandDelimiter = model.CommandDelimiter;
                SettingsHolder.Instance.Settings.AutoConnect      = model.AutoConnect;
                SettingsHolder.Instance.Settings.ColorTheme       = model.SelectedTheme.Name;
                ThemeManager.Instance.ActiveTheme              = model.SelectedTheme;
                SettingsHolder.Instance.Settings.MUDFontName   = model.SelectedFont;
                SettingsHolder.Instance.Settings.MUDFontSize   = model.SelectedFontSize;
                SettingsHolder.Instance.Settings.MudFontWeight = model.SelectedFontWeight;

                if (model.StartOfLine)
                {
                    SettingsHolder.Instance.Settings.CursorPosition = CursorPositionHistory.StartOfLine;
                }
                else
                {
                    SettingsHolder.Instance.Settings.CursorPosition = CursorPositionHistory.EndOfLine;
                }

                if (model.SettingsFolder)
                {
                    SettingsHolder.Instance.SettingsFolder = SettingsFolder.DocumentsAndSettings;
                }
                else
                {
                    SettingsHolder.Instance.SettingsFolder = SettingsFolder.ProgramFolder;
                }

                int val;
                if (int.TryParse(model.HistorySize, out val))
                {
                    SettingsHolder.Instance.Settings.CommandsHistorySize = val;
                }

                if (int.TryParse(model.MinLengthHistory, out val))
                {
                    SettingsHolder.Instance.Settings.MinLengthHistory = val;
                }

                if (int.TryParse(model.ScrollBuffer, out val))
                {
                    SettingsHolder.Instance.Settings.ScrollBuffer = val < 100000 ? val : 100000;
                }

                SettingsHolder.Instance.SaveCommonSettings();
            }
        }
Exemplo n.º 18
0
 private void toolsDSConfigMenuItem_Click(object sender, EventArgs e)
 {
     OptionsDialog.Display(this, Resources.DataSourceManagerDataSources);
 }
 public override void Initialize(OptionsDialog dialog, object dataObject)
 {
     packagingProject = dataObject as PackagingProject;
     project          = dataObject as DotNetProject;
     base.Initialize(dialog, dataObject);
 }
Exemplo n.º 20
0
 private void toolsTemplatesMenuItem_Click(object sender, EventArgs e)
 {
     OptionsDialog.Display(this, Resources.TemplateManagerTemplates);
 }
 void IOptionsPanel.Initialize(OptionsDialog dialog, object dataObject)
 {
 }
Exemplo n.º 22
0
        private void optionsMenuItem_Click(object sender, EventArgs e)
        {
            OptionsDialog optionsForm = new OptionsDialog();

            optionsForm.UserAgent = scp.UserAgent;

            if (optionsForm.ShowDialog() == DialogResult.OK)
            {
                bool saveOptions = false;
                if (scp.UserAgent != optionsForm.UserAgent)
                {
                    Properties.Settings.Default.UserAgentCurrent = optionsForm.UserAgent;
                    saveOptions = true;

                    scp.UserAgent = optionsForm.UserAgent;
                    scp.Rescan();
                }

                if (saveOptions)
                {
                    Properties.Settings.Default.Save();
                }
            }
        }
Exemplo n.º 23
0
            protected override bool OnPerform()
            {
                if ((HudController.Instance != null) && (GameUtils.IsOnVacation()))
                {
                    HudModel model = HudController.Instance.mHudModel as HudModel;
                    if (model != null)
                    {
                        if (model.MinuteChanged != null)
                        {
                            foreach (Delegate del in model.MinuteChanged.GetInvocationList())
                            {
                                TimeControl control = del.Target as TimeControl;
                                if (control != null)
                                {
                                    TimeControlEx.sThs = control;

                                    model.MinuteChanged -= TimeControlEx.sThs.OnMinuteChanged;
                                    model.MinuteChanged -= TimeControlEx.OnMinuteChanged;
                                    model.MinuteChanged += TimeControlEx.OnMinuteChanged;

                                    break;
                                }
                            }
                        }
                    }
                }

                InventoryPanel inventory = InventoryPanel.sInstance;

                if ((inventory != null) && (inventory.Visible))
                {
                    if (inventory.mTimeAlmanacButton != null)
                    {
                        if (GameUtils.IsFutureWorld())
                        {
                            inventory.mTimeAlmanacButton.Visible = (GameStates.TravelHousehold == Household.ActiveHousehold);
                        }

                        if (inventory.mTimeAlmanacButton.Visible)
                        {
                            inventory.mTimeAlmanacButton.Click -= inventory.OnClickTimeAlmanac;
                            inventory.mTimeAlmanacButton.Click -= FutureDescendantServiceEx.OnClickTimeAlmanac;
                            inventory.mTimeAlmanacButton.Click += FutureDescendantServiceEx.OnClickTimeAlmanac;
                        }
                    }
                }

                EditTownPuck puck = EditTownPuck.Instance;

                if (puck != null)
                {
                    if (puck.mReturnToLiveButton != null)
                    {
                        puck.mReturnToLiveButton.Click -= puck.OnReturnToLive;
                        puck.mReturnToLiveButton.Click -= OnReturnToLive;
                        puck.mReturnToLiveButton.Click += OnReturnToLive;
                    }
                }

                EditTownInfoPanel panel = EditTownInfoPanel.Instance;

                if (panel != null)
                {
                    if ((panel.mActionButtons != null) && (panel.mActionButtons.Length > 8) && (panel.mActionButtons[0x8] != null))
                    {
                        panel.mActionButtons[0x8].Click -= panel.OnChangeTypeClick;
                        panel.mActionButtons[0x8].Click -= OnChangeTypeClick;
                        panel.mActionButtons[0x8].Click += OnChangeTypeClick;
                    }
                }

                OptionsDialog options = OptionsDialog.sDialog;

                if (options != null)
                {
                    if (GameUtils.IsInstalled(ProductVersion.EP8))
                    {
                        Button testButton = options.mSeasonWindow.GetChildByID(0xdf085c3, true) as Button;
                        if ((testButton != null) && (!testButton.Enabled))
                        {
                            using (BaseWorldReversion reversion = new BaseWorldReversion())
                            {
                                foreach (Button weather in options.mEnabledWeatherButtons.Values)
                                {
                                    weather.Enabled = true;
                                }

                                if (options.mFahrenheitRadio != null)
                                {
                                    options.mFahrenheitRadio.Enabled = true;
                                }

                                if (options.mCelciusRadio != null)
                                {
                                    options.mCelciusRadio.Enabled = true;
                                }

                                options.SetupSeasonControls(false, ref options.mOldSeasonData);
                            }
                        }
                    }
                }

                FutureDescendantService instance = FutureDescendantServiceEx.GetInstance();

                if (Sims3.UI.Responder.Instance.InLiveMode && Traveler.Settings.mDisableDescendants && instance.mEventListeners.Count > 0)
                {
                    instance.CleanUpEventListeners();
                }

                return(true);
            }
Exemplo n.º 24
0
        // Tools
        private void MenuToolsOptions_Click(object sender, EventArgs e)
        {
            var optionsWindow = new OptionsDialog();

            optionsWindow.ShowDialog(this);
        }
Exemplo n.º 25
0
        private void OptionsIcon_Clicked(object sender, MouseButtonEventArgs e)
        {
            //new OptionsDialog(Settings).ShowDialog();

            OptionsDialog od = new OptionsDialog(Settings.GetCopy());

            bool? result = od.ShowDialog();

            if (result != null && result.HasValue && result.Value)
            {
                od.Settings.CopyTo(Settings);

                Settings.Save(Path.Combine(AppFolder, "settings.xml"));
            }
        }
Exemplo n.º 26
0
 public ValidateOptionsCommand(OptionsDialog dlg)
 {
     this.dlg = dlg;
 }
Exemplo n.º 27
0
		public override void OnShowOptionsDialog( OptionsDialog dialog )
		{
			base.OnShowOptionsDialog( dialog );

			if( addPageToOptions )
				dialog.AddLeaf( new AddonOptionsLeaf() );
		}
        public SolutionRunConfigurationsPanelWidget(SolutionRunConfigurationsPanel panel, OptionsDialog dialog)
        {
            this.panel = panel;

            Margin  = 6;
            Spacing = 6;

            list = new RunConfigurationsList();
            PackStart(list, true);

            var box = new Xwt.HBox();

            box.Spacing = 6;

            var btn = new Xwt.Button(GettextCatalog.GetString("New"));

            btn.Clicked += OnAddConfiguration;
            box.PackStart(btn, false);

            copyButton          = new Xwt.Button(GettextCatalog.GetString("Duplicate"));
            copyButton.Clicked += OnCopyConfiguration;
            box.PackStart(copyButton, false);

            renameButton          = new Xwt.Button(GettextCatalog.GetString("Rename"));
            renameButton.Clicked += OnRenameConfiguration;
            box.PackStart(renameButton, false);

            removeButton          = new Xwt.Button(GettextCatalog.GetString("Remove"));
            removeButton.Clicked += OnRemoveConfiguration;
            box.PackEnd(removeButton, false);

            Fill();

            PackStart(box, false);

            list.SelectionChanged += (sender, e) => UpdateButtons();
            list.RowActivated     += (sender, e) => panel.ShowConfiguration((MultiItemSolutionRunConfiguration)list.SelectedConfiguration);
            UpdateButtons();
        }