예제 #1
0
파일: Form1.cs 프로젝트: dd-dk/sims3tools
        public Form1(PresenterController pc)
        {
            InitializeComponent();

            _PresenterController = pc;
            _PresenterController.FilenameChanged += new EventHandler<PresenterController.StringEventArgs>(_PresenterController_FilenameChanged);
            _PresenterController.IsDirtyChanged += new EventHandler(_PresenterController_IsDirtyChanged);
        }
예제 #2
0
파일: Form1.cs 프로젝트: dd-dk/sims3tools
        void _PresenterController_FilenameChanged(object sender, PresenterController.StringEventArgs e)
        {
            string filename = e.Value;
            bool dirty = this.Text.StartsWith("* ");
            if (filename == null || filename.Length == 0)
                this.Text = "String Table Editor";
            else
                this.Text = "String Table Editor: " + System.IO.Path.GetFileName(filename);
            if (dirty)
                this.Text = "* " + this.Text;

            openFileDialog1.FileName = filename;
            saveFileDialog1.FileName = filename;
        }
예제 #3
0
 public RowFormatCurrentDefault(PresenterController parent, ulong _Guid) : base(parent, _Guid)
 {
 }
예제 #4
0
 public RowFormatCurrent(PresenterController parent, ulong guid)
 {
     _Parent = parent; _Guid = guid;
 }
