Esempio n. 1
0
        public UiDxViewport()
        {
            _grid = UiGridFactory.Create(2, 2);
            _grid.ColumnDefinitions[1].Width = GridLength.Auto;
            _grid.RowDefinitions[1].Height = GridLength.Auto;

            _verticalScrollBar = new ScrollBar {Orientation = Orientation.Vertical};
            {
                _verticalScrollBar.ValueChanged += OnVerticalScroll;
                _grid.AddUiElement(_verticalScrollBar, 0, 1);
            }

            _horizontalScrollBar = new ScrollBar {Orientation = Orientation.Horizontal};
            {
                _horizontalScrollBar.ValueChanged += OnHorizontalScroll;
                _grid.AddUiElement(_horizontalScrollBar, 1, 0);
            }

            DxControl = new UiDxControl();
            {
                DxControl.SizeChanged += OnDxControlSizeChanged;
                _grid.AddUiElement(DxControl, 0, 0);
            }

            VerticalAlignment = VerticalAlignment.Stretch;
            HorizontalAlignment = HorizontalAlignment.Stretch;

            Content = _grid;
        }
Esempio n. 2
0
        public UiGameFilePreview()
        {
            #region Construct

            Header = Lang.Dockable.GameFilePreview.Header;

            _grid = UiGridFactory.Create(1, 1);

            _textureViewer = new UiDxTextureViewer();
            _sound = new UiAudioPlayback();
            _ykd = new UiGameFilePreviewYkd();
            _ztr = new UiGameFilePreviewZtr();
            HideControls();

            _grid.AddUiElement(_textureViewer, 0, 0);
            _grid.AddUiElement(_sound, 0, 0);
            _grid.AddUiElement(_ykd, 0, 0);
            _grid.AddUiElement(_ztr, 0, 0);

            Content = _grid;

            #endregion

            InteractionService.SelectedLeafChanged += OnSelectedLeafChanged;
        }
Esempio n. 3
0
        public UiInputWindow(string watermark, string text)
        {
            #region Construct

            SizeToContent         = SizeToContent.WidthAndHeight;
            WindowStartupLocation = WindowStartupLocation.CenterScreen;
            WindowStyle           = WindowStyle.None;

            UiGrid root = UiGridFactory.Create(1, 2);
            {
                root.ColumnDefinitions[1].Width = GridLength.Auto;

                _textBox = UiWatermarkTextBoxFactory.Create(watermark, text);
                {
                    _textBox.Width  = 320;
                    _textBox.Margin = new Thickness(3);
                    root.AddUiElement(_textBox, 0, 0);
                }

                UiButton button = UiButtonFactory.Create("OK");
                {
                    button.Width  = 70;
                    button.Margin = new Thickness(3);
                    button.Click += OnOkButtonClick;
                    root.AddUiElement(button, 0, 1);
                }
            }
            Content = root;

            #endregion
        }
Esempio n. 4
0
        public UiDxViewport()
        {
            _grid = UiGridFactory.Create(2, 2);
            _grid.ColumnDefinitions[1].Width = GridLength.Auto;
            _grid.RowDefinitions[1].Height   = GridLength.Auto;

            _verticalScrollBar = new ScrollBar {
                Orientation = Orientation.Vertical
            };
            {
                _verticalScrollBar.ValueChanged += OnVerticalScroll;
                _grid.AddUiElement(_verticalScrollBar, 0, 1);
            }

            _horizontalScrollBar = new ScrollBar {
                Orientation = Orientation.Horizontal
            };
            {
                _horizontalScrollBar.ValueChanged += OnHorizontalScroll;
                _grid.AddUiElement(_horizontalScrollBar, 1, 0);
            }

            DxControl = new UiDxControl();
            {
                DxControl.SizeChanged += OnDxControlSizeChanged;
                _grid.AddUiElement(DxControl, 0, 0);
            }

            VerticalAlignment   = VerticalAlignment.Stretch;
            HorizontalAlignment = HorizontalAlignment.Stretch;

            Content = _grid;
        }
Esempio n. 5
0
        public UiGameFilePreview()
        {
            #region Construct

            Header = Lang.Dockable.GameFilePreview.Header;

            _grid = UiGridFactory.Create(1, 1);

            _textureViewer = new UiDxTextureViewer();
            _sound         = new UiAudioPlayback();
            _ykd           = new UiGameFilePreviewYkd();
            _ztr           = new UiGameFilePreviewZtr();
            HideControls();

            _grid.AddUiElement(_textureViewer, 0, 0);
            _grid.AddUiElement(_sound, 0, 0);
            _grid.AddUiElement(_ykd, 0, 0);
            _grid.AddUiElement(_ztr, 0, 0);

            Content = _grid;

            #endregion

            InteractionService.SelectedLeafChanged += OnSelectedLeafChanged;
        }
