Exemple #1
0
        public void SetColumnConfig(ColumnField[] columnTextFields, ColumnConfig[] colConfig)
        {
            string key = Key.ToString();

            if (GameFileViewControl is IGameFileColumnView columnView)
            {
                columnView.SuspendLayout();

                var sortedColumns = SortColumns(key, columnTextFields, colConfig);
                columnView.SetColumnFields(sortedColumns);
                SetSortedColumn(key, columnView, colConfig);
                SetColumnWidths(key, columnView, colConfig);

                columnView.SetColumnFormat("ReleaseDate", CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern);
                columnView.SetColumnFormat("Downloaded", CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern);
                columnView.SetColumnFormat("LastPlayed", CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern);

                GameFileViewControl.ResumeLayout();
            }
            else if (GameFileViewControl is IGameFileSortableView sortableView)
            {
                var sortedColumns = SortColumns(key, columnTextFields, colConfig);
                foreach (var sortColumn in sortedColumns)
                {
                    ColumnConfig config = colConfig.FirstOrDefault(x => x.Sort != SortOrder.None && x.Parent == key && sortColumn.DataKey.Equals(x.Column, StringComparison.InvariantCultureIgnoreCase));
                    if (config != null)
                    {
                        sortableView.SetSortedColumn(config.Column, config.Sort);
                        break;
                    }
                }
            }
        }
        public TagControl()
        {
            InitializeComponent();

            GameFileViewControl.StyleGrid(dgvTags);
            dgvTags.MultiSelect = false;

            DataGridViewColumn col = new DataGridViewTextBoxColumn();

            col.HeaderText       = "Name";
            col.Name             = "Name";
            col.DataPropertyName = "Name";
            dgvTags.Columns.Add(col);

            col                  = new DataGridViewTextBoxColumn();
            col.HeaderText       = "Display Tab";
            col.Name             = "HasTab";
            col.DataPropertyName = "HasTab";
            dgvTags.Columns.Add(col);

            col                  = new DataGridViewTextBoxColumn();
            col.HeaderText       = "Display Color";
            col.Name             = "HasColor";
            col.DataPropertyName = "HasColor";
            dgvTags.Columns.Add(col);

            col.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
        }
        public SyncStatusForm()
        {
            InitializeComponent();

            GameFileViewControl.StyleGrid(dgvFiles);
            dgvFiles.Columns[dgvFiles.Columns.Count - 1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
        }
Exemple #4
0
        private void UpdateBase(IGameFileDataSourceAdapter adapter, GameFileViewControl ctrl, GameFileGetOptions options, IEnumerable <GameFileSearchField> searchFields)
        {
            IEnumerable <IGameFileDataSource> first = new IGameFileDataSource[0];

            GameFileFieldType[] defaultGameFileSelectFields = this.DefaultGameFileSelectFields;
            if (options == null)
            {
                foreach (GameFileSearchField field in searchFields)
                {
                    first = first.Union <IGameFileDataSource>(adapter.GetGameFiles(new GameFileGetOptions(defaultGameFileSelectFields, field)));
                }
            }
            else
            {
                foreach (GameFileSearchField field2 in searchFields)
                {
                    options.SearchField = field2;
                    first = first.Union <IGameFileDataSource>(adapter.GetGameFiles(options));
                }
                if (options.SearchField != null)
                {
                    first = first.Union <IGameFileDataSource>(adapter.GetGameFiles(new GameFileGetOptions(defaultGameFileSelectFields, options.SearchField)));
                }
            }
            this.SetDataSource(ctrl, first.ToList <IGameFileDataSource>());
        }
Exemple #5
0
        private void RebuildTagToolStrip()
        {
            GameFileViewControl currentControl = GetCurrentViewControl();

            if (currentControl != null)
            {
                List <ITagData> addTags    = new List <ITagData>();
                List <ITagData> removeTags = new List <ITagData>();

                Tags = DataSourceAdapter.GetTags().OrderBy(x => x.Name).ToArray();

                foreach (var gameFile in SelectedItems(currentControl))
                {
                    if (gameFile.GameFileID.HasValue)
                    {
                        var gameFileTags      = TagMapLookup.GetTags(gameFile);
                        var currentRemoveTags = Tags.Where(x => gameFileTags.Any(y => y.TagID == x.TagID));
                        var currentAddTags    = Tags.Except(currentRemoveTags);

                        addTags    = addTags.Union(currentAddTags).ToList();
                        removeTags = removeTags.Union(currentRemoveTags).ToList();
                    }
                }

                ToolStripMenuItem tagToolStrip       = mnuLocal.Items.Cast <ToolStripItem>().FirstOrDefault(x => x.Text == "Tag") as ToolStripMenuItem;
                ToolStripMenuItem removeTagToolStrip = mnuLocal.Items.Cast <ToolStripItem>().FirstOrDefault(x => x.Text == "Remove Tag") as ToolStripMenuItem;

                if (tagToolStrip != null)
                {
                    BuildTagToolStrip(tagToolStrip, addTags, tagToolStripItem_Click);
                    BuildTagToolStrip(removeTagToolStrip, removeTags, removeTagToolStripItem_Click);
                }
            }
        }
Exemple #6
0
 public ITabView TabViewForControl(GameFileViewControl ctrl)
 {
     if (this.m_tabLookup.ContainsKey(ctrl))
     {
         return(this.m_tabLookup[ctrl].Item1);
     }
     return(null);
 }
Exemple #7
0
        private static void SetColumnWidths(string tab, GameFileViewControl ctrl, ColumnConfig[] config)
        {
            IEnumerable <ColumnConfig> configSet = config.Where(x => x.Parent == tab);

            foreach (ColumnConfig col in configSet)
            {
                ctrl.SetColumnWidth(col.Column, col.Width);
            }
        }
Exemple #8
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            GameFileViewControl ctrl = CurrentGameFileControl;

            if (ctrl != null)
            {
                HandleSearch(ctrl);
            }
        }
