private void mnuCheckForUpdatesOnClick(object sender, EventArgs e) { NotificationCenter.RaiseStopPlayback(this); // Download the update configuration file from the webserver. HelpIndex hiRemote = new HelpIndex(Software.RemoteHelpIndex); if (!hiRemote.LoadSuccess) { MessageBox.Show(UpdaterLang.Updater_InternetError, UpdaterLang.Updater_Title, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } // Check if we are up to date. bool testUpdate = false; ThreePartsVersion currentVersion = new ThreePartsVersion(Software.Version); if (hiRemote.AppInfos.Version > currentVersion || testUpdate) { // We are not up to date, display the full dialog. // The dialog is responsible for displaying the download success msg box. UpdateDialog2 ud = new UpdateDialog2(hiRemote); ud.ShowDialog(); ud.Dispose(); } else { MessageBox.Show(UpdaterLang.Updater_UpToDate, UpdaterLang.Updater_Title, MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public UpdateDialog2(HelpIndex hiRemote) { this.hiRemote = hiRemote; currentVersion = new ThreePartsVersion(Software.Version); InitializeComponent(); InitDialog(); }
private void mnuCheckForUpdatesOnClick(object sender, EventArgs e) { // Stop playing if needed. DelegatesPool dp = DelegatesPool.Instance(); if (dp.StopPlaying != null) { dp.StopPlaying(); } // Download the update configuration file from the webserver. HelpIndex hiRemote; if (PreferencesManager.ExperimentalRelease) { hiRemote = new HelpIndex("http://www.kinovea.org/setup/updatebeta.xml"); } else { hiRemote = new HelpIndex("http://www.kinovea.org/setup/update.xml"); } if (hiRemote.LoadSuccess) { if (dp.DeactivateKeyboardHandler != null) { dp.DeactivateKeyboardHandler(); } // Check if we are up to date. ThreePartsVersion currentVersion = new ThreePartsVersion(PreferencesManager.ReleaseVersion); if (hiRemote.AppInfos.Version > currentVersion) { // We are not up to date, display the full dialog. // The dialog is responsible for displaying the download success msg box. UpdateDialog2 ud = new UpdateDialog2(hiRemote); ud.ShowDialog(); ud.Dispose(); } else { // We are up to date, display a simple confirmation box. MessageBox.Show(UpdaterLang.Updater_UpToDate, UpdaterLang.Updater_Title, MessageBoxButtons.OK, MessageBoxIcon.Information); } if (dp.ActivateKeyboardHandler != null) { dp.ActivateKeyboardHandler(); } } else { // Remote connection failed, we are probably firewalled. MessageBox.Show(resManager.GetString("Updater_InternetError", Thread.CurrentThread.CurrentUICulture), resManager.GetString("Updater_Title", Thread.CurrentThread.CurrentUICulture), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
public HelpVideosDialog(ResourceManager resManager, HelpIndex helpIndex, ScreenManagerKernel smk) { InitializeComponent(); m_ResourceManager = resManager; m_HelpIndex = helpIndex; m_ScreenManagerKernel = smk; InitializeInterface(); }
private string GetLocalizedHelpResource(bool _manual) { // Find the local file path of a help resource (manual or help video) according to what is saved in the help index. string resourceUri = ""; // Load the help file system. HelpIndex hiLocal = new HelpIndex(Application.StartupPath + "\\" + PreferencesManager.ResourceManager.GetString("URILocalHelpIndex")); if (hiLocal.LoadSuccess) { // Loop into the file to find the required resource in the matching locale, or fallback to english. string EnglishUri = ""; bool bLocaleFound = false; bool bEnglishFound = false; int i = 0; CultureInfo ci = PreferencesManager.Instance().GetSupportedCulture(); string neutral = ci.IsNeutralCulture ? ci.Name : ci.Parent.Name; // Look for a matching locale, or English. int iTotalResource = _manual ? hiLocal.UserGuides.Count : hiLocal.HelpVideos.Count; while (!bLocaleFound && i < iTotalResource) { HelpItem hi = _manual ? hiLocal.UserGuides[i] : hiLocal.HelpVideos[i]; if (hi.Language == neutral) { bLocaleFound = true; resourceUri = hi.FileLocation; break; } if (hi.Language == "en") { bEnglishFound = true; EnglishUri = hi.FileLocation; } i++; } if (!bLocaleFound && bEnglishFound) { resourceUri = EnglishUri; } } else { log.Error("Cannot find the xml help index."); } return(resourceUri); }
private string GetLocalizedHelpResource(bool manual) { // Find the local file path of a help resource (manual or help video) according to what is saved in the help index. string resourceUri = ""; // Load the help file system. HelpIndex hiLocal = new HelpIndex(Software.LocalHelpIndex); if (!hiLocal.LoadSuccess) { log.Error("Cannot find the xml help index."); return(""); } // Loop into the file to find the required resource in the matching locale, or fallback to english. string englishUri = ""; bool localeFound = false; bool englishFound = false; int i = 0; string cultureName = LanguageManager.GetCurrentCultureName(); // Look for a matching locale, or English. int totalResource = manual ? hiLocal.UserGuides.Count : hiLocal.HelpVideos.Count; while (!localeFound && i < totalResource) { HelpItem hi = manual ? hiLocal.UserGuides[i] : hiLocal.HelpVideos[i]; if (hi.Language == cultureName) { localeFound = true; resourceUri = hi.FileLocation; break; } if (hi.Language == "en") { englishFound = true; englishUri = hi.FileLocation; } i++; } if (!localeFound && englishFound) { resourceUri = englishUri; } return(resourceUri); }
public UpdateDialog2(HelpIndex hiRemote) { this.hiRemote = hiRemote; currentVersion = new ThreePartsVersion(Software.Version); InitializeComponent(); downloader.DownloadComplete += new EventHandler(downloader_DownloadedComplete); downloader.ProgressChanged += new DownloadProgressHandler(downloader_ProgressChanged); callbackUpdateProgressBar = new CallbackUpdateProgressBar(UpdateProgressBar); callbackDownloadComplete = new CallbackDownloadComplete(DownloadComplete); InitDialog(); }
public UpdateDialog2(HelpIndex _hiRemote) { m_hiRemote = _hiRemote; m_currentVersion = new ThreePartsVersion(PreferencesManager.ReleaseVersion); InitializeComponent(); m_Downloader.DownloadComplete += new EventHandler(downloader_DownloadedComplete); m_Downloader.ProgressChanged += new DownloadProgressHandler(downloader_ProgressChanged); m_CallbackUpdateProgressBar = new CallbackUpdateProgressBar(UpdateProgressBar); m_CallbackDownloadComplete = new CallbackDownloadComplete(DownloadComplete); InitDialog(); }
private int m_HelpItemListId; // List owner of the currently downloaded HelpItem. (0:Manuals, 1:Videos) #endregion #region Constructors public UpdateDialog(HelpIndex _hiRemote) { m_hiRemote = _hiRemote; InitializeComponent(); m_SourceItemList = new List <HelpItem>(); m_CurrentSourceItemIndex = 0; m_TargetFolder = ""; m_HelpItemListId = 0; m_CallbackUpdateProgressBar = new CallbackUpdateProgressBar(UpdateProgressBar); m_CallbackDownloadComplete = new CallbackDownloadComplete(DownloadComplete); m_CallbackMultipleDownloadComplete = new CallbackMultipleDownloadComplete(MultipleDownloadComplete); // Chaînes statiques et dynamiques SetupPages(_hiRemote); // Organisation des panels InitPages(); }
private void AddStandardUi(ThemeConfig theme) { var extensionArea = new LeftClipFlowLayoutWidget() { BackgroundColor = theme.TabBarBackground, VAnchor = VAnchor.Stretch, Padding = new BorderDouble(left: 8) }; SearchPanel searchPanel = null; bool searchPanelOpenOnMouseDown = false; var searchButton = theme.CreateSearchButton(); searchButton.Name = "App Search Button"; searchButton.MouseDown += (s, e) => { searchPanelOpenOnMouseDown = searchPanel != null; }; searchButton.Click += SearchButton_Click; extensionArea.AddChild(searchButton); async void SearchButton_Click(object sender, EventArgs e) { if (searchPanel == null && !searchPanelOpenOnMouseDown) { void ShowSearchPanel() { searchPanel = new SearchPanel(this.TabControl, searchButton, theme); searchPanel.Closed += SearchPanel_Closed; var systemWindow = this.Parents <SystemWindow>().FirstOrDefault(); systemWindow.ShowRightSplitPopup( new MatePoint(searchButton), new MatePoint(searchPanel), borderWidth: 0); } if (HelpIndex.IndexExists) { ShowSearchPanel(); } else { searchButton.Enabled = false; try { // Show popover var popover = new Popover(ArrowDirection.Up, 7, 5, 0) { TagColor = theme.AccentMimimalOverlay }; popover.AddChild(new TextWidget("Preparing help".Localize() + "...", pointSize: theme.DefaultFontSize - 1, textColor: theme.TextColor)); popover.ArrowOffset = (int)(popover.Width - (searchButton.Width / 2)); this.Parents <SystemWindow>().FirstOrDefault().ShowPopover( new MatePoint(searchButton) { Mate = new MateOptions(MateEdge.Right, MateEdge.Bottom), AltMate = new MateOptions(MateEdge.Right, MateEdge.Bottom), Offset = new RectangleDouble(12, 0, 12, 0) }, new MatePoint(popover) { Mate = new MateOptions(MateEdge.Right, MateEdge.Top), AltMate = new MateOptions(MateEdge.Left, MateEdge.Bottom) }); await Task.Run(async() => { // Start index generation await HelpIndex.RebuildIndex(); UiThread.RunOnIdle(() => { // Close popover popover.Close(); // Continue to original task ShowSearchPanel(); }); }); } catch { } searchButton.Enabled = true; } } else { searchPanel?.CloseOnIdle(); searchPanelOpenOnMouseDown = false; } } void SearchPanel_Closed(object sender, EventArgs e) { // Unregister searchPanel.Closed -= SearchPanel_Closed; // Release searchPanel = null; } tabControl = new ChromeTabs(extensionArea, theme) { VAnchor = VAnchor.Stretch, HAnchor = HAnchor.Stretch, BackgroundColor = theme.BackgroundColor, BorderColor = theme.MinimalShade, Border = new BorderDouble(left: 1), }; tabControl.PlusClicked += (s, e) => UiThread.RunOnIdle(() => { this.CreatePartTab().ConfigureAwait(false); }); // Force the ActionArea to be as high as ButtonHeight tabControl.TabBar.ActionArea.MinimumSize = new Vector2(0, theme.ButtonHeight); tabControl.TabBar.BackgroundColor = theme.TabBarBackground; tabControl.TabBar.BorderColor = theme.BackgroundColor; // Force common padding into top region tabControl.TabBar.Padding = theme.TabbarPadding.Clone(top: theme.TabbarPadding.Top * 2, bottom: 0); if (Application.EnableNetworkTraffic) { // add in the update available button updateAvailableButton = new LinkLabel("Update Available".Localize(), theme) { Visible = false, Name = "Update Available Link", ToolTipText = "There is a new update available for download".Localize(), VAnchor = VAnchor.Center, Margin = new BorderDouble(10, 0) }; // Register listeners UserSettings.Instance.SettingChanged += SetLinkButtonsVisibility; SetLinkButtonsVisibility(this, null); updateAvailableButton.Click += (s, e) => { UpdateControlData.Instance.CheckForUpdate(); DialogWindow.Show <CheckForUpdatesPage>(); }; tabControl.TabBar.ActionArea.AddChild(updateAvailableButton); UpdateControlData.Instance.UpdateStatusChanged.RegisterEvent((s, e) => { SetLinkButtonsVisibility(s, new StringEventArgs("Unknown")); }, ref unregisterEvents); } this.AddChild(tabControl); ApplicationController.Instance.NotifyPrintersTabRightElement(extensionArea); // Store tab tabControl.AddTab( new ChromeTab("Store", "Store".Localize(), tabControl, new StoreTabPage(theme), theme, hasClose: false) { MinimumSize = new Vector2(0, theme.TabButtonHeight), Name = "Store Tab", Padding = new BorderDouble(15, 0), }); // Library tab var libraryWidget = new LibraryWidget(this, theme) { BackgroundColor = theme.BackgroundColor }; tabControl.AddTab( new ChromeTab("Library", "Library".Localize(), tabControl, libraryWidget, theme, hasClose: false) { MinimumSize = new Vector2(0, theme.TabButtonHeight), Name = "Library Tab", Padding = new BorderDouble(15, 0), }); // Hardware tab tabControl.AddTab( new ChromeTab( "Hardware", "Hardware".Localize(), tabControl, new HardwareTabPage(theme) { BackgroundColor = theme.BackgroundColor }, theme, hasClose: false) { MinimumSize = new Vector2(0, theme.TabButtonHeight), Name = "Hardware Tab", Padding = new BorderDouble(15, 0), }); SetInitialTab(); var brandMenu = new BrandMenuButton(theme) { HAnchor = HAnchor.Fit, VAnchor = VAnchor.Fit, BackgroundColor = theme.TabBarBackground, Padding = theme.TabbarPadding.Clone(right: theme.DefaultContainerPadding) }; tabControl.TabBar.ActionArea.AddChild(brandMenu, 0); // Restore active workspace tabs foreach (var workspace in ApplicationController.Instance.Workspaces) { ChromeTab newTab; // Create and switch to new printer tab if (workspace.Printer?.Settings.PrinterSelected == true) { newTab = this.CreatePrinterTab(workspace, theme); } else { newTab = this.CreatePartTab(workspace); } if (newTab.Key == ApplicationController.Instance.MainTabKey) { tabControl.ActiveTab = newTab; } tabControl.RefreshTabPointers(); } statusBar = new Toolbar(theme) { HAnchor = HAnchor.Stretch, VAnchor = VAnchor.Absolute, Padding = 1, Height = 22, BackgroundColor = theme.BackgroundColor, Border = new BorderDouble(top: 1), BorderColor = theme.BorderColor20, }; this.AddChild(statusBar); statusBar.ActionArea.VAnchor = VAnchor.Stretch; tasksContainer = new FlowLayoutWidget(FlowDirection.LeftToRight) { HAnchor = HAnchor.Fit, VAnchor = VAnchor.Stretch, BackgroundColor = theme.MinimalShade, Name = "runningTasksPanel" }; statusBar.AddChild(tasksContainer); stretchStatusPanel = new GuiWidget() { HAnchor = HAnchor.Stretch, VAnchor = VAnchor.Stretch, Padding = new BorderDouble(right: 3), Margin = new BorderDouble(right: 2, top: 1, bottom: 1), Border = new BorderDouble(1), BackgroundColor = theme.MinimalShade.WithAlpha(10), BorderColor = theme.SlightShade, Width = 200 }; statusBar.AddChild(stretchStatusPanel); var panelBackgroundColor = theme.MinimalShade.WithAlpha(10); statusBar.AddChild( this.CreateThemeStatusPanel(theme, panelBackgroundColor)); statusBar.AddChild( this.CreateNetworkStatusPanel(theme)); this.RenderRunningTasks(theme, ApplicationController.Instance.Tasks); }
public SearchPanel(ChromeTabs tabControl, GuiWidget searchButton, ThemeConfig theme) : base(theme, GrabBarSide.Left) { this.HAnchor = HAnchor.Absolute; this.VAnchor = VAnchor.Absolute; this.Width = 500; this.Height = 200; this.BackgroundColor = theme.SectionBackgroundColor; this.tabControl = tabControl; this.searchButton = searchButton; searchButton.BackgroundColor = theme.SectionBackgroundColor; GuiWidget searchResults = null; var scrollable = new ScrollableWidget(true) { HAnchor = HAnchor.Stretch, VAnchor = VAnchor.Stretch }; searchBox = new TextEditWithInlineCancel(theme) { HAnchor = HAnchor.Stretch, VAnchor = VAnchor.Fit, Margin = new BorderDouble(5, 8, 5, 5) }; searchBox.TextEditWidget.ActualTextEditWidget.EnterPressed += async(s2, e2) => { searchResults.CloseChildren(); searchResults.AddChild( new TextWidget("Searching".Localize() + "...", pointSize: theme.DefaultFontSize, textColor: theme.TextColor) { Margin = 10 }); this.Invalidate(); var searchHits = await Task.Run(() => { return(HelpIndex.Search(searchBox.TextEditWidget.Text)); }); searchResults.CloseChildren(); foreach (var searchResult in searchHits) { var resultsRow = new HelpSearchResultRow(searchResult, theme); resultsRow.Click += this.ResultsRow_Click; searchResults.AddChild(resultsRow); } if (searchResults.Children.Count == 0) { searchResults.AddChild(new SettingsRow("No results found".Localize(), null, theme, StaticData.Instance.LoadIcon("StatusInfoTip_16x.png", 16, 16).SetPreMultiply())); } // Add top border to first child if (searchResults.Children.FirstOrDefault() is GuiWidget firstChild) { searchResults.BorderColor = firstChild.BorderColor; searchResults.Border = new BorderDouble(top: 1); // firstChild.Border = firstChild.Border.Clone(top: 1); - doesn't work for some reason, pushing border to parent above } scrollable.TopLeftOffset = Vector2.Zero; }; searchBox.ResetButton.Click += (s2, e2) => { searchBox.BackgroundColor = Color.Transparent; searchBox.TextEditWidget.Text = ""; searchResults.CloseChildren(); }; this.AddChild(searchBox); scrollable.ScrollArea.HAnchor = HAnchor.Stretch; scrollable.ScrollArea.VAnchor = VAnchor.Fit; this.AddChild(scrollable); searchResults = new FlowLayoutWidget(FlowDirection.TopToBottom) { HAnchor = HAnchor.Stretch, VAnchor = VAnchor.Fit }; scrollable.AddChild(searchResults); }
protected override void PerformSearch(string filter) { searchHits = new HashSet <string>(HelpIndex.Search(filter).Select(d => d.Path)); base.PerformSearch(filter); }
public void SetupPages(HelpIndex _hiRemoteList) { this.Text = " " + UpdaterLang.Updater_Title; // website link. lnkKinovea.Links.Clear(); string lnkTarget = "http://www.kinovea.org"; lnkKinovea.Links.Add(0, lnkKinovea.Text.Length, lnkTarget); toolTip1.SetToolTip(lnkKinovea, lnkTarget); // Other controls. btnCancel.Text = UpdaterLang.Updater_Quit; btnDownload.Text = UpdaterLang.Updater_Download; lblInstruction.Text = UpdaterLang.Updater_Instruction; //lblSoftware.Text = m_ResourceManager.GetString("Updater_LblSoftware", Thread.CurrentThread.CurrentUICulture); //lblManuals.Text = m_ResourceManager.GetString("Updater_LblManuals", Thread.CurrentThread.CurrentUICulture); //lblVideos.Text = m_ResourceManager.GetString("Updater_LblVideos", Thread.CurrentThread.CurrentUICulture); //lblAllManualsUpToDate.Text = m_ResourceManager.GetString("Updater_LblAllManualsUpToDate", Thread.CurrentThread.CurrentUICulture); //lblAllVideosUpToDate.Text = m_ResourceManager.GetString("Updater_LblAllVideosUpToDate", Thread.CurrentThread.CurrentUICulture); lblAllManualsUpToDate.Top = chklstManuals.Top; lblAllManualsUpToDate.Left = chklstManuals.Left; lblAllVideosUpToDate.Top = chklstVideos.Top; lblAllVideosUpToDate.Left = chklstVideos.Left; //---------------------------- // Page Software //---------------------------- // Don't use the version info from the file, it may not be correct. ThreePartsVersion currentVersion = new ThreePartsVersion(PreferencesManager.ReleaseVersion); if (currentVersion < _hiRemoteList.AppInfos.Version) { //labelInfos.Text = m_ResourceManager.GetString("Updater_Behind", Thread.CurrentThread.CurrentUICulture); String szNewVersion = UpdaterLang.Updater_NewVersion; szNewVersion += " : " + _hiRemoteList.AppInfos.Version.ToString() + " - ( "; szNewVersion += UpdaterLang.Updater_CurrentVersion; szNewVersion += " " + currentVersion.ToString() + ")"; lblNewVersion.Text = szNewVersion; String szNewVersionFileSize = UpdaterLang.Updater_FileSize; szNewVersionFileSize += " " + String.Format("{0:0.00}", ((double)_hiRemoteList.AppInfos.FileSizeInBytes / (1024 * 1024))) + " "; szNewVersionFileSize += UpdaterLang.Updater_MegaBytes; lblNewVersionFileSize.Text = szNewVersionFileSize; lblChangeLog.Text = UpdaterLang.Updater_LblChangeLog; lblChangeLog.Visible = true; // Load Changelog //txtChangeLog.Clear(); rtbxChangeLog.Clear(); if (_hiRemoteList.AppInfos.ChangelogLocation.Length > 0) { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(_hiRemoteList.AppInfos.ChangelogLocation); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); if (response.StatusCode == HttpStatusCode.OK && response.ContentLength > 0) { TextReader reader = new StreamReader(response.GetResponseStream()); string line; while ((line = reader.ReadLine()) != null) { //txtChangeLog.AppendText("\n"); //txtChangeLog.AppendText(line); rtbxChangeLog.AppendText("\n"); rtbxChangeLog.AppendText(line); } } //Dim URLReq As Net.HttpWebRequest //Dim URLRes As Net.HttpWebRequest //Dim FileStreamer As New IO.FileStream("c:\temp\file1", IO.FileMode.CreateNew) //StreamReader sr2 = new StreamReader(_hiRemoteList.AppInfos.ChangelogLocation); //StringReader sr3 = new StringReader(_hiRemoteList.AppInfos.ChangelogLocation); //FileStream stream = new FileStream(_hiRemoteList.AppInfos.ChangelogLocation, FileMode.Open, FileAccess.Read); //rtbxChangeLog.LoadFile(stream, RichTextBoxStreamType.RichText); } rtbxChangeLog.Visible = true; m_bSoftwareUpToDate = false; } else { // OK à jour. labelInfos.Text = UpdaterLang.Updater_UpToDate; lblNewVersion.Visible = false; lblNewVersionFileSize.Visible = false; lblChangeLog.Visible = false; rtbxChangeLog.Visible = false; m_bSoftwareUpToDate = true; } //-------------------------------- // Page Manuals //-------------------------------- /*lblSelectManual.Text = UpdaterLang.Updater_LblSelectManuals; * * PopulateCheckedListBox(chklstManuals, _hiRemoteList.UserGuides, _hiLocalList.UserGuides, ""); * AutoCheckCulture(chklstManuals); * * String szTotalSelected = UpdaterLang.Updater_LblTotalSelected; * szTotalSelected += " " + String.Format("{0:0.0}", (double)ComputeTotalBytes(chklstManuals) / (1024 * 1024)) + " "; * szTotalSelected += UpdaterLang.Updater_MegaBytes; * lblTotalSelectedManuals.Text = szTotalSelected; * * //--------------------------------------------------------------------------------------------------------- * // Page Videos * //--------------------------------------------------------------------------------------------------------- * //lblSelectVideos.Text = m_ResourceManager.GetString("Updater_LblSelectVideos", Thread.CurrentThread.CurrentUICulture); * //lblFilterByLanguage.Text = m_ResourceManager.GetString("Updater_LblFilterByLang", Thread.CurrentThread.CurrentUICulture); * PopulateFilterComboBox(); * * string szCultureName = ((LanguageIdentifier)cmbLanguageFilter.Items[cmbLanguageFilter.SelectedIndex]).CultureName; * PopulateCheckedListBox(chklstVideos, _hiRemoteList.HelpVideos, _hiLocalList.HelpVideos, szCultureName); * AutoCheckCulture(chklstVideos); * RematchTotal(chklstVideos, lblTotalSelectedVideos); * * CheckIfListsEmpty();*/ // Alignement à droite avec la RichTextBox du changelog. lblNewVersionFileSize.Left = rtbxChangeLog.Left + rtbxChangeLog.Width - lblNewVersionFileSize.Width; }