Esempio n. 6
0
        public UiMainWindow()
        {
            #region Construct

            Assembly        assembly = Assembly.GetEntryAssembly();
            FileVersionInfo fvi      = FileVersionInfo.GetVersionInfo(assembly.Location);
            Title = $"{fvi.ProductName} {fvi.FileVersion} {fvi.LegalCopyright}";

            Width  = 640;
            Height = 480;
            WindowStartupLocation = WindowStartupLocation.CenterScreen;
            WindowState           = WindowState.Maximized;

            UiGrid root = UiGridFactory.Create(2, 1);
            root.RowDefinitions[0].Height = GridLength.Auto;

            DockingManager dockingManager = new DockingManager();
            {
                root.AddUiElement(dockingManager, 1, 0);
                _layoutSerializer = new XmlLayoutSerializer(dockingManager);
                _layoutSerializer.LayoutSerializationCallback += OnLayoutDeserialized;
            }

            _mainMenu = UiMenuFactory.Create();
            {
                _mainMenuView = _mainMenu.AddChild(UiMenuItemFactory.Create("Вид"));
                {
                    foreach (UiMainDockableControl dockable in UiMainDockableControl.CreateKnownDockables(dockingManager))
                    {
                        _mainMenuView.AddChild(dockable.CreateMenuItem());
                    }
                }

                root.AddUiElement(_mainMenu, 0, 0);
            }

            Content = root;

            #endregion

            Loaded  += OnLoaded;
            Closing += OnClosing;
        }
Esempio n. 7
0
        public UiGameFileCommander()
        {
            #region Construct

            Header = Lang.Dockable.GameFileCommander.Header;

            _grid = UiGridFactory.Create(1, 3);
            {
                _grid.ColumnDefinitions[1].Width = GridLength.Auto;
                _grid.AddVerticalSplitter(1);

                _treeView = UiTreeViewFactory.Create();
                {
                    _treeView.ItemTemplate = CreateArchiveListingTemplate(true);
                    _treeView.ItemContainerStyle = CreateTreeViewItemContainerStyle();
                    _treeView.ContextMenu = CreateTreeViewContextMenu();
                    _treeView.SelectedItemChanged += OnTreeViewSelectedItemChanged;
                    _grid.AddUiElement(_treeView, 0, 0);
                }

                _listView = UiListViewFactory.Create();
                {
                    _listView.ItemTemplate = CreateArchiveListingTemplate(false);
                    _listView.ItemContainerStyle = CreateListViewItemContainerStyle();
                    _listView.SetValue(VirtualizingStackPanel.IsVirtualizingProperty, false);
                    _listView.KeyDown += OnListViewKeyDown;
                    //_listView.SetBinding(Selector.SelectedItemProperty, new Binding("ListViewSelectedItem") {Mode = BindingMode.OneWayToSource});
                    _listView.SelectionChanged += OnListViewSelectionChanged;
                    _listView.DataContext = this;
                    _grid.AddUiElement(_listView, 0, 2);
                }
            }

            Content = _grid;

            #endregion

            Loaded += OnLoaded;
        }
Esempio n. 8
0
        public UiGameFileCommander()
        {
            #region Construct

            Header = Lang.Dockable.GameFileCommander.Header;

            _grid = UiGridFactory.Create(1, 3);
            {
                _grid.ColumnDefinitions[1].Width = GridLength.Auto;
                _grid.AddVerticalSplitter(1);

                _treeView = UiTreeViewFactory.Create();
                {
                    _treeView.ItemTemplate         = CreateArchiveListingTemplate(true);
                    _treeView.ItemContainerStyle   = CreateTreeViewItemContainerStyle();
                    _treeView.ContextMenu          = CreateTreeViewContextMenu();
                    _treeView.SelectedItemChanged += OnTreeViewSelectedItemChanged;
                    _grid.AddUiElement(_treeView, 0, 0);
                }

                _listView = UiListViewFactory.Create();
                {
                    _listView.ItemTemplate       = CreateArchiveListingTemplate(false);
                    _listView.ItemContainerStyle = CreateListViewItemContainerStyle();
                    _listView.SetValue(VirtualizingStackPanel.IsVirtualizingProperty, false);
                    _listView.KeyDown += OnListViewKeyDown;
                    //_listView.SetBinding(Selector.SelectedItemProperty, new Binding("ListViewSelectedItem") {Mode = BindingMode.OneWayToSource});
                    _listView.SelectionChanged += OnListViewSelectionChanged;
                    _listView.DataContext       = this;
                    _grid.AddUiElement(_listView, 0, 2);
                }
            }

            Content = _grid;

            #endregion

            Loaded += OnLoaded;
        }
Esempio n. 9
0
        public static UiGrid Create(int rows, int cols)
        {
            Exceptions.CheckArgumentOutOfRangeException(rows, "rows", 1, 1024);
            Exceptions.CheckArgumentOutOfRangeException(cols, "cols", 1, 1024);
            UiGrid grid = new UiGrid();

            if (rows > 1)
            {
                while (rows-- > 0)
                {
                    grid.RowDefinitions.Add(new RowDefinition());
                }
            }
            if (cols > 1)
            {
                while (cols-- > 0)
                {
                    grid.ColumnDefinitions.Add(new ColumnDefinition());
                }
            }

            return(grid);
        }
