예제 #1
0
        public void SaveAsFile()
        {
            if (Loading.FilePath != null)
            {
                SaveSTBLXMLDialog.InitialDirectory = Path.GetDirectoryName(Loading.FilePath);
                SaveSTBLXMLDialog.FileName         = Path.GetFileName(Loading.FilePath);
            }

            if (SaveSTBLXMLDialog.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }

            string saveFilePath = SaveSTBLXMLDialog.FileName;

            SaveSTBLXMLDialog.InitialDirectory = "";
            SaveSTBLXMLDialog.FileName         = "";

            try {
                Loading.SaveFile(saveFilePath);
            } catch (Exception saveException) {
                ShowSaveFailureDialog(saveException);
            }

            EntryBrowser.RefreshItems();
        }
예제 #2
0
        private void MenuStripFileMergeItem_Click(object sender, EventArgs e)
        {
            MergeWith mergeForm = new MergeWith();

            mergeForm.ShowDialog();

            EntryBrowser.SetupRows();
        }
예제 #3
0
        public void ImportFromPackageFile()
        {
            Import importDialog = new Import();

            importDialog.ShowDialog();

            EntryBrowser.SetupRows();
        }
예제 #4
0
 private void FilterActiveCheckBox_CheckedChanged(object sender, EventArgs e)
 {
     if (FilterActiveCheckBox.Checked)
     {
         if (CurrentBrowserFilter != null)
         {
             EntryBrowser.FilterItems(CurrentBrowserFilter.GetFilterPredicate());
         }
     }
     else
     {
         EntryBrowser.UnfilterAll();
     }
 }
예제 #5
0
        private void FilterAdvancedButton_Click(object sender, EventArgs e)
        {
            SelectorFilterOptions filterOptionsForm = new SelectorFilterOptions();

            filterOptionsForm.ShowDialog();

            if (filterOptionsForm.GeneratedFilter != null)
            {
                CurrentBrowserFilter = filterOptionsForm.GeneratedFilter;

                if (FilterActiveCheckBox.Checked)
                {
                    EntryBrowser.FilterItems(CurrentBrowserFilter.GetFilterPredicate());
                }
            }
        }
예제 #6
0
        private void AddEntryButton_Click(object sender, EventArgs e)
        {
            SelectorNew selectorNewForm = new SelectorNew();

            selectorNewForm.ShowDialog();

            STBLXMLEntry createdEntry = selectorNewForm.CreatedEntry;

            if (createdEntry == null)
            {
                return;
            }

            EntryBrowser.SetupRows();
            EntryBrowser.ScrollToItem(createdEntry, selectItem: true);
        }
예제 #7
0
        private void MenuStripEditSelectedResetKeysItem_Click(object sender, EventArgs e)
        {
            foreach (DataGridViewRow selectedEntryRow in EntryBrowser.GetAllSelectedItems())
            {
                STBLXMLEntry entry = EntryBrowser.FindEntry(selectedEntryRow);

                if (entry != null)
                {
                    continue;
                }

                entry.Key = STBL.GetRandomUIntKey(blockedKeys: Loading.GetAllEntryKeys());
            }

            EntryBrowser.RefreshItems();
        }
예제 #8
0
        public Selector()
        {
            InitializeComponent();

            EntryBrowser.SetupRows();

            UpdateStatusBarItemsLabel();
            UpdateStatusBarSelectedLabel();

            Loading.FileChanged += Loading_Changed;
            Loading.BecameClean += Loading_Changed;
            Loading.BecameDirty += Loading_Changed;

            EntryBrowser.ItemCountUpdate     += EntryBrowser_ItemCountUpdate;
            EntryBrowser.SelectedCountUpdate += EntryBrowser_SelectedCountUpdate;
        }
예제 #9
0
        public bool OpenFile()
        {
            if (Loading.IsDirty)
            {
                DialogResult unsavedDialogResult = ShowUnsavedDialog();

                if (unsavedDialogResult == DialogResult.Yes)
                {
                    SaveFile();
                }
                else if (unsavedDialogResult == DialogResult.Cancel)
                {
                    return(false);
                }
            }

            if (Loading.FilePath != null)
            {
                OpenSTBLXMLDialog.InitialDirectory = Path.GetDirectoryName(Loading.FilePath);
            }

            if (OpenSTBLXMLDialog.ShowDialog() == DialogResult.Cancel)
            {
                return(false);
            }

            string openFilePath = OpenSTBLXMLDialog.FileName;

            OpenSTBLXMLDialog.InitialDirectory = "";
            OpenSTBLXMLDialog.FileName         = "";

            try {
                Loading.OpenFile(openFilePath);
            } catch (Exception openException) {
                ShowOpenFailureDialog(openException);
            }

            EntryBrowser.SetupRows();

            return(true);
        }
예제 #10
0
        public bool NewFile()
        {
            if (Loading.IsDirty)
            {
                DialogResult unsavedDialogResult = ShowUnsavedDialog();

                if (unsavedDialogResult == DialogResult.Yes)
                {
                    SaveFile();
                }
                else if (unsavedDialogResult == DialogResult.Cancel)
                {
                    return(false);
                }
            }

            Loading.NewFile();
            EntryBrowser.SetupRows();

            return(true);
        }
예제 #11
0
 public void UpdateStatusBarSelectedLabel()
 {
     FormStatusStripSelectedCount.Text = string.Format(Localization.GetString(statusBarSelectedTextIdentifier), EntryBrowser.GetSelectedItemCount());
 }
예제 #12
0
 public void UpdateStatusBarItemsLabel()
 {
     FormStatusStripItemsCount.Text = string.Format(Localization.GetString(statusBarItemsTextIdentifier), EntryBrowser.GetItemCount());
 }
예제 #13
0
 private void MenuStripEditSelectedRemoveAllItem_Click(object sender, EventArgs e)
 {
     EntryBrowser.RemoveSelectedItems();
 }
예제 #14
0
 private void MenuStripEditDeselectAllItem_Click(object sender, EventArgs e)
 {
     EntryBrowser.DeselectAllItems();
 }