Beispiel #1
0
        internal static async Task <bool> DownloadModValuesFileAsync(string modValuesFileName)
        {
            try
            {
                await DownloadAsync(ObeliskUrl + modValuesFileName,
                                    FileService.GetJsonPath(Path.Combine(FileService.ValuesFolder, modValuesFileName)));

                return(true);
            }
            catch (Exception ex)
            {
                MessageBoxes.ExceptionMessageBox(ex, "Error while downloading values file");
            }
            return(false);
        }
 private void Timer_Tick(object sender, EventArgs e)
 {
     if (indexOfMediaToPlay < playlistContentToPlay.Count)
     {
         timer.Interval = TimeSpan.FromSeconds(playlistPlaybackDelayBetweenMediaSec);
         SetMediaToPlay();
         indexOfMediaToPlay++;
     }
     else
     {
         timer.Stop();
         MessageBoxes.ShowInformationMessageBox("There is no more media to play, the player will now close.");
         this.Close();
     }
 }
Beispiel #3
0
        protected override void LoadData()
        {
            List <Dealers> dealersArray = new List <Dealers>();

            if (!dealersData.SelectAll(dealersArray))
            {
                MessageBoxes.ShowError(MessageBoxes.LoadDataErrorMessage);
                return;
            }

            foreach (var item in dealersArray)
            {
                itemsSource.Add(item);
            }
        }
        public UsersAddingForm()
        {
            InitializeComponent();

            var viewmodel = DataContext as UsersAddingFormViewModel;

            viewmodel.UserAdded                  += (username) => MessageBoxes.Information($"Użytkownik '{username}' został pomyślnie dodany do systemu.");
            viewmodel.ElementEmpty               += () => MessageBoxes.Warning("Pola formularza nie mogą pozostać puste.");
            viewmodel.NoRolesSelected            += () => MessageBoxes.Warning("Nie wybrano roli dla tworzonego użytkownika.");
            viewmodel.MinPasswordLengthViolation += ()
                                                    => MessageBoxes.Warning($"Minimalna długość hasła to {Tasks_Model.Helpers.Constants.MinPasswordLength} znaków");
            viewmodel.UsernameExists += (username) => MessageBoxes.Warning($"Użytkownik o nazwie '{username}' już istnieje w systemie.");

            Unloaded += (sender, e) => viewmodel.UnsubscribePrismEvents();
        }
Beispiel #5
0
 /// <summary>
 /// Se charge d'enregistrer les paramètres locaux à la fenêtre
 /// </summary>
 private void _SaveLocalSettings()
 {
     try
     {
         // Mode d'affichage de la liste de fichiers
         Program.ApplicationSettings.FileBrowserViewMode       = bnkListView.View.ToString();
         Program.ApplicationSettings.BnkManagerFlatDisplayMode = _IsContentFlatView.ToString();
         // EVO_93: module visibility are updated automatically (on menu item click)
         Program.ApplicationSettings.Save();
     }
     catch (Exception ex)
     {
         MessageBoxes.ShowError(this, new Exception(_ERROR_SAVING_SETTINGS, ex));
     }
 }
Beispiel #6
0
        internal void Navigate(Uri uri)
        {
            try
            {
                // Clear out any pending uri
                navigate_once_visible_uri = null;

                ObjWebBrowser.Navigate(uri.ToString());
            }
            catch (Exception ex)
            {
                Logging.Warn(ex, "Problem navigating to website {0}", uri.ToString());
                MessageBoxes.Error("There was a problem navigating to {0}.  Please try again after checking the web address.", uri.ToString());
            }
        }
Beispiel #7
0
        private void ShowWrongFormatGuidance()
        {
            // Default prefix
            string help   = String.Format("The file you selected had content, but it did not appear to be suitable for import");
            string suffix = String.Empty;

            switch (_currentProvider)
            {
            case Providers.EndNote:
                suffix = "Did you perhaps select your EndNote library file, instead of exporting your library and selecting the export file? ";
                break;
            }

            MessageBoxes.Warn(help + Environment.NewLine + Environment.NewLine + suffix);
        }
