Пример #1
0
        private void updateButton_Click(object sender, EventArgs e)
        {
            Form1 form = (Form1)Owner;

            String errorMessage;

            statusLabel.Text = LanguageUtil.GetCurrentLanguageString("statusLabelUpdater", Name); //"Checking for new updater..."
            Refresh();

            if (!VersionCheckManager.UpdaterCheck(out errorMessage))
            {
                warningPictureBox.Visible = true;
                statusLabel.Text          = errorMessage;
                return;
            }

            statusLabel.Text = LanguageUtil.GetCurrentLanguageString("statusLabelClosing", Name); //"Closing open tabs..."
            Refresh();

            TabManager.CloseAllPages(form);
            ProcessStartInfo processInfo = new ProcessStartInfo("DtPadUpdater.exe", "-nocheck");

            OtherManager.StartProcessInfo(this, processInfo);
            Application.Exit();
        }
Пример #2
0
        private static void Validate(Form1 form, String validation, String title)
        {
            CustomRichTextBox pageTextBox = ProgramUtil.GetPageTextBox(form.pagesTabControl.SelectedTabPage);

            if (String.IsNullOrEmpty(pageTextBox.Text))
            {
                WindowManager.ShowInfoBox(form, LanguageUtil.GetCurrentLanguageString("NoContent", className));
                return;
            }

            String fileName = String.Format("{0}.html", Guid.NewGuid());
            String pathName = Path.Combine(ConstantUtil.ApplicationExecutionPath(), ConstantUtil.internetCacheDirectoryName);

            if (!Directory.Exists(pathName))
            {
                Directory.CreateDirectory(pathName);
            }

            String text = String.Format(validation, title, pageTextBox.Text, LanguageUtil.GetCurrentLanguageString("Validate", className));

            String fileAndPathName = Path.Combine(pathName, fileName);

            if (FileManager.SaveFileCoreWithEncoding(form, fileAndPathName, text) == false)
            {
                return;
            }

            OtherManager.StartProcessBrowser(form, fileAndPathName);
        }
Пример #3
0
        protected override void OnLinkClicked(LinkClickedEventArgs e)
        {
            Form1 form = (Form1)FindForm();

            if (form == null)
            {
                base.OnLinkClicked(e);
                return;
            }

            OtherManager.StartProcessBrowser(form, e.LinkText);
            base.OnLinkClicked(e);
        }
Пример #4
0
 private void diarioDiUnTraduttoreToolStripMenuItem_Click(object sender, EventArgs e)
 {
     OtherManager.StartProcess(this, ConstantUtil.dtURL, OptionManager.GetLanguage(this));
 }
Пример #5
0
 private void licenseAgreementToolStripMenuItem_Click(object sender, EventArgs e)
 {
     OtherManager.StartProcess(this, "License.txt", OptionManager.GetLanguage(this));
 }
Пример #6
0
    /// <summary>
    /// Load control .
    /// </summary>
    private void LoadSocialBoxes()
    {
        List <String> cta_boxes   = new List <String>();
        int           total_boxes = Convert.ToInt32(SocialBoxCount);

        if (!String.IsNullOrEmpty(CTAS))
        {
            try{
                cta_boxes = Regex.Split(CTAS, "{}").ToList();
            }
            catch (Exception ex)
            {
                EventLogProvider.LogException("SocialApp control", "LoadSocialBoxes CTA", ex);
            }
        }
        int           social_count = total_boxes - cta_boxes.Count();
        List <String> obj_list     = new List <String>();

        if (!String.IsNullOrEmpty(InstagramUserID))
        {
            try
            {
                InstagramManager imgr    = new InstagramManager(InstagramOAuthConsumerID, InstagramOAuthConsumerSecret, RedirectURL);
                List <String>    instgrm = imgr.GetRandom(Convert.ToInt32(InstagramUserID), total_boxes).ToList();
                obj_list = obj_list.Concat(instgrm).ToList();
            }
            catch (Exception ex)
            {
                EventLogProvider.LogException("SocialApp control", "LoadSocialBoxes Instagram", ex);
            }
        }
        if (!String.IsNullOrEmpty(TwitterUser))
        {
            try
            {
                TwitterManager tm = new TwitterManager(TwitterOAuthConsumerID, TwitterOAuthConsumerSecret, TwitterOAuthAccessToken, TwitterOAuthAccessSecret);

                List <String> tweet = tm.GetRandomTweet(TwitterUser, total_boxes).ToList();
                obj_list = obj_list.Concat(tweet).ToList();
            }
            catch (Exception ex)
            {
                EventLogProvider.LogException("SocialApp control", "LoadSocialBoxes Twitter", ex);
            }
        }
        if (!String.IsNullOrEmpty(FacebookUserID))
        {
            try
            {
                FacebookManager fmgr   = new FacebookManager(FacebookAuthToken, FacebookAppID, FacebookClientSecret, FacebookRedirectURI);
                List <String>   fbpost = fmgr.GetRandomPost(FacebookUserID, total_boxes).ToList();
                obj_list = obj_list.Concat(fbpost).ToList();
            }
            catch (Exception ex)
            {
                EventLogProvider.LogException("SocialApp control", "LoadSocialBoxes Facebook", ex);
            }
        }
        if (!String.IsNullOrEmpty(youtube_api_key))
        {
            try
            {
                YouTubeManager ytmgr   = new YouTubeManager(youtube_api_key);
                List <String>  ytvideo = ytmgr.GetVideosByPlaylistID(youtube_playlist_id, total_boxes).ToList();
                obj_list = obj_list.Concat(ytvideo).ToList();
            }
            catch (Exception ex)
            {
                EventLogProvider.LogException("SocialApp control", "LoadSocialBoxes Youtube", ex);
            }
        }

        //Randomize the list of social items and take the top # of social boxes
        obj_list = obj_list.OrderBy(x => Guid.NewGuid()).Take(social_count).ToList();

        //CTAs are always shown, add on to the end of the main list
        if (!String.IsNullOrEmpty(CTAS))
        {
            OtherManager  cta_build = new OtherManager();
            List <String> ctas      = cta_build.BuildCTAList(cta_boxes).ToList();
            obj_list = obj_list.Concat(ctas).ToList();
        }

        //If the number of boxes are less than the number requested, fill with backup images
        if ((obj_list.Count() < total_boxes) && !String.IsNullOrEmpty(BackupImages))
        {
            try
            {
                int           num_images = total_boxes - obj_list.Count();
                OtherManager  img_build  = new OtherManager();
                List <String> imgs       = img_build.BuildImageList(s_images_list, num_images).ToList();
                obj_list = obj_list.Concat(imgs).ToList();
            }
            catch (Exception ex)
            {
                EventLogProvider.LogException("SocialApp control", "LoadSocialBoxes BackupImages", ex);
            }
        }

        //randomize again
        obj_list = obj_list.OrderBy(x => Guid.NewGuid()).ToList();

        StringBuilder sb = new StringBuilder();

        foreach (String s in obj_list)
        {
            sb.Append(s);
        }
        community_box_list.InnerHtml = sb.ToString();
    }