예제 #5
0
        public MainWindow()
        {
            InitializeComponent();
            this.DataContext = this;
            _PresenterController = new PresenterController();

            #region PresenterController events
            _PresenterController.DefaultLanguageChanged += new EventHandler(_PresenterController_DefaultLanguageChanged);
            _PresenterController.ExportEmptyStringsChanged += new EventHandler(_PresenterController_ExportEmptyStringsChanged);

            _PresenterController.FilenameChanged += new EventHandler<PresenterController.StringEventArgs>(_PresenterController_FilenameChanged);
            _PresenterController.IsDirtyChanged += new EventHandler(_PresenterController_IsDirtyChanged);

            _PresenterController.StringTableSetsChanged += new EventHandler(_PresenterController_StringTableSetsChanged);
            _PresenterController.SelectedStringTableSetChanged += new EventHandler(_PresenterController_SelectedStringTableSetChanged);

            _PresenterController.LanguagesChanged += new EventHandler(_PresenterController_LanguagesChanged);
            _PresenterController.SelectedLanguageChanged += new EventHandler(_PresenterController_SelectedLanguageChanged);

            _PresenterController.ShowDefaultLanguageChanged += new EventHandler(_PresenterController_ShowDefaultLanguageChanged);

            _PresenterController.StringSetsChanged += new EventHandler(_PresenterController_StringSetsChanged);
            _PresenterController.SelectedStringSetChanged += new EventHandler(_PresenterController_SelectedStringSetChanged);

            // These event will be raised before the event handler is attached, so resend now.
            _PresenterController_ExportEmptyStringsChanged(null, null);
            _PresenterController_LanguagesChanged(null, null);
            _PresenterController_SelectedLanguageChanged(null, null);
            _PresenterController_ShowDefaultLanguageChanged(null, null);
            #endregion

            #region File menu
            ofdOpenPackage = new OpenFileDialog();
            ofdOpenPackage.FileName = "*.package";
            ofdOpenPackage.Filter = "Sims3 Packages|*.package|All Files|*.*";
            ofdOpenPackage.Title = "Open package";

            sfdSavePackage = new SaveFileDialog();
            sfdSavePackage.DefaultExt = "package";
            sfdSavePackage.FileName = "*.package";
            sfdSavePackage.Filter = "Sims3 Packages|*.package|All Files|*.*";
            sfdSavePackage.Title = "Save package as";

            this.CommandBindings.AddRange(new CommandBinding[] {
                new CommandBinding(ApplicationCommands.New, fileNewExecuted, (x, e) => {e.CanExecute = _PresenterController.FileNewEnabled; e.Handled = true; }),
                new CommandBinding(ApplicationCommands.Open, fileOpenExecuted, (x, e) => {e.CanExecute = _PresenterController.FileOpenEnabled; e.Handled = true; }),
                new CommandBinding(ApplicationCommands.Save, fileSaveExecuted, (x, e) => {e.CanExecute = _PresenterController.FileSaveEnabled; e.Handled = true; }),
                new CommandBinding(ApplicationCommands.SaveAs, fileSaveAsExecuted, (x, e) => {e.CanExecute = _PresenterController.FileSaveAsEnabled; e.Handled = true; }),
                new CommandBinding(fileSaveCopyAs, fileSaveCopyAsExecuted, (x, e) => {e.CanExecute = _PresenterController.FileSaveCopyAsEnabled; e.Handled = true; }),
                new CommandBinding(ApplicationCommands.Close, fileCloseExecuted, (x, e) => {e.CanExecute = _PresenterController.FileCloseEnabled; e.Handled = true; }),
                new CommandBinding(fileExit, fileExitExecuted, (x, e) => {e.CanExecute = _PresenterController.FileExitEnabled; e.Handled = true; }),
            });

            // Additional input bindings
            this.InputBindings.AddRange(new InputBinding[] {
                new KeyBinding(ApplicationCommands.Close, new KeyGesture(Key.W, ModifierKeys.Control)),
                new KeyBinding(fileExit, new KeyGesture(Key.Q, ModifierKeys.Control)),
            });
            #endregion

            #region Export menu
            sfdExportLanguage = new SaveFileDialog();
            sfdExportLanguage.DefaultExt = "xml";
            sfdExportLanguage.FileName = "*.xml";
            sfdExportLanguage.Filter = "XML files|*.xml|All Files|*.*";
            sfdExportLanguage.Title = "Export language(s)";

            this.CommandBindings.AddRange(new CommandBinding[] {
                new CommandBinding(exportCurrent, exportCurrentExecuted, (x, e) => {e.CanExecute = _PresenterController.ExportCurrentEnabled; e.Handled = true; }),
                new CommandBinding(exportMarked, exportMarkedExecuted, (x, e) => {e.CanExecute = _PresenterController.ExportMarkedEnabled; e.Handled = true; }),
                new CommandBinding(exportChanged, exportChangedExecuted, (x, e) => {e.CanExecute = _PresenterController.ExportChangedEnabled; e.Handled = true; }),
                new CommandBinding(exportLanguage, exportLanguageExecuted, (x, e) => {e.CanExecute = _PresenterController.ExportLanguageEnabled; e.Handled = true; }),
                new CommandBinding(exportSTSCurrent, exportSTSCurrentExecuted, (x, e) => {e.CanExecute = _PresenterController.ExportSTSCurrentEnabled; e.Handled = true; }),
                new CommandBinding(exportSTSMarked, exportSTSMarkedExecuted, (x, e) => {e.CanExecute = _PresenterController.ExportSTSMarkedEnabled; e.Handled = true; }),
                new CommandBinding(exportSTSChanged, exportSTSChangedExecuted, (x, e) => {e.CanExecute = _PresenterController.ExportSTSChangedEnabled; e.Handled = true; }),
                new CommandBinding(exportSTSLanguage, exportSTSLanguageExecuted, (x, e) => {e.CanExecute = _PresenterController.ExportSTSLanguageEnabled; e.Handled = true; }),
                new CommandBinding(exportAll, exportAllExecuted, (x, e) => {e.CanExecute = _PresenterController.ExportAllEnabled; e.Handled = true; }),
            });
            #endregion

            #region Import menu
            ofdImportLanguage = new OpenFileDialog();
            ofdImportLanguage.FileName = "*.xml";
            ofdImportLanguage.Filter = "XML files|*.xml|All Files|*.*";
            ofdImportLanguage.Title = "Import languages";

            this.CommandBindings.AddRange(new CommandBinding[] {
                new CommandBinding(importStrings, importStringsExecuted, (x, e) => {e.CanExecute = _PresenterController.ImportStringsEnabled; e.Handled = true; }),
            });
            #endregion

            #region Settings menu
            this.CommandBindings.AddRange(new CommandBinding[] {
                new CommandBinding(settingsExportEmptyStrings, settingsExportEmptyStringsExecuted, (x, e) => {e.CanExecute = _PresenterController.SettingsExportEmptyStringsEnabled; e.Handled = true; }),
            });
            #endregion

            this.CommandBindings.AddRange(new CommandBinding[] {
                new CommandBinding(addString, addStringExecuted, (x, e) => { e.CanExecute = _PresenterController.AddStringEnabled; e.Handled = true; }),
                new CommandBinding(deleteString, deleteStringExecuted,(x, e) => { e.CanExecute = _PresenterController.DeleteStringEnabled; e.Handled = true; }),
            });

        }
예제 #6
0
 public RowFormatCurrentDefault(PresenterController parent, ulong _Guid) : base(parent, _Guid) { }
예제 #7
0
 public RowFormatCurrent(PresenterController parent, ulong guid) { _Parent = parent; _Guid = guid; }