Beispiel #8
0
        private void userGuidetoolStripMenuItem_Click(object sender, EventArgs e)
        {
            // Clic sur l'élément de menu "User Guide"
            try
            {
                // Lance le navigateur par défaut
                ProcessStartInfo editorProcess = new ProcessStartInfo(LibraryConstants.URL_OFFLINE_DOC);

                Process.Start(editorProcess);
            }
            catch (Exception ex)
            {
                MessageBoxes.ShowError(this, ex);
            }
        }
Beispiel #9
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         if (Save())
         {
             MessageBoxes.Success("Record added succesfully");
             Reset();
         }
     }
     catch (Exception ex)
     {
         MessageBoxes.Error(ex.Message);
     }
 }
        protected override void LoadData()
        {
            List <Pharmacies> pharmacyList = new List <Pharmacies>();

            if (!pharmacyData.SelectAll(pharmacyList))
            {
                MessageBoxes.ShowError(MessageBoxes.LoadDataErrorMessage);
                return;
            }

            foreach (var item in pharmacyList)
            {
                itemsSource.Add(item);
            }
        }
Beispiel #11
0
 private void buttonPlay_Click(object sender, EventArgs e)
 {
     if (soundplayer == null)
     {
         System.Media.SystemSounds.Hand.Play();
     }
     else
     {
         try { soundplayer.Play(); }
         catch
         {
             MessageBoxes.ShowMessageBox("Unsupported sound-format. Only PCM-WAV is supported.", $"Unsupported sound-format");
         }
     }
 }
Beispiel #12
0
        private void ButtonPut_Click(object sender, RoutedEventArgs e)
        {
            if (null == web_library_detail)
            {
                MessageBoxes.Error("You must choose a library...");
                return;
            }

            string json = TxtData.Text;

            if (MessageBoxes.AskQuestion("Are you sure you want to write {0} characters to the database?", json.Length))
            {
                web_library_detail.Xlibrary.LibraryDB.PutString(TxtFingerprint.Text, TxtExtension.Text, json);
            }
        }
Beispiel #13
0
        private void getUpdatesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // EVO_82.
            // Click on "Get updates (online)" menu item > opens browser to official TDU Central thread
            try
            {
                ProcessStartInfo editorProcess = new ProcessStartInfo(AppConstants.URL_UPDATES);

                Process.Start(editorProcess);
            }
            catch (Exception ex)
            {
                MessageBoxes.ShowError(this, ex);
            }
        }
Beispiel #14
0
        private void cboTerminal_SelectionChangeCommitted(object sender, EventArgs e)
        {
            if (!(cboTerminal.SelectedItem is IShellDescriptor shell))
            {
                return;
            }

            if (shell.HasExecutable)
            {
                return;
            }

            MessageBoxes.ShellNotFound(this);
            cboTerminal.SelectedIndex = _cboTerminalPreviousIndex;
        }
