Beispiel #1
0
        public static void LoadCustomURL(Image CurrentControl)
        {
            OpenFileDialog CustomUrlLoader = new OpenFileDialog()
            {
                Filter = "url files(*.url)|*.url"
            };

            if (CustomUrlLoader.ShowDialog() == true)
            {
                if (CustomUrlLoader.FileName != "")
                {
                    Uri StartupURL = new Uri(CustomUrlLoader.FileName);
                    if (StartupURL.IsFile)
                    {
                        string URILine = File.ReadLines(StartupURL.LocalPath).Skip(4).Take(1).First();
                        StartupURI = URILine.Replace("URL=", "");
                        StartupURI = StartupURI.Replace("\"", "");
                        StartupURI = StartupURI.Replace("BASE", "");
                        ImageChangeAnimations.SelectedItemAnimation(CurrentControl);
                        CurrentControl.ToolTip = "Enabled: Open URL on application startup.";
                        MessageBox.Show("Valid URL selected!" + Environment.NewLine + StartupURI, "Information!", MessageBoxButton.OK, MessageBoxImage.Information);
                        MainWindow.OpenURLOnStartupMode = true;
                    }
                    else
                    {
                        ImageChangeAnimations.DeselectedItemAnimation(CurrentControl);
                        CurrentControl.ToolTip = "Disabled: Open URL on application startup.";
                        MessageBox.Show("You did not select a valid URL! The process will be canceled.", "Warning!", MessageBoxButton.OK, MessageBoxImage.Information);
                    }
                }
            }
            else
            {
                if (CustomUrlLoader.FileName == "")
                {
                    ImageChangeAnimations.DeselectedItemAnimation(CurrentControl);
                    CurrentControl.ToolTip = "Disabled: Open URL on application startup.";
                    MessageBox.Show("You did not select a valid URL! The process will be canceled.", "Warning!", MessageBoxButton.OK, MessageBoxImage.Information);
                }
            }
        }
Beispiel #2
0
        public static void LoadCustomIcon(System.Windows.Controls.Image CurrentControl)
        {
            OpenFileDialog CustomIconLoader = new OpenFileDialog()
            {
                Filter = "Icon files(*.ico)|*.ico"
            };

            if (CustomIconLoader.ShowDialog() == true)
            {
                if (CustomIconLoader.FileName != "")
                {
                    try
                    {
                        CustomIconDirectory = CustomIconLoader.FileName;
                        ImageChangeAnimations.SelectedItemAnimation(CurrentControl);
                        MessageBox.Show("Valid custom icon selected!", "Information!", MessageBoxButton.OK, MessageBoxImage.Information);
                        MainWindow.CustomIconMode = true;
                    }
                    catch
                    {
                        MainWindow.CustomIconMode = false;
                        ImageChangeAnimations.DeselectedItemAnimation(CurrentControl);
                        MessageBox.Show("You did not select a valid icon! The process will be canceled.", "Warning!", MessageBoxButton.OK, MessageBoxImage.Information);
                    }
                }
            }
            else
            {
                if (CustomIconLoader.FileName == "")
                {
                    MainWindow.CustomIconMode = false;
                    ImageChangeAnimations.DeselectedItemAnimation(CurrentControl);
                    MessageBox.Show("You did not select a valid icon! The process will be canceled.", "Warning!", MessageBoxButton.OK, MessageBoxImage.Information);
                }
            }
        }