Exemple #1
0
        public void ReadXML(XmlReader reader)
        {
            reader.ReadStartElement();

            while (reader.NodeType == XmlNodeType.Element)
            {
                switch (reader.Name)
                {
                case "MaxRecentFiles":
                    maxRecentFiles = reader.ReadElementContentAsInt();
                    break;

                case "RecentFiles":
                    ParseRecentFiles(reader, recentFiles, "RecentFile");
                    break;

                case "MaxRecentCapturedFiles":
                    maxRecentCapturedFiles = reader.ReadElementContentAsInt();
                    break;

                case "RecentCapturedFiles":
                    ParseRecentFiles(reader, recentCapturedFiles, "RecentCapturedFile");
                    break;

                case "Shortcuts":
                    ParseShortcuts(reader);
                    break;

                case "ThumbnailSize":
                    explorerThumbsSize = (ExplorerThumbSize)Enum.Parse(typeof(ExplorerThumbSize), reader.ReadElementContentAsString());
                    break;

                case "ExplorerFilesSplitterDistance":
                    explorerFilesSplitterDistance = reader.ReadElementContentAsInt();
                    break;

                case "ShortcutsFilesSplitterDistance":
                    shortcutsFilesSplitterDistance = reader.ReadElementContentAsInt();
                    break;

                case "ActiveTab":
                    activeTab = (ActiveFileBrowserTab)Enum.Parse(typeof(ActiveFileBrowserTab), reader.ReadElementContentAsString());
                    break;

                case "FilePropertyVisibility":
                    filePropertyVisibility = FilePropertyVisibility.FromXML(reader);
                    break;

                case "LastReplayFolder":
                    lastReplayFolder = reader.ReadElementContentAsString();
                    break;

                default:
                    reader.ReadOuterXml();
                    break;
                }
            }

            reader.ReadEndElement();
        }
Exemple #2
0
 public static void RaiseExplorerTabChanged(object sender, ActiveFileBrowserTab tab)
 {
     if (ExplorerTabChanged != null)
     {
         ExplorerTabChanged(sender, new ExplorerTabEventArgs(tab));
     }
 }
Exemple #3
0
        private void TabControlSelected_IndexChanged(object sender, EventArgs e)
        {
            // Active tab changed.
            // We don't save to file now as this is not a critical data to loose.
            activeTab = (ActiveFileBrowserTab)tabControl.SelectedIndex;
            PreferencesManager.FileExplorerPreferences.ActiveTab = activeTab;

            if (programmaticTabChange)
            {
                programmaticTabChange = false;
            }
            else
            {
                NotificationCenter.RaiseExplorerTabChanged(this, activeTab);
            }

            DoRefreshFileList(true);
        }
        public FileBrowserUserInterface()
        {
            InitializeComponent();

            lvCameras.SmallImageList   = cameraIcons;
            tvCaptureHistory.ImageList = cameraIcons;
            cameraIcons.Images.Add("historyEntryDay", Properties.Resources.calendar_view_day);
            cameraIcons.Images.Add("historyEntryMonth", Properties.Resources.calendar_view_month);
            cameraIcons.Images.Add("unknownCamera", Properties.Resources.bulletfile);

            btnAddShortcut.Parent    = lblFavFolders;
            btnDeleteShortcut.Parent = lblFavFolders;

            // Drag Drop handling.
            lvExplorer.ItemDrag  += lv_ItemDrag;
            lvShortcuts.ItemDrag += lv_ItemDrag;
            etExplorer.AllowDrop  = false;
            etShortcuts.AllowDrop = false;

            lvCameras.ItemDrag += lvCameras_ItemDrag;

            BuildContextMenu();

            NotificationCenter.ExplorerTabChanged  += NotificationCenter_ExplorerTabChangeAsked;
            NotificationCenter.RefreshFileExplorer += NotificationCenter_RefreshFileExplorer;
            NotificationCenter.FileSelected        += NotificationCenter_FileSelected;
            NotificationCenter.FileOpened          += NotificationCenter_FileOpened;

            // Reload stored persistent information.
            ReloadShortcuts();
            ReloadCaptureHistory(true);

            InitializeFileWatcher();

            // Reload last tab from prefs.
            // We don't reload the splitters here, because we are not at full size yet and they are anchored.
            tabControl.SelectedIndex = (int)PreferencesManager.FileExplorerPreferences.ActiveTab;
            activeTab = PreferencesManager.FileExplorerPreferences.ActiveTab;

            Application.Idle += new EventHandler(this.IdleDetector);
            this.Hotkeys      = HotkeySettingsManager.LoadHotkeys("FileExplorer");
        }
