Ejemplo n.º 1
0
 private void mnuCustomiseFileAssociations_Click(object sender, RoutedEventArgs e)
 {
     FileAssociations diag = new FileAssociations();
     diag.ShowDialog();
 }
Ejemplo n.º 2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //Open a File if we've been asked to do so
            String[] args = Environment.GetCommandLineArgs();
            if (args.Length >= 2)
            {
                if (File.Exists(args[1]))
                {
                    try
                    {
                        using (StreamReader reader = new StreamReader(args[1]))
                        {
                            String text = reader.ReadToEnd();
                            textEditor.Text = String.Empty;
                            textEditor.Text = text;
                            this._manager.AutoDetectSyntax(args[1]);
                        }
                        this._manager.CurrentFile = args[1];
                        this.Title = "rdfEditor - " + System.IO.Path.GetFileName(this._manager.CurrentFile);
                        this._manager.HasChanged = false;
                        this.UpdateMruList(args[1]);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("An error occurred while opening the selected file: " + ex.Message, "Unable to Open File");
                    }
                }
            }

            //Check File Associations
            if (Properties.Settings.Default.AlwaysCheckFileAssociations)
            {
                if (Properties.Settings.Default.FirstRun)
                {
                    Properties.Settings.Default.AlwaysCheckFileAssociations = false;
                    Properties.Settings.Default.FirstRun = false;
                    Properties.Settings.Default.Save();
                }

                FileAssociations diag = new FileAssociations();
                if (!diag.AllAssociated) diag.ShowDialog(); //Don't show if all associations are already set
            }

            textEditor.Focus();

            //Set Window size
            if (Properties.Settings.Default.WindowHeight > 0 && Properties.Settings.Default.WindowWidth > 0)
            {
                this.Height = Properties.Settings.Default.WindowHeight;
                this.Width = Properties.Settings.Default.WindowWidth;
            }
            this._saveWindowSize = true;

            //Fill The MRU List
            this.ShowMruList();
        }