示例#1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            var mainView = new XplorerMainWindow();

            mainView.Show();
            bool bOneModelLoaded = false;

            for (int i = 0; i < e.Args.Length; i++)
            {
                string thisArg = e.Args[i];
                if (string.Compare("/AccessMode", thisArg, true) == 0)
                {
                    string       StringMode = e.Args[++i];
                    XbimDBAccess mode       = (XbimDBAccess)System.Enum.Parse(typeof(XbimDBAccess), StringMode);
                    if (System.Enum.TryParse(StringMode, out mode))
                    {
                        mainView.FileAccessMode = mode;
                    }
                }
                else if (string.Compare("/plugin", thisArg, true) == 0)
                {
                    string PluginName = e.Args[++i];
                    mainView.LoadPlugin(PluginName);
                }
                else if (string.Compare("/select", thisArg, true) == 0)
                {
                    string SelLabel = e.Args[++i];
                    System.Diagnostics.Debug.Write("Select " + SelLabel + "... ");
                    mainView.LoadingComplete += delegate(object s, RunWorkerCompletedEventArgs args)
                    {
                        int iSel;
                        if (!int.TryParse(SelLabel, out iSel))
                        {
                            return;
                        }
                        if (mainView.Model == null)
                        {
                            return;
                        }
                        if (mainView.Model.Instances[iSel] == null)
                        {
                            return;
                        }
                        mainView.SelectedItem = mainView.Model.Instances[iSel];
                    };
                }
                else if (File.Exists(thisArg) && bOneModelLoaded == false)
                {
                    // does not support the load of two models
                    bOneModelLoaded = true;
                    mainView.LoadAnyModel(thisArg);
                }
            }
        }
示例#2
0
 protected override void OnStartup(StartupEventArgs e)
 {
     if (Keyboard.IsKeyDown(Key.LeftCtrl))
     {
         var q = new Querying.wdwQuery();
         q.Show();
     }
     else
     {
         var mainView = new XplorerMainWindow();
         mainView.Show();
     }
 }
示例#3
0
 /// <summary>
 /// Raises the <see cref="E:System.Windows.Application.Startup"/> event.
 /// </summary>
 /// <param name="e">A <see cref="T:System.Windows.StartupEventArgs"/> that contains the event data.</param>
 protected override void OnStartup(StartupEventArgs e)
 {
     var mainView = new XplorerMainWindow();
     mainView.Show();
     mainView.DrawingControl.ViewHome();
     var bOneModelLoaded = false;
     for (var i = 0; i< e.Args.Length; i++)
     {
         var thisArg = e.Args[i];
         if (string.Compare("/AccessMode", thisArg, StringComparison.OrdinalIgnoreCase) == 0)
         {
             var stringMode = e.Args[++i];
             XbimDBAccess mode;
             if (Enum.TryParse(stringMode, out mode))
             {
                 mainView.FileAccessMode = mode;
             }
         }
         else if (string.Compare("/plugin", thisArg, StringComparison.OrdinalIgnoreCase) == 0)
         {
             var pluginName = e.Args[++i];
             if (!File.Exists(pluginName))
                 MessageBox.Show(pluginName + " not found.");
             Debug.Write("Xplorer trying to load plugin from CommandLine");
             mainView.LoadPlugin(pluginName);
         }
         else if (string.Compare("/select", thisArg, StringComparison.OrdinalIgnoreCase) == 0)
         {
             var selLabel = e.Args[++i];
             Debug.Write("Select " + selLabel + "... ");
             mainView.LoadingComplete += delegate
             {
                 int iSel;
                 if (!int.TryParse(selLabel, out iSel))
                     return;
                 if (mainView.Model == null)
                     return;
                 if (mainView.Model.Instances[iSel] == null)
                     return;
                 mainView.SelectedItem = mainView.Model.Instances[iSel];
             };
         }
         else if (File.Exists(thisArg) && bOneModelLoaded == false)
         {
             // does not support the load of two models
             bOneModelLoaded = true;
             mainView.LoadAnyModel(thisArg);
         }
     }
 }