Beispiel #15
0
 private void btnAddNew_Click(object sender, EventArgs e)
 {
     try
     {
         AddPromo ap = new AddPromo();
         if (ap.ShowDialog() == DialogResult.OK)
         {
             Reset();
         }
     }
     catch (Exception ex)
     {
         MessageBoxes.Error(ex.Message);
     }
 }
        void WebsiteNodeContentControl_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            ++website_node_content.Underlying.VisitedCount;
            website_node_content.Underlying.LastVisited = DateTime.UtcNow;
            website_node_content.NotifyPropertyChanged();

            try
            {
                Process.Start(website_node_content.Underlying.Url);
            }
            catch (Exception ex)
            {
                MessageBoxes.Error(ex, "There was a problem launching your web page");
            }
        }
        private void HyperlinkPublicStatus_Click(object sender, RoutedEventArgs e)
        {
            Library library = DataContext as Library;

            if (null != library)
            {
                MessageBoxes.Info(
                    ""
                    + "You can make this library publicly available.  Others will be able to see your paper properties (title, authors, bibtex, tags), but not download the actual PDFs."
                    + "\n\nYou will get a permanent web address to share by email or link to from your homepage that allows others to explore and follow your up-to-date reading list."
                    );

                WebsiteAccess.ChangeLibraryPublicStatus(library.WebLibraryDetail.ShortWebId);
            }
        }
        internal static void Go(string filename)
        {
            try
            {
                string   parts_string = filename.Replace("qiqqa://", "");
                string[] parts        = parts_string.Split('/');

                if (0 == parts.Length)
                {
                    throw new GenericException("Unknown qiqqa protocol request: {0}", filename);
                }

                // Is it an open url?
                if ("open" == parts[0])
                {
                    if (3 > parts.Length)
                    {
                        throw new GenericException("Too few parameters for qiqqa protocol open request: {0}", filename);
                    }

                    string library_id           = parts[1];
                    string document_fingerprint = parts[2];

                    Library library = WebLibraryManager.Instance.GetLibrary(library_id);
                    if (null == library)
                    {
                        throw new GenericException("Unknown library for qiqqa protocol open request: {0}", filename);
                    }

                    PDFDocument pdf_document = library.GetDocumentByFingerprint(document_fingerprint);
                    if (null == pdf_document)
                    {
                        throw new GenericException("Unknown document for qiqqa protocol open request: {0} @ fingerprint {1}", filename, document_fingerprint);
                    }

                    MainWindowServiceDispatcher.Instance.OpenDocument(pdf_document);
                }

                else
                {
                    throw new GenericException("Unknown qiqqa protocol request: {0}", filename);
                }
            }
            catch (Exception ex)
            {
                MessageBoxes.Error(ex.Message);
            }
        }
Beispiel #19
0
        private static ThemeSettings LoadThemeSettings()
        {
            Theme invariantTheme;

            try
            {
                invariantTheme = Repository.GetInvariantTheme();
            }
            catch (ThemeException ex)
            {
                // Not good, ColorHelper needs actual InvariantTheme to correctly transform colors.
                MessageBoxes.ShowError(null, $"Failed to load invariant theme: {ex}");
                return(ThemeSettings.Default);
            }

            ThemeId themeId = AppSettings.ThemeId;

            if (string.IsNullOrEmpty(themeId.Name))
            {
                return(CreateFallbackSettings(invariantTheme));
            }

            Theme theme;

            try
            {
                theme = Repository.GetTheme(themeId, AppSettings.ThemeVariations);
            }
            catch (ThemeException ex)
            {
                MessageBoxes.ShowError(null, $"Failed to load {(themeId.IsBuiltin ? "preinstalled" : "user-defined")} theme {themeId.Name}: {ex}");
                return(CreateFallbackSettings(invariantTheme));
            }

            try
            {
                InstallHooks(theme);
            }
            catch (Exception ex)
            {
                MessageBoxes.ShowError(null, $"Failed to install Win32 theming hooks: {ex}");
                return(CreateFallbackSettings(invariantTheme));
            }

            IsDarkTheme = theme.SysColorValues[KnownColor.Window].GetBrightness() < 0.5;

            return(new ThemeSettings(theme, invariantTheme, AppSettings.ThemeVariations, AppSettings.UseSystemVisualStyle));
        }
