Beispiel #1
0
        private void frmCR2WDocument_Load(object sender, EventArgs e)
        {
            string config = Path.Combine(Path.GetDirectoryName(Configuration.ConfigurationPath), "cr2wdocument_layout.xml");

            if (System.IO.File.Exists(config))
            {
                try
                {
                    FormPanel.LoadFromXml(config, m_deserializeDockContent);
                    // if anything went wrong
                    if (FormPanel.DockWindows.Count < 2)
                    {
                        chunkList.Show(FormPanel, DockState.Document);
                        propertyWindow.Show(FormPanel, DockState.DockRight);
                    }
                }
                catch (Exception exception)
                {
                    chunkList.Show(FormPanel, DockState.Document);
                    propertyWindow.Show(FormPanel, DockState.DockRight);


                    Console.WriteLine(exception);
                }
            }
            else
            {
                chunkList.Show(FormPanel, DockState.Document);
                propertyWindow.Show(FormPanel, DockState.DockRight);
            }

            //propertyWindow .RequestChunkViewUpdate += ChunkWindowRequestChunkViewUpdate;
            propertyWindow.RequestBytesOpen += PropertyWindowOnRequestBytesOpen;



            chunkList.Activate();

            if (File.Embedded.Count > 0)
            {
                embeddedFiles = new frmEmbeddedFiles
                {
                    File      = File,
                    DockAreas = DockAreas.DockLeft
                };
                embeddedFiles.Show(FormPanel, DockState.DockLeftAutoHide);

                embeddedFiles.RequestFileOpen += EmbeddedWindow_OnRequestOpen;
            }
        }
Beispiel #2
0
        public frmCR2WDocument()
        {
            InitializeComponent();

            try
            {
                dockPanel.LoadFromXml(
                    Path.Combine(Path.GetDirectoryName(Configuration.ConfigurationPath), "cr2wdocument_layout.xml"),
                    DeserializeDockContent);
            }
            catch { }
            ApplyCustomTheme();

            chunkList = new frmChunkList
            {
                File      = File,
                DockAreas = DockAreas.Document
            };
            chunkList.Show(dockPanel, DockState.Document);
            chunkList.OnSelectChunk += frmCR2WDocument_OnSelectChunk;
            propertyWindow           = new frmChunkProperties();
            propertyWindow.Show(dockPanel, DockState.DockBottom);
            propertyWindow.OnItemsChanged += PropertyWindow_OnItemsChanged;

            chunkList.Activate();
        }
Beispiel #3
0
        private void ViewModel_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            switch (e.PropertyName)
            {
            case nameof(vm.File):
                chunkList.UpdateList();
                break;

            case nameof(vm.SelectedChunks):
                if (propertyWindow == null || propertyWindow.IsDisposed)
                {
                    propertyWindow = new frmChunkProperties(vm);
                    propertyWindow.Show(FormPanel, DockState.DockRight);
                }

                if (vm.SelectedChunks.Count > 0)
                {
                    if (vm.SelectedChunks.First().data is CBitmapTexture xbm)
                    {
                        if (ImageViewer == null || ImageViewer.IsDisposed)
                        {
                            ImageViewer = new frmImagePreview();
                            ImageViewer.Show(FormPanel, DockState.Document);
                        }

                        ImageViewer.SetImage(vm.SelectedChunks.First());
                    }
                }

                break;
            }
        }
Beispiel #4
0
        public void frmCR2WDocument_OnSelectChunk(object sender, SelectChunkArgs e)
        {
            if (propertyWindow == null || propertyWindow.IsDisposed)
            {
                propertyWindow = new frmChunkProperties();
                propertyWindow.Show(dockPanel, DockState.DockBottom);
            }

            propertyWindow.Chunk = e.Chunk;
        }