示例#4
0
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Application.Startup"/> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.StartupEventArgs"/> that contains the event data.</param>
        protected override void OnStartup(StartupEventArgs e)
        {
            // evaluate special parameters before loading MainWindow
            var blockPlugin = false;

            foreach (var thisArg in e.Args)
            {
                if (string.Compare("/noplugins", thisArg, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    blockPlugin = true;
                }
            }

            // see if an update of settings is required from a previous version of the app.
            // this will allow to retain the configuration across versions, it is useful for the squirrel installer
            //
            if (Settings.Default.SettingsUpdateRequired)
            {
                Settings.Default.Upgrade();
                Settings.Default.SettingsUpdateRequired = false;
                Settings.Default.Save();
            }

            var mainView = new XplorerMainWindow(blockPlugin);

            mainView.Show();
            mainView.DrawingControl.ViewHome();
            var bOneModelLoaded = false;

            for (var i = 0; i < e.Args.Length; i++)
            {
                var thisArg = e.Args[i];
                if (string.Compare("/AccessMode", thisArg, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    var          stringMode = e.Args[++i];
                    XbimDBAccess acce;
                    if (Enum.TryParse(stringMode, out acce))
                    {
                        mainView.FileAccessMode = acce;
                    }
                }
                else if (string.Compare("/plugin", thisArg, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    var pluginName = e.Args[++i];
                    if (File.Exists(pluginName))
                    {
                        var fi = new FileInfo(pluginName);
                        var di = fi.Directory;
                        mainView.LoadPlugin(di, true, fi.Name);
                        continue;
                    }
                    if (Directory.Exists(pluginName))
                    {
                        var di = new DirectoryInfo(pluginName);
                        mainView.LoadPlugin(di, true);
                        continue;
                    }
                    Clipboard.SetText(pluginName);
                    MessageBox.Show(pluginName + " not found. The full file name has been copied to clipboard.", "Plugin not found", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                else if (string.Compare("/select", thisArg, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    var selLabel = e.Args[++i];
                    Debug.Write("Select " + selLabel + "... ");
                    mainView.LoadingComplete += delegate
                    {
                        int iSel;
                        if (!int.TryParse(selLabel, out iSel))
                        {
                            return;
                        }
                        if (mainView.Model == null)
                        {
                            return;
                        }
                        if (mainView.Model.Instances[iSel] == null)
                        {
                            return;
                        }
                        mainView.SelectedItem = mainView.Model.Instances[iSel];
                    };
                }
                else if (File.Exists(thisArg) && bOneModelLoaded == false)
                {
                    // does not support the load of two models
                    bOneModelLoaded = true;
                    mainView.LoadAnyModel(thisArg);
                }
            }
        }
示例#5
0
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Application.Startup"/> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.StartupEventArgs"/> that contains the event data.</param>
        protected override void OnStartup(StartupEventArgs e)
        {
            // evaluate special parameters before loading MainWindow
            var blockUpdate = false;

            foreach (var thisArg in e.Args)
            {
                if (string.Compare("/noupdate", thisArg, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    blockUpdate = true;
                }
            }
            if (!blockUpdate)
            {
                Update();
            }

            var firstRun = PortPlugins();

            if (firstRun)
            {
                RestoreSettings();
            }


            // evaluate special parameters before loading MainWindow
            var blockPlugin = false;

            foreach (var thisArg in e.Args)
            {
                if (string.Compare("/noplugins", thisArg, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    blockPlugin = true;
                }
            }

            var mainView = new XplorerMainWindow(blockPlugin);

            mainView.Show();
            mainView.DrawingControl.ViewHome();
            var bOneModelLoaded = false;

            for (var i = 0; i < e.Args.Length; i++)
            {
                var thisArg = e.Args[i];
                if (string.Compare("/AccessMode", thisArg, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    var          stringMode = e.Args[++i];
                    XbimDBAccess acce;
                    if (Enum.TryParse(stringMode, out acce))
                    {
                        mainView.FileAccessMode = acce;
                    }
                }
                else if (string.Compare("/plugin", thisArg, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    var pluginName = e.Args[++i];
                    if (File.Exists(pluginName))
                    {
                        var fi = new FileInfo(pluginName);
                        var di = fi.Directory;
                        mainView.LoadPlugin(di, true, fi.Name);
                        continue;
                    }
                    if (Directory.Exists(pluginName))
                    {
                        var di = new DirectoryInfo(pluginName);
                        mainView.LoadPlugin(di, true);
                        continue;
                    }
                    Clipboard.SetText(pluginName);
                    MessageBox.Show(pluginName + " not found. The full file name has been copied to clipboard.", "Plugin not found", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                else if (string.Compare("/select", thisArg, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    var selLabel = e.Args[++i];
                    Debug.Write("Select " + selLabel + "... ");
                    mainView.LoadingComplete += delegate
                    {
                        int iSel;
                        if (!int.TryParse(selLabel, out iSel))
                        {
                            return;
                        }
                        if (mainView.Model == null)
                        {
                            return;
                        }
                        if (mainView.Model.Instances[iSel] == null)
                        {
                            return;
                        }
                        mainView.SelectedItem = mainView.Model.Instances[iSel];
                    };
                }
                else if (File.Exists(thisArg) && bOneModelLoaded == false)
                {
                    // does not support the load of two models
                    bOneModelLoaded = true;
                    mainView.LoadAnyModel(thisArg);
                }
            }
        }
示例#6
0
/*
        private void JumpList_JumpItemsRejected(object sender, JumpItemsRejectedEventArgs e)
        {
            StringBuilder sb = new StringBuilder();
            sb.AppendFormat("{0} Jump Items Rejected:\n", e.RejectionReasons.Count);
            for (int i = 0; i < e.RejectionReasons.Count; ++i)
            {
                if (e.RejectedItems[i].GetType() == typeof(JumpPath))
                    sb.AppendFormat("Reason: {0}\tItem: {1}\n", e.RejectionReasons[i], ((JumpPath)e.RejectedItems[i]).Path);
                else
                    sb.AppendFormat("Reason: {0}\tItem: {1}\n", e.RejectionReasons[i], ((JumpTask)e.RejectedItems[i]).ApplicationPath);
            }

            MessageBox.Show(sb.ToString());
        }
*/

/*
        private void JumpList_JumpItemsRemovedByUser(object sender, JumpItemsRemovedEventArgs e)
        {
            StringBuilder sb = new StringBuilder();
            sb.AppendFormat("{0} Jump Items Removed by the user:\n", e.RemovedItems.Count);
            for (int i = 0; i < e.RemovedItems.Count; ++i)
            {
                sb.AppendFormat("{0}\n", e.RemovedItems[i]);
            }

            MessageBox.Show(sb.ToString());
        }
*/
        #endregion

        /// <summary>
        /// Raises the <see cref="E:System.Windows.Application.Startup"/> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.StartupEventArgs"/> that contains the event data.</param>
        protected override void OnStartup(StartupEventArgs e)
        {
            // evaluate special parameters before loading MainWindow
            var blockPlugin = false;
            foreach (var thisArg in e.Args)
            {
                if (string.Compare("/noplugins", thisArg, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    blockPlugin = true;
                }
            }

            var mainView = new XplorerMainWindow(blockPlugin);
            mainView.Show();
            mainView.DrawingControl.ViewHome();
            var bOneModelLoaded = false;
            for (var i = 0; i< e.Args.Length; i++)
            {
                var thisArg = e.Args[i];
                if (string.Compare("/AccessMode", thisArg, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    var stringMode = e.Args[++i];
                    XbimDBAccess mode;
                    if (Enum.TryParse(stringMode, out mode))
                    {
                        mainView.FileAccessMode = mode;
                    }
                }
                else if (string.Compare("/plugin", thisArg, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    var pluginName = e.Args[++i];
                    if (!File.Exists(pluginName))
                    {
                        Clipboard.SetText(pluginName);
                        MessageBox.Show(pluginName + " not found. The full file name has been copied to clipboard.", "Plugin not found", MessageBoxButton.OK, MessageBoxImage.Error);
                        continue;
                    }
                    Debug.Write("Xplorer trying to load plugin from CommandLine");
                    mainView.LoadPlugin(pluginName);
                }
                else if (string.Compare("/select", thisArg, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    var selLabel = e.Args[++i];
                    Debug.Write("Select " + selLabel + "... ");
                    mainView.LoadingComplete += delegate
                    {
                        int iSel;
                        if (!int.TryParse(selLabel, out iSel))
                            return;
                        if (mainView.Model == null)
                            return;
                        if (mainView.Model.Instances[iSel] == null)
                            return;
                        mainView.SelectedItem = mainView.Model.Instances[iSel];    
                    };
                }
                else if (File.Exists(thisArg) && bOneModelLoaded == false)
                {
                    // does not support the load of two models
                    bOneModelLoaded = true;
                    mainView.LoadAnyModel(thisArg);
                }
            }
        }
示例#7
0
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Application.Startup"/> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.StartupEventArgs"/> that contains the event data.</param>
        protected override void OnStartup(StartupEventArgs e)
        {
            // evaluate special parameters before loading MainWindow
            var blockPlugin = false;

            foreach (var thisArg in e.Args)
            {
                if (string.Compare("/noplugins", thisArg, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    blockPlugin = true;
                }
            }

            var mainView = new XplorerMainWindow(blockPlugin);

            mainView.Show();
            mainView.DrawingControl.ViewHome();
            var bOneModelLoaded = false;

            for (var i = 0; i < e.Args.Length; i++)
            {
                var thisArg = e.Args[i];
                if (string.Compare("/AccessMode", thisArg, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    var stringMode = e.Args[++i];
                }
                else if (string.Compare("/plugin", thisArg, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    var pluginName = e.Args[++i];
                    if (!File.Exists(pluginName))
                    {
                        Clipboard.SetText(pluginName);
                        MessageBox.Show(pluginName + " not found. The full file name has been copied to clipboard.", "Plugin not found", MessageBoxButton.OK, MessageBoxImage.Error);
                        continue;
                    }
                    Debug.Write("Xplorer trying to load plugin from CommandLine");
                    mainView.LoadPlugin(pluginName);
                }
                else if (string.Compare("/select", thisArg, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    var selLabel = e.Args[++i];
                    Debug.Write("Select " + selLabel + "... ");
                    mainView.LoadingComplete += delegate
                    {
                        int iSel;
                        if (!int.TryParse(selLabel, out iSel))
                        {
                            return;
                        }
                        if (mainView.Model == null)
                        {
                            return;
                        }
                        if (mainView.Model.Instances[iSel] == null)
                        {
                            return;
                        }
                        mainView.SelectedItem = mainView.Model.Instances[iSel];
                    };
                }
                else if (File.Exists(thisArg) && bOneModelLoaded == false)
                {
                    // does not support the load of two models
                    bOneModelLoaded = true;
                    mainView.LoadAnyModel(thisArg);
                }
            }
        }