Exemple #9
0
        private static void SetSortedColumn(string tab, GameFileViewControl gameFileViewControl, ColumnConfig[] colConfig)
        {
            ColumnConfig config = colConfig.FirstOrDefault(x => x.Parent == tab && x.Sort != SortOrder.None);

            if (config != null)
            {
                gameFileViewControl.SetSortedColumn(config.Column, config.Sort);
            }
        }
Exemple #10
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            GameFileViewControl currentGameFileControl = this.CurrentGameFileControl;

            if (currentGameFileControl != null)
            {
                this.HandleSearch(currentGameFileControl);
            }
        }
Exemple #11
0
 private void CtrlSearch_SearchTextKeyPreviewDown(object sender, PreviewKeyDownEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         GameFileViewControl ctrl = CurrentGameFileControl;
         if (ctrl != null)
         {
             HandleSearch(ctrl);
         }
     }
 }
Exemple #12
0
 private void SetDataSource(GameFileViewControl ctrl, IEnumerable <IGameFileDataSource> ds)
 {
     if (ds.Count <IGameFileDataSource>() == 0)
     {
         ctrl.DataSource = null;
         ctrl.SetDisplayText("No Results Found");
     }
     else
     {
         ctrl.DataSource = new BindingListView <GameFileDataSource>(ds.Cast <GameFileDataSource>().ToList <GameFileDataSource>());
     }
 }
        public GenericFileView()
        {
            InitializeComponent();

            GameFileViewControl.StyleGrid(dgvMain);

            SetColumnFields(new Tuple <string, string>[]
            {
                new Tuple <string, string>("Description", "Description"),
                new Tuple <string, string>(s_dateColumn, "Created"),
                new Tuple <string, string>("SourcePortName", "SourcePort")
            });
        }
Exemple #14
0
        public void UpdateGameFileViewSearch(IGameFileDataSourceAdapter adapter, GameFileViewControl ctrl)
        {
            string searchText = this.SearchControl.SearchText;

            if (!string.IsNullOrEmpty(searchText.Trim()))
            {
                this.Update(adapter, ctrl, null, this.GetSelectedSearchFields(searchText));
            }
            else
            {
                this.Update(adapter, ctrl, null, null);
            }
        }
