Exemple #1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Verifies the existence of the specified FW data source.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private static void CheckExistenceOfFwDatabase(PaDataSource ds)
        {
            if (ds == null)
            {
                return;
            }

            if (!FwDBUtils.IsSQLServerStarted && !FwDBUtils.StartSQLServer(true))
            {
                return;
            }

            if (ds.FwDataSourceInfo != null)
            {
                var fwDBInfoList =
                    FwDBUtils.GetFwDataSourceInfoList(ds.FwDataSourceInfo.Server, false);

                if (fwDBInfoList.Any(fwinfo => ds.FwPrjName == fwinfo.Name))
                {
                    return;
                }

                ds.FwDataSourceInfo.IsMissing = true;
            }

            MissingFWDatabaseMsgBox.ShowDialog(ds.ToString(true));
            ds.SkipLoadingBecauseOfProblem = true;
        }
        /// ------------------------------------------------------------------------------------
        private void HandleNetworkTreeViewAfterSelect(object sender, TreeViewEventArgs e)
        {
            var node = e.Node as NetworkTreeNode;

            if (node == null)
            {
                return;
            }

            Utils.WaitCursors(true);
            btnOK.Enabled = false;
            lstFwProjects.SelectedIndex = -1;
            lstFwProjects.Items.Clear();
            txtMsg.Text           = string.Empty;
            txtMsg.Visible        = true;
            lstFwProjects.Visible = false;

            if (!string.IsNullOrEmpty(node.MachineName))
            {
                txtMsg.Text    = LocalizationManager.GetString("DialogBoxes.Fw6ProjectsDlg.SearchingForFwDatabasesMsg", "Searching...");
                txtMsg.Visible = true;
                Application.DoEvents();

                lstFwProjects.Items.Clear();

                var dsInfo = FwDBUtils.GetFwDataSourceInfoList(node.MachineName, true).ToArray();
                if (dsInfo.Length > 0)
                {
                    lstFwProjects.Items.AddRange(dsInfo);
                    lstFwProjects.SelectedIndex = 0;
                    lstFwProjects.Visible       = true;
                    txtMsg.Visible = false;
                }
                else
                {
                    var fmt = LocalizationManager.GetString("DialogBoxes.Fw6ProjectsDlg.NoFwProjectsFoundMsg", "No projects found on '{0}'.");
                    txtMsg.Text = string.Format(fmt, node.MachineName);
                }
            }

            Utils.WaitCursors(false);
        }