Ejemplo n.º 1
0
        private void Application_Startup_1(object sender, StartupEventArgs e)
        {
            try
            {
                NAVClient2URI.LoadMapping();
                args = "";
                foreach (String a in e.Args)
                {
                    if (args != "")
                    {
                        args += " ";
                    }
                    args += a;
                }
                if (args == "")
                {
                    return;
                }

                haveParams = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 2
0
 public MappingEditor()
 {
     InitializeComponent();
     NAVClient2URI.LoadMapping();
     //list.DataContext = NAVClient2URI.mappings;
     list.ItemsSource = NAVClient2URI.mappings;
     list.Items.SortDescriptions.Add(new SortDescription("DbServer", ListSortDirection.Ascending));
     list.Items.SortDescriptions.Add(new SortDescription("Db", ListSortDirection.Ascending));
 }
Ejemplo n.º 3
0
        public static String GetVersionFromMapping(String _uri)
        {
            var target = NAVClient2URI.GetByURI(_uri);

            if (target != null)
            {
                return(target.Version);
            }
            else
            {
                return("");
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// The URI was fired from NAV client.
        /// </summary>
        /// <param name="uri">The URI.</param>
        /// <param name="pid">The NAV client pid.</param>
        /// <param name="activeProcessFolder">The active process folder.</param>
        /// <param name="path">The path.</param>
        private static void RunFromClient(string uri, uint pid, String activeProcessFolder, String path)
        {
            var versionInfo = FileVersionInfo.GetVersionInfo(activeProcessFolder);
            var fileVersion = versionInfo.FileVersion;

            if (pid != 0)
            {
                // Only trigger GetExtendedUri if uri does not contain service tier server and instance
                if (uri.Contains("////"))
                {
                    var newUri = NAV_URI_Extender.GetExtendedUri(new Uri(uri), pid);
                    if (newUri != null)
                    {
                        uri = newUri.ToString();
                    }
                }
            }

            NAVClient2URI.UpdateVersion(uri, fileVersion);
            if (File.Exists(path + "Microsoft.Dynamics.Nav.Client.x86.exe"))
            //Runs the client from same folder as calling process
            {
                var navClient = NAVClientFactory.GetObject(fileVersion);
                navClient.Path = path + "Microsoft.Dynamics.Nav.Client.x86.exe";
                navClient.Uri  = uri;
                RunProcess(navClient);
                return;
            }
            else
            {
                if (File.Exists(path + "Microsoft.Dynamics.Nav.Client.exe"))
                //Runs the client from same folder as calling process
                {
                    var navClient = NAVClientFactory.GetObject(fileVersion);
                    navClient.Path = path + "Microsoft.Dynamics.Nav.Client.exe";
                    navClient.Uri  = uri;
                    RunProcess(navClient);
                    return;
                }
            }

            RunForVersion(uri, activeProcessFolder, fileVersion);
        }
Ejemplo n.º 5
0
        public static Uri GetExtendedUri(Uri URI, uint pid)
        {
            if (NVR_DynamicsNAVProtocolHandler.Properties.Settings.Default.DisableMapping)
            {
                return(null);
            }
            var navClients = new NAV_ROT.NAVClients();
            var navClient  = navClients.GetClientByPID(pid);
            var target     = NAVClient2URI.GetByServerDB(navClient.ServerName, navClient.DatabaseName, navClient.CompanyName);

            target.Company = navClient.CompanyName;
            if (target != null)
            {
                return(ReparseUri(URI, target));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 6
0
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     NAVClient2URI.SaveMapping();
     this.DialogResult = true;
     this.Close();
 }