Esempio n. 10
0
        public UiProgressWindow(string title, UiProgressUnits units = UiProgressUnits.Items)
        {
            _units = units;

            #region Construct

            Height = 72;
            Width  = 320;
            WindowStartupLocation = WindowStartupLocation.CenterScreen;
            WindowStyle           = WindowStyle.None;

            UiGrid root = UiGridFactory.Create(3, 1);
            root.SetRowsHeight(GridLength.Auto);
            root.Margin = new Thickness(5);

            UiTextBlock titleTextBlock = UiTextBlockFactory.Create(title);
            {
                titleTextBlock.VerticalAlignment   = VerticalAlignment.Center;
                titleTextBlock.HorizontalAlignment = HorizontalAlignment.Center;
                root.AddUiElement(titleTextBlock, 0, 0);
            }

            _progressBar = UiProgressBarFactory.Create();
            {
                root.AddUiElement(_progressBar, 1, 0);
            }

            _progressTextBlock = UiTextBlockFactory.Create("100%");
            {
                _progressTextBlock.VerticalAlignment   = VerticalAlignment.Center;
                _progressTextBlock.HorizontalAlignment = HorizontalAlignment.Center;
                root.AddUiElement(_progressTextBlock, 1, 0);
            }

            _elapsedTextBlock = UiTextBlockFactory.Create(Lang.Measurement.Elapsed + ": 00:00");
            {
                _elapsedTextBlock.HorizontalAlignment = HorizontalAlignment.Left;
                root.AddUiElement(_elapsedTextBlock, 2, 0);
            }

            _processedTextBlock = UiTextBlockFactory.Create("0 / 0");
            {
                _processedTextBlock.HorizontalAlignment = HorizontalAlignment.Center;
                root.AddUiElement(_processedTextBlock, 2, 0);
            }

            _remainingTextBlock = UiTextBlockFactory.Create(Lang.Measurement.Remaining + ": 00:00");
            {
                _remainingTextBlock.HorizontalAlignment = HorizontalAlignment.Right;
                root.AddUiElement(_remainingTextBlock, 2, 0);
            }

            Content = root;

            #endregion

            Loaded  += OnLoaded;
            Closing += OnClosing;

            _timer          = new Timer(500);
            _timer.Elapsed += OnTimer;
        }
        public UiGameFileCommanderSettingsWindow(bool isExtracting)
        {
            #region Construct

            SizeToContent = SizeToContent.WidthAndHeight;
            WindowStartupLocation = WindowStartupLocation.CenterScreen;
            WindowStyle = WindowStyle.None;

            UiGrid root = UiGridFactory.Create(3, 1);
            {
                Thickness margin = new Thickness(3);

                UiStackPanel maskPanel = UiStackPanelFactory.Create(Orientation.Horizontal);
                {
                    UiTextBlock maskLabel = UiTextBlockFactory.Create("Маска: ");
                    {
                        maskLabel.Margin = margin;
                        maskLabel.VerticalAlignment = VerticalAlignment.Center;
                        maskPanel.AddUiElement(maskLabel);
                    }

                    _wildcardBox = UiTextBoxFactory.Create("*");
                    {
                        _wildcardBox.Width = 300;
                        _wildcardBox.Margin = margin;
                        maskPanel.AddUiElement(_wildcardBox);
                    }

                    root.AddUiElement(maskPanel, 0, 0);
                }

                UiStackPanel settingsPanel = UiStackPanelFactory.Create(Orientation.Horizontal);
                {
                    if (!isExtracting)
                    {
                        _compressBox = UiCheckBoxFactory.Create("Сжать", false);
                        {
                            _compressBox.Margin = margin;
                            _compressBox.IsThreeState = true;
                            _compressBox.IsChecked = null;
                            settingsPanel.AddUiElement(_compressBox);
                        }
                    }

                    _convertBox = UiCheckBoxFactory.Create("Конвертировать", false);
                    {
                        _convertBox.Margin = margin;
                        _convertBox.IsThreeState = true;
                        _convertBox.IsChecked = null;
                        settingsPanel.AddUiElement(_convertBox);
                    }

                    root.AddUiElement(settingsPanel, 1, 0);
                }

                UiStackPanel buttonsPanel = UiStackPanelFactory.Create(Orientation.Horizontal);
                {
                    buttonsPanel.HorizontalAlignment = HorizontalAlignment.Right;

                    UiButton okButton = UiButtonFactory.Create("OK");
                    {
                        okButton.Width = 100;
                        okButton.Margin = margin;
                        okButton.Click += OnOkButtonClick;
                        buttonsPanel.AddUiElement(okButton);
                    }

                    UiButton cancelButton = UiButtonFactory.Create("Отмена");
                    {
                        cancelButton.Width = 100;
                        cancelButton.Margin = margin;
                        cancelButton.Click += OnCancelButtonClick;
                        buttonsPanel.AddUiElement(cancelButton);
                    }

                    root.AddUiElement(buttonsPanel, 2, 0);
                }
            }

            Content = root;

            #endregion
        }