Exemple #5
0
        private ThumbnailViewerContent Convert(ActiveFileBrowserTab tab)
        {
            ThumbnailViewerContent content = ThumbnailViewerContent.Files;

            switch (tab)
            {
            case ActiveFileBrowserTab.Explorer:
                content = ThumbnailViewerContent.Files;
                break;

            case ActiveFileBrowserTab.Shortcuts:
                content = ThumbnailViewerContent.Shortcuts;
                break;

            case ActiveFileBrowserTab.Cameras:
                content = ThumbnailViewerContent.Cameras;
                break;
            }

            return(content);
        }
Exemple #6
0
        private ActiveFileBrowserTab Convert(ThumbnailViewerContent content)
        {
            ActiveFileBrowserTab tab = ActiveFileBrowserTab.Explorer;

            switch (content)
            {
            case ThumbnailViewerContent.Files:
                tab = ActiveFileBrowserTab.Explorer;
                break;

            case ThumbnailViewerContent.Shortcuts:
                tab = ActiveFileBrowserTab.Shortcuts;
                break;

            case ThumbnailViewerContent.Cameras:
                tab = ActiveFileBrowserTab.Cameras;
                break;
            }

            return(tab);
        }
Exemple #7
0
        private void ParseConfigFile(string filePath)
        {
            // Fill the local variables with infos found in the XML file.
            XmlReader PreferencesReader = new XmlTextReader(filePath);

            if (PreferencesReader != null)
            {
                try
                {
                    while (PreferencesReader.Read())
                    {
                        if ((PreferencesReader.IsStartElement()) && (PreferencesReader.Name == "KinoveaPreferences"))
                        {
                            while (PreferencesReader.Read())
                            {
                                if (PreferencesReader.IsStartElement())
                                {
                                    switch (PreferencesReader.Name)
                                    {
                                    case "HistoryCount":
                                        m_iFilesToSave = int.Parse(PreferencesReader.ReadString());
                                        break;

                                    case "Language":
                                        m_UICultureName = PreferencesReader.ReadString();
                                        break;

                                    case "TimeCodeFormat":
                                        m_TimeCodeFormat = ParseTimeCodeFormat(PreferencesReader.ReadString());
                                        break;

                                    case "SpeedUnit":
                                        m_SpeedUnit = ParseSpeedUnit(PreferencesReader.ReadString());
                                        break;

                                    case "ImageAspectRatio":
                                        m_AspectRatio = ParseImageAspectRatio(PreferencesReader.ReadString());
                                        break;

                                    case "DeinterlaceByDefault":
                                        m_bDeinterlaceByDefault = bool.Parse(PreferencesReader.ReadString());
                                        break;

                                    case "WorkingZoneSeconds":
                                        m_iWorkingZoneSeconds = int.Parse(PreferencesReader.ReadString());
                                        break;

                                    case "WorkingZoneMemory":
                                        m_iWorkingZoneMemory = int.Parse(PreferencesReader.ReadString());
                                        break;

                                    case "InfosFading":
                                        //m_DefaultFading.ReadXml(PreferencesReader);
                                        break;

                                    case "MaxFading":
                                        m_iMaxFading = int.Parse(PreferencesReader.ReadString());
                                        break;

                                    case "DrawOnPlay":
                                        m_bDrawOnPlay = bool.Parse(PreferencesReader.ReadString());
                                        break;

                                    case "ExplorerThumbnailsSize":
                                        m_iExplorerThumbsSize = (ExplorerThumbSizes)ExplorerThumbSizes.Parse(m_iExplorerThumbsSize.GetType(), PreferencesReader.ReadString());
                                        break;

                                    case "ExplorerVisible":
                                        m_bIsExplorerVisible = bool.Parse(PreferencesReader.ReadString());
                                        break;

                                    case "ExplorerSplitterDistance":
                                        m_iExplorerSplitterDistance = int.Parse(PreferencesReader.ReadString());
                                        break;

                                    case "ActiveFileBrowserTab":
                                        m_ActiveFileBrowserTab = (ActiveFileBrowserTab)ActiveFileBrowserTab.Parse(m_ActiveFileBrowserTab.GetType(), PreferencesReader.ReadString());
                                        break;

                                    case "ExplorerFilesSplitterDistance":
                                        m_iExplorerFilesSplitterDistance = int.Parse(PreferencesReader.ReadString());
                                        break;

                                    case "ShortcutsFilesSplitterDistance":
                                        m_iShortcutsFilesSplitterDistance = int.Parse(PreferencesReader.ReadString());
                                        break;

                                    case "Shortcuts":
                                        ParseShortcuts(PreferencesReader);
                                        break;

                                    case "RecentColors":
                                        ParseRecentColors(PreferencesReader);
                                        break;

                                    case "CaptureImageDirectory":
                                        m_CaptureImageDirectory = PreferencesReader.ReadString();
                                        break;

                                    case "CaptureImageFile":
                                        m_CaptureImageFile = PreferencesReader.ReadString();
                                        break;

                                    case "CaptureVideoDirectory":
                                        m_CaptureVideoDirectory = PreferencesReader.ReadString();
                                        break;

                                    case "CaptureVideoFile":
                                        m_CaptureVideoFile = PreferencesReader.ReadString();
                                        break;

                                    case "CaptureImageFormat":
                                        m_CaptureImageFormat = ParseImageFormat(PreferencesReader.ReadString());
                                        break;

                                    case "CaptureVideoFormat":
                                        m_CaptureVideoFormat = ParseVideoFormat(PreferencesReader.ReadString());
                                        break;

                                    case "CaptureUsePattern":
                                        m_bCaptureUsePattern = bool.Parse(PreferencesReader.ReadString());
                                        break;

                                    case "CapturePattern":
                                        m_CapturePattern = PreferencesReader.ReadString();
                                        break;

                                    case "CaptureImageCounter":
                                        m_iCaptureImageCounter = long.Parse(PreferencesReader.ReadString());
                                        break;

                                    case "CaptureVideoCounter":
                                        m_iCaptureVideoCounter = long.Parse(PreferencesReader.ReadString());
                                        break;

                                    case "CaptureMemoryBuffer":
                                        m_iCaptureMemoryBuffer = int.Parse(PreferencesReader.ReadString());
                                        break;

                                    case "DeviceConfigurations":
                                        ParseDeviceConfigurations(PreferencesReader);
                                        break;

                                    case "NetworkCameraUrl":
                                        m_NetworkCameraUrl = PreferencesReader.ReadString();
                                        break;

                                    case "NetworkCameraFormat":
                                        m_NetworkCameraFormat = ParseCameraFormat(PreferencesReader.ReadString());
                                        break;

                                    case "RecentNetworkCameras":
                                        ParseRecentCameras(PreferencesReader);
                                        break;

                                    default:
                                        // Preference from a newer file format...
                                        // We don't have a holder variable for it.
                                        break;
                                    }
                                }
                                else if (PreferencesReader.Name == "KinoveaPreferences")
                                {
                                    break;
                                }
                                else
                                {
                                    // Fermeture d'un tag interne.
                                }
                            }
                        }
                    }
                }
                catch (Exception)
                {
                    log.Error("Error happenned while parsing preferences. We'll keep the default values.");
                }
                finally
                {
                    PreferencesReader.Close();
                }
            }
        }
Exemple #8
0
 public ExplorerTabEventArgs(ActiveFileBrowserTab tab)
 {
     this.Tab = tab;
 }
 private void ExplorerTab_Changed(ActiveFileBrowserTab newTab)
 {
     SwitchContent(Convert(newTab));
 }