Beispiel #20
0
        /// <summary>
        /// Actualise l'arborescence
        /// </summary>
        private void _RefreshTreeView()
        {
            // On efface tout
            folderTreeView.Nodes.Clear();
            bnkStatusLabel.Text = bnkStatusLabelCountSize.Text = "";

            StatusBarLogManager.ShowEvent(this, _STATUS_NO_BNK_SELECTED);

            // Le dossier des bnk est-il valide ?
            DirectoryInfo di = new DirectoryInfo(LibraryConstants.GetSpecialFolder(LibraryConstants.TduSpecialFolder.Bnk));

            if (!di.Exists)
            {
                // On efface tout
                bnkListView.Items.Clear();
                _ClearContentLists();

                MessageBoxes.ShowError(this, _ERROR_INVALID_TDU_PATH);
                return;
            }

            Cursor = Cursors.WaitCursor;

            // Noeud racine
            TreeNode rootNode = new TreeNode(_TREENODE_ROOT)
            {
                Tag                = LibraryConstants.GetSpecialFolder(LibraryConstants.TduSpecialFolder.Bnk),
                ImageIndex         = (int)ItemPictures.ClosedFolder,
                SelectedImageIndex = (int)ItemPictures.OpenedFolder
            };

            folderTreeView.Nodes.Add(rootNode);

            // Parcours des dossiers
            try
            {
                _AddFoldersToTreeView(rootNode);

                // On déploie le noeud racine
                rootNode.Expand();

                Cursor = Cursors.Default;
            }
            catch (Exception ex)
            {
                MessageBoxes.ShowError(this, ex);
            }
        }