Пример #7
0
 private void dictionariesLabel_MouseClick(object sender, MouseEventArgs e)
 {
     OtherManager.StartProcessBrowser(this, ConstantUtil.dtPadURL + "wikipage?title=Dictionaries");
 }
Пример #8
0
        private void startButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (introPanel.Visible)
                {
                    introPanel.Visible = false;
                    infoPanel.Visible  = true;
                    startButton.Text   = LanguageUtil.GetCurrentLanguageString("StartUpdate", Name, internalCulture);
                    Refresh();

                    newThread = new Thread(CheckChangeLog);
                    newThread.IsBackground = true;
                    newThread.Start();
                }
                else if (infoPanel.Visible)
                {
                    infoPanel.Visible    = false;
                    updatePanel.Visible  = true;
                    startButton.Enabled  = false;
                    startButton.Text     = LanguageUtil.GetCurrentLanguageString("Updating", Name, internalCulture);
                    cancelButton.Enabled = false;
                    Refresh();

                    if (!UpdateManager.IsUpdaterVersionUpdated(executablePath, updateTextBox, internalCulture))
                    {
                        startButton.Visible = false;
                    }
                    else
                    {
                        String fromVersion;
                        String toVersion;

                        if (UpdateManager.UpdateProcess(this, executablePath, updateTextBox, updateProgressBar, internalCulture, out fromVersion, out toVersion))
                        {
                            UpdateManager.CommitUpdate(isUserAdmin, "ok", fromVersion, toVersion, executablePath, internalCulture);

                            startButton.Text    = LanguageUtil.GetCurrentLanguageString("Start", Name, internalCulture);
                            startButton.Enabled = true;
                        }
                        else
                        {
                            UpdateManager.CommitUpdate(isUserAdmin, "ko", fromVersion, toVersion, executablePath, internalCulture);

                            startButton.Visible = false;
                        }
                    }

                    cancelButton.Text    = LanguageUtil.GetCurrentLanguageString("Close", Name, internalCulture);
                    cancelButton.Enabled = true;
                }
                else
                {
                    OtherManager.StartProcess(this, "DtPad.exe", internalCulture);
                    Application.Exit();
                }
            }
            catch (Exception exception)
            {
                startButton.Visible  = false;
                cancelButton.Text    = LanguageUtil.GetCurrentLanguageString("Close", Name, internalCulture);
                cancelButton.Enabled = true;

                WindowManager.ShowErrorBox(this, exception.Message, exception, internalCulture);
            }
        }
Пример #9
0
 private void linkLabel_MouseClick(object sender, MouseEventArgs e)
 {
     OtherManager.StartProcessBrowser(this, ConstantUtil.dtPadURL, executablePath, internalCulture);
 }
Пример #10
0
 private void linkLabel_MouseClick(object sender, MouseEventArgs e)
 {
     OtherManager.StartProcess(this, "mailto:" + ConstantUtil.myEmail, internalCulture);
 }
Пример #11
0
 private void linkContattiLabel_Click(object sender, EventArgs e)
 {
     OtherManager.StartProcess(this, ConstantUtil.dtPadContactURL, OptionManager.GetLanguage(this));
 }
Пример #12
0
 private void nextButton_ClickEnd(object sender, EventArgs e)
 {
     OtherManager.StartProcessWorkDirectory(this, Path.Combine(destinationPathTextBox.Text, "DtPad.exe"), destinationPathTextBox.Text, OptionManager.GetLanguage(this));
     Close();
 }
Пример #13
0
 private void regularExpressionPictureBox_Click(object sender, EventArgs e)
 {
     OtherManager.StartProcessBrowser(this, "http://www.regular-expressions.info/");
 }
Пример #14
0
 private void rssPictureBox_Click(object sender, EventArgs e)
 {
     OtherManager.StartProcessBrowser(this, ConstantUtil.dtFeedURL);
 }
Пример #15
0
 private void emailPictureBox_Click(object sender, EventArgs e)
 {
     OtherManager.StartProcess(this, String.Format("mailto:{0}", ConstantUtil.myEmail));
 }