Beispiel #1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="item"></param>
        /// <param name="applicationIcon"></param>
        public NetSparkleForm(NetSparkleAppCastItem item, Icon applicationIcon)
        {
            InitializeComponent();

            // init ui
            try
            {
                NetSparkleBrowser.AllowWebBrowserDrop = false;
                NetSparkleBrowser.AllowNavigation     = false;
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Error in browser init: " + ex.Message);
            }

            _currentItem = item;


            lblHeader.Text   = lblHeader.Text.Replace("APP", item.AppName);
            lblInfoText.Text = lblInfoText.Text.Replace("APP", item.AppName + " " + item.Version);
            lblInfoText.Text = lblInfoText.Text.Replace("OLDVERSION", item.AppVersionInstalled);

            if (!string.IsNullOrEmpty(item.ReleaseNotesLink))
            {
                if (new List <string>(new[] { ".md", ".mkdn", ".mkd", ".markdown" }).Contains(Path.GetExtension(item.ReleaseNotesLink).ToLower()))
                {
                    try
                    {
                        ShowMarkdownReleaseNotes(item);
                    }
                    catch (Exception)
                    {
#if DEBUG
                        throw;
#else
                        NetSparkleBrowser.Navigate(item.ReleaseNotesLink); //just show it raw
#endif
                    }
                }
                else
                {
                    NetSparkleBrowser.Navigate(item.ReleaseNotesLink);
                }
            }
            else
            {
                RemoveReleaseNotesControls();
            }

            imgAppIcon.Image = applicationIcon.ToBitmap();
            Icon             = applicationIcon;

            TopMost = true;
        }
Beispiel #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="item"></param>
        /// <param name="appIcon"></param>
        /// <param name="windowIcon"></param>
        public NetSparkleForm(NetSparkleAppCastItem item, Image appIcon, Icon windowIcon)
        {
            InitializeComponent();

            // init ui
            try
            {
                NetSparkleBrowser.AllowWebBrowserDrop = false;
                NetSparkleBrowser.AllowNavigation     = false;
            }
            catch (Exception)
            { }

            _currentItem = item;

            lblHeader.Text   = lblHeader.Text.Replace("APP", item.AppName);
            lblInfoText.Text = lblInfoText.Text.Replace("APP", item.AppName + " " + item.Version);
            lblInfoText.Text = lblInfoText.Text.Replace("OLDVERSION", item.AppVersionInstalled);

            if (item.ReleaseNotesLink != null && item.ReleaseNotesLink.Length > 0)
            {
                NetSparkleBrowser.Navigate(item.ReleaseNotesLink);
            }
            else
            {
                RemoveReleaseNotesControls();
            }

            if (appIcon != null)
            {
                imgAppIcon.Image = appIcon;
            }

            if (windowIcon != null)
            {
                Icon = windowIcon;
            }

            this.TopMost = true;
        }