Exemplo n.º 1
0
        /// <summary>
        /// Finds and selects an XPathNavigatorTreeNode using an XPath expression.
        /// </summary>
        /// <param name="xpath">An XPath expression.</param>
        /// <returns></returns>
        public bool FindByXpath(string xpath)
        {
            // evaluate the expression
            object result = this.SelectXmlNodes(xpath);

            if (result == null)
            {
                return(false);
            }

            // did the expression evaluate to a node set?
            XPathNodeIterator iterator = result as XPathNodeIterator;

            if (iterator != null)
            {
                // the expression evaluated to a node set
                if (iterator == null || iterator.Count < 1)
                {
                    return(false);
                }

                if (!iterator.MoveNext())
                {
                    return(false);
                }

                // select the first node in the set
                return(this.SelectXmlTreeNode(iterator.Current));
            }
            else
            {
                StdDialog.ShowInfo("XPath result:" + result.ToString());
                return(true);
            }
        }
Exemplo n.º 2
0
        private void btnSend_Click(object sender, EventArgs e)
        {
            try
            {
                Check();
            }
            catch (Exception err)
            {
                Errors.Report(err);
                return;
            }

            var         cfg  = GlobalSettings.Pages.Email();
            MailMessage mail = new MailMessage();

            mail.From = cfg.GetFromAddress();
            foreach (string addr in emailToFrame1.EmailTo.Split(';'))
            {
                mail.To.Add(addr);
            }
            mail.Subject    = tbxSubject.Text;
            mail.Body       = tbxBody.Text;
            mail.IsBodyHtml = false;

            string fn = Core.GetTempFile(".dca");

            using (var zipfs = new ZipFileSystem(fn))
            {
                configSelectionFrame1.Root.CopyCheckedTo(zipfs, true, null);
                zipfs.Flush();
            }

            using (var dcafr = new FileInfo(fn).OpenRead())
            {
                var att = new Attachment(dcafr, "configuration.dca");
                mail.Attachments.Add(att);

                if (chbAddHowTo.Checked)
                {
                    var ms = new MemoryStream();
                    var sw = new StreamWriter(ms);
                    sw.Write(CoreRes.sendconfig_howto);
                    sw.Flush();
                    ms.Position = 0;
                    var atthowto = new Attachment(ms, "howto.html");
                    mail.Attachments.Add(atthowto);
                }

                SmtpClient smtp = cfg.GetClient();
                Logging.Info("Sending mail to " + emailToFrame1.EmailTo);
                smtp.Send(mail);
            }

            File.Delete(fn);
            Close();
            StdDialog.ShowInfo("s_configuration_sent");
        }
Exemplo n.º 3
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            GlobalSettings.Pages.BeginEdit();
            GlobalSettings.Pages.General().AskWhenUploadUsageStats = false;
            GlobalSettings.Pages.General().AllowUploadUsageStats   = chbAllowUploadStats.Checked;
            GlobalSettings.Pages.EndEdit();

            if (rbtPersonal.Checked)
            {
                InstallationInfo.Instance.InstallMode = InstallationMode.Personal;
            }
            if (rbtProfessional.Checked)
            {
                InstallationInfo.Instance.InstallMode = InstallationMode.Professional;
            }
            InstallationInfo.Instance.LastShown = DateTime.UtcNow;
            InstallationInfo.Instance.Save();

            if (grpEval.Enabled && (chbDataSynEval.Checked || chbProEval.Checked || chbVersionDbEval.Checked))
            {
                var evdata = GetEvalCodeForm.Run();
                if (evdata == null)
                {
                    DialogResult = DialogResult.None;
                    return;
                }
                int cnt = 0;
                using (var wc = new WaitContext())
                {
                    if (chbDataSynEval.Checked && GetEvalCode.GetLicense(evdata.Name, evdata.Email, "datasyn"))
                    {
                        cnt++;
                    }
                    if (chbProEval.Checked && GetEvalCode.GetLicense(evdata.Name, evdata.Email, "pro"))
                    {
                        cnt++;
                    }
                    if (chbVersionDbEval.Checked && GetEvalCode.GetLicense(evdata.Name, evdata.Email, "versiondb"))
                    {
                        cnt++;
                    }
                }
                if (cnt > 0)
                {
                    LicenseTool.ReloadLicenses();
                    HLicense.CallChangedLicenses();
                    StdDialog.ShowInfo("s_license_succesfuly_installed");
                }
                else
                {
                    StdDialog.ShowError("s_error_when_install_license");
                }
            }
            Close();
        }
Exemplo n.º 4
0
 private void SendUsageForm_FormClosed(object sender, FormClosedEventArgs e)
 {
     GlobalSettings.Pages.BeginEdit();
     GlobalSettings.Pages.General().AskWhenUploadUsageStats = !cbxDontAskNext.Checked;
     GlobalSettings.Pages.General().AllowUploadUsageStats   = cbxAllowUpload.Checked;
     GlobalSettings.Pages.EndEdit();
     SendUsageStatsThread.SendUsage();
     if (GlobalSettings.Pages.General().AllowUploadUsageStats)
     {
         StdDialog.ShowInfo("s_thank_you_for_uploading_stats");
     }
 }
Exemplo n.º 5
0
 private void btnInstallLicense_Click(object sender, EventArgs e)
 {
     if (openFileDialogLicense.ShowDialogEx() == DialogResult.OK)
     {
         var lic = LicenseTool.LoadLicense(openFileDialogLicense.FileName);
         if (lic != null)
         {
             LicenseTool.InstallLicense(openFileDialogLicense.FileName);
             StdDialog.ShowInfo("s_license_installed_please_restart");
             ReloadLicenses();
         }
         else
         {
             StdDialog.ShowError("s_license_file_is_not_valid");
         }
     }
 }
Exemplo n.º 6
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            var repls = new List <Tuple <string, string> >();

            configSelectionFrame1.Root.GetReplacePaths(repls);
            configSelectionFrame1.Root.CopyCheckedTo(m_dstFs, true, repls);
            Close();

            // refresh all what we can refresh...
            HTree.CallRefreshRoot();
            HFavorites.CallChanged();

            StdDialog.ShowInfo("s_config_imported");

            //if (MessageBox.Show("s_conf_imported_restart_recomended_restart_now", "DatAdmin", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
            //{
            //    MainWindow.Instance.CloseMainWindow();
            //    Core.ExecuteAfterFinalize = Core.FullExeName;
            //}
        }
Exemplo n.º 7
0
 protected void ChangeDependencySource(object value)
 {
     if (m_proposedDependencySource == value)
     {
         return;
     }
     m_proposedDependencySource = value;
     if (Detached)
     {
         return;
     }
     if (!AllowClose())
     {
         StdDialog.ShowInfo("s_info_about_detached_data");
         Detached = true;
         return;
     }
     if (IsContentVisible)
     {
         CallLoadFromDependencySource(m_proposedDependencySource);
     }
 }
Exemplo n.º 8
0
 private void pictureBox1_Click(object sender, EventArgs e)
 {
     StdDialog.ShowInfo("s_this_options_changes_global_settings");
 }