Beispiel #21
0
        public static OcrTemplate LoadFile(string filePath)
        {
            OcrTemplate ocrConfig = null;

            // check if file exists
            if (!File.Exists(filePath))
            {
                MessageBoxes.ShowMessageBox($"OCR file '{filePath}' not found. OCR is not possible without the config-file.");
                return(null);
            }

            if (FileService.LoadJsonFile(filePath, out OcrTemplate data, out var errorMessage, new Newtonsoft.Json.Converters.VersionConverter()))
            {
                ocrConfig = data;
                ocrConfig.InitializeOcrTemplate();
            }
        private void HyperlinkPurge_OnClick(object sender, MouseButtonEventArgs e)
        {
            WebLibraryDetail web_library_detail = DataContext as WebLibraryDetail;

            if (MessageBoxes.AskQuestion("Are you sure you want to purge the deleted library '{0}'?  All information you have in it will be lost forever!", web_library_detail.Title))
            {
                if (MessageBoxes.AskQuestion("One more time just to be sure: are you sure you want to purge the deleted library '{0}'?  All information you have in it will be lost forever!", web_library_detail.Title))
                {
                    web_library_detail.IsPurged = true;
                    WebLibraryManager.Instance.NotifyOfChangeToWebLibraryDetail();

                    MessageBoxes.Info("Your library '{0}' has been purged and will no longer be available the next time you start Qiqqa.", web_library_detail.Title);
                }
            }
            e.Handled = true;
        }
        private void saveFileDialog1_FileOk(object sender, CancelEventArgs e)
        {
            var content = dataGridView1.GetClipboardContent();

            if (content != null)
            {
                try
                {
                    File.WriteAllText(saveFileDialog1.FileName, content.GetText());
                }
                catch (Exception ex)
                {
                    MessageBoxes.ExportFailed(ex.Message, this);
                }
            }
        }
Beispiel #24
0
        internal void ForgetKnownWebLibraryFromIntranet(WebLibraryDetail web_library_detail)
        {
            WPFDoEvents.AssertThisCodeIs_NOT_RunningInTheUIThread();

            Logging.Info("+Forgetting {1} Library from {0}", web_library_detail.Title, web_library_detail.LibraryType());

            if (MessageBoxes.AskQuestion("Are you sure you want to forget the {1} Library '{0}'?", web_library_detail.Title, web_library_detail.LibraryType()))
            {
                web_library_details.Remove(web_library_detail.Id);

                SaveKnownWebLibraries();
                FireWebLibrariesChanged();
            }

            Logging.Info("-Forgetting {1} Library from {0}", web_library_detail.Title, web_library_detail.LibraryType());
        }
            public void Open()
            {
                if (!Directory.Exists(Info.Path))
                {
                    MessageBoxes.SubmoduleDirectoryDoesNotExist(owner: null, Info.Path, Info.Text);
                    return;
                }

                if (Info.Detailed?.RawStatus is not null)
                {
                    UICommands.BrowseSetWorkingDir(Info.Path, ObjectId.WorkTreeId, Info.Detailed.RawStatus.OldCommit);
                    return;
                }

                UICommands.BrowseSetWorkingDir(Info.Path);
            }
Beispiel #26
0
        internal void Navigate(Uri uri)
        {
            try
            {
                // Clear out any pending uri
                NavigateOnceVisibleUri = uri;

                ObjWebBrowser.Navigate(uri?.ToString() ?? "");
            }
            catch (Exception ex)
            {
                string uristr = uri?.ToString() ?? "(???)";
                Logging.Warn(ex, "Problem navigating to website {0}", uristr);
                MessageBoxes.Error("There was a problem navigating to {0}.  Please try again after checking the web address.", uristr);
            }
        }
 private void CmdCreateBundle_Click(object sender, RoutedEventArgs e)
 {
     using (FolderBrowserDialog dialog = new FolderBrowserDialog())
     {
         dialog.Description = "Please select the folder into which the two Library Bundle files should be placed.";
         DialogResult result = dialog.ShowDialog();
         if (result == DialogResult.OK)
         {
             CreateBundle(dialog.SelectedPath.ToString());
         }
         else
         {
             MessageBoxes.Warn("Your Library Bundle creation has been cancelled.");
         }
     }
 }
        void HyperlinkBibTeXLinksMissing_Click(object sender, RoutedEventArgs e)
        {
            string message =
                ""
                + "If you are not seeing an \"Import into BibTeX\" link below each search result, it means that you have not yet enabled BibTeX support in Google Scholar.\n\n"
                + "If you want Qiqqa to attempt to take you to the Google Scholar settings screen, press YES and then press 'Save Preferences' when you have reviewed all the available preferences.\n\n"
                + "If you would prefer to do it yourself, press NO.  Go to the main Google Scholar page (http://scholar.google.com) USING THE QIQQA BUILT-IN BROWSER, and open the Google Scholar Settings.  Make sure you are on the .com version of Scholar, by looking at the web address.  If the address does not end in \".com\", then look for a link in the bottom right called \"Go to Google Scholar\" which should take you there.   Once on the .com Scholar settings page, in the 'Bibliography Manager' section, select 'Show links to import citations into BibTeX' and then press 'Save'.";

            if (MessageBoxes.AskQuestion(message))
            {
                string preferences_url = "http://scholar.google.com/scholar_setprefs?scis=yes&scisf=4";
                ObjWebBrowser.OpenUrl(preferences_url);
            }

            e.Handled = true;
        }
        /// <summary>
        /// confirm action as an asynchronous operation.
        /// </summary>
        /// <param name="title">The title.</param>
        /// <param name="header">The header.</param>
        /// <param name="message">The message.</param>
        /// <param name="notificationType">Type of the notification.</param>
        /// <param name="promptType">Type of the prompt.</param>
        /// <returns>Task&lt;System.Boolean&gt;.</returns>
        public async Task <bool> ShowPromptAsync(string title, string header, string message, NotificationType notificationType, PromptType promptType = PromptType.YesNo)
        {
            var icon = notificationType switch
            {
                NotificationType.Info => Icon.Info,
                NotificationType.Success => Icon.Success,
                NotificationType.Warning => Icon.Warning,
                NotificationType.Error => Icon.Error,
                _ => Icon.None,
            };
            var mainWindow = Helpers.GetMainWindow();
            var prompt     = MessageBoxes.GetPromptWindow(title, header, message, icon, promptType);
            var result     = await prompt.ShowDialog(mainWindow);

            return(result == ButtonResult.Yes || result == ButtonResult.Ok);
        }
Beispiel #30
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         if (Save())
         {
             Reset();
             MessageBoxes.Success("Record Added Successfully");
             DialogResult = DialogResult.OK;
         }
     }
     catch (Exception ex)
     {
         MessageBoxes.Error(ex.Message);
     }
 }