Exemple #15
0
        public List <ColumnConfig> GetColumnConfig()
        {
            List <ColumnConfig> config = new List <ColumnConfig>();

            foreach (string key in GameFileViewControl.GetColumnKeyOrder())
            {
                ColumnConfig col = new ColumnConfig(Title, key,
                                                    GameFileViewControl.GetColumnWidth(key), GameFileViewControl.GetColumnSort(key));
                config.Add(col);
            }

            return(config);
        }
        private void SetGameFileViewEvents(GameFileViewControl ctrl, bool dragDrop)
        {
            ctrl.ToolTipTextNeeded += ctrlView_ToolTipTextNeeded;
            ctrl.RowDoubleClicked  += ctrlView_RowDoubleClicked;
            ctrl.SelectionChange   += ctrlView_SelectionChange;
            ctrl.GridKeyPress      += ctrlView_GridKeyPress;

            if (dragDrop)
            {
                ctrl.DragDrop    += ctrlView_DragDrop;
                ctrl.DragEnter   += ctrlView_DragEnter;
                ctrl.GridKeyDown += ctrlView_GridKeyDown;
            }
        }
        public SourcePortViewForm(IDataSourceAdapter adapter, AppConfiguration appConfig, ITabView[] tabViews, SourcePortLaunchType type)
        {
            InitializeComponent();

            GameFileViewControl.StyleGrid(dgvSourcePorts);
            dgvSourcePorts.MultiSelect = false;

            m_adapter    = adapter;
            m_appConfig  = appConfig;
            m_tabViews   = tabViews;
            m_launchType = type;

            ResetData();
            dgvSourcePorts.Columns[dgvSourcePorts.Columns.Count - 1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
        }
Exemple #18
0
        public void SetColumnConfig(ColumnField[] columnTextFields, ColumnConfig[] colConfig)
        {
            GameFileViewControl.SuspendLayout();

            var sortedColumns = SortColumns(Title, columnTextFields, colConfig);

            GameFileViewControl.SetColumnFields(sortedColumns);
            SetSortedColumn(Title, GameFileViewControl, colConfig);
            SetColumnWidths(Title, GameFileViewControl, colConfig);

            GameFileViewControl.SetColumnFormat("ReleaseDate", CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern);
            GameFileViewControl.SetColumnFormat("Downloaded", CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern);
            GameFileViewControl.SetColumnFormat("LastPlayed", CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern);

            GameFileViewControl.ResumeLayout();
        }
Exemple #19
0
 private void Update(IGameFileDataSourceAdapter adapter, GameFileViewControl ctrl, GameFileGetOptions options, IEnumerable <GameFileSearchField> searchFields)
 {
     if ((searchFields == null) || (searchFields.Count <GameFileSearchField>() == 0))
     {
         if (options == null)
         {
             this.SetDataSource(ctrl, adapter.GetGameFiles().ToList <IGameFileDataSource>());
         }
         else
         {
             this.SetDataSource(ctrl, adapter.GetGameFiles(options).ToList <IGameFileDataSource>());
         }
     }
     else
     {
         this.UpdateBase(adapter, ctrl, options, searchFields);
     }
 }
Exemple #20
0
 private void HandleSearch(GameFileViewControl ctrl)
 {
     if (!this.m_bOverrideInit)
     {
         ITabView view = this.m_tabHandler.TabViewForControl(ctrl);
         if (view != null)
         {
             if (!string.IsNullOrEmpty(this.ctrlSearch.SearchText))
             {
                 view.SetGameFiles(DoomLauncher.Util.SearchFieldsFromSearchCtrl(this.ctrlSearch));
             }
             else
             {
                 view.SetGameFiles();
             }
         }
     }
 }
Exemple #21
0
        public GameFileTileViewControl()
        {
            InitializeComponent();

            BackColor = SystemColors.Window;

            SetItemsPerPage(GameFileTileManager.Instance.MaxItems);
            pagingControl.PageIndexChanged += M_pagingControl_PageIndexChanged;

            m_mouseTimer          = new System.Timers.Timer();
            m_mouseTimer.Interval = 100;
            m_mouseTimer.Elapsed += MouseTimer_Elapsed;
            m_mouseTimer.Start();

            m_label.Visible = false;
            GameFileViewControl.StyleDisplayLabel(m_label);

            cmbMaxItemsPerPage.KeyDown += CmbMaxItemsPerPage_KeyDown;

            GameFileTileManager.Instance.TilesRecreated += Instance_TilesRecreated;
            InitTiles();
        }
Exemple #22
0
        public IGameFileView CreateGameFileView()
        {
            IGameFileView view;

            switch (DefaultType)
            {
            case GameFileViewType.GridView:
                view = new GameFileViewControl();
                break;

            case GameFileViewType.TileView:
            case GameFileViewType.TileViewCondensed:
                view = new GameFileTileViewControl();
                break;

            default:
                view = new GameFileViewControl();
                break;
            }

            m_toolTipDisplayHandler.RegisterView(view);
            return(view);
        }
Exemple #23
0
 public void UpdateGameFileView(IGameFileDataSourceAdapter adapter, GameFileViewControl ctrl)
 {
     this.Update(adapter, ctrl, null, null);
 }
Exemple #24
0
 public void UpdateGameFileViewSearch(IGameFileDataSourceAdapter adapter, GameFileViewControl ctrl, GameFileGetOptions options)
 {
     this.Update(adapter, ctrl, options, null);
 }