Пример #1
0
        private void BtnOkClick(object sender, EventArgs e)
        {
            option.AllowLogUsage                    = chkAllowUsageStatistics.Checked;
            option.DisplayLargeIcons                = rdbToolsListLarge.Checked;
            option.CloseEachPluginSilently          = chkCloseEachPluginSilently.Checked;
            option.CloseOpenedPluginsSilently       = chkClosePluginsSilently.Checked;
            option.DisplayPluginsStoreOnStartup     = chkDisplayPluginsStoreOnStartup.Checked;
            option.DisplayPluginsStoreOnlyIfUpdates = chkDisplayPluginsStoreOnlyIfUpdates.Checked;
            option.DoNotCheckForUpdates             = chkDoNotCheckForUpdate.Checked;
            option.MergeConnectionFiles             = chkMergeConnectionFiles.Checked;
            option.RememberSession                  = chkRememberSession.Checked;
            option.ReuseConnections                 = chkReuseConnections.Checked;
            option.DisplayOrder      = cbbDisplayOrder.SelectedItem.ToString();
            option.MruItemsToDisplay = Convert.ToInt32(nudMruItemsToDisplay.Value);
            option.DoNotRememberPluginsWithoutConnection = chkDoNotRememberPluginsNotConnected.Checked;
            option.DoNotShowStartPage = chkDoNotShowAtStartup.Checked;
            option.ShowPluginUpdatesPanelAtStartup = chkDisplayPluginsUpdatePanel.Checked;
            option.Theme = cbbTheme.SelectedItem?.ToString() ?? "Default theme";

            option.HiddenPlugins =
                lvPlugins.Items.Cast <ListViewItem>().Where(i => i.Checked == false).Select(i => i.Text).ToList();

            option.Save();

            if (cbbProxyUsage.SelectedIndex == 2)
            {
                ConnectionManager.Instance.ConnectionsList.UseCustomProxy           = true;
                ConnectionManager.Instance.ConnectionsList.UseInternetExplorerProxy = false;
                ConnectionManager.Instance.ConnectionsList.ProxyAddress             = txtProxyAddress.Text;
                ConnectionManager.Instance.ConnectionsList.UserName              = txtProxyUser.Text;
                ConnectionManager.Instance.ConnectionsList.Password              = txtProxyPassword.Text;
                ConnectionManager.Instance.ConnectionsList.ByPassProxyOnLocal    = chkByPassProxyOnLocal.Checked;
                ConnectionManager.Instance.ConnectionsList.UseDefaultCredentials = !rbCustomAuthYes.Checked;
            }
            else
            {
                ConnectionManager.Instance.ConnectionsList.UseInternetExplorerProxy = cbbProxyUsage.SelectedIndex == 1;
                ConnectionManager.Instance.ConnectionsList.UseCustomProxy           = false;
                ConnectionManager.Instance.ConnectionsList.ProxyAddress             = null;
                ConnectionManager.Instance.ConnectionsList.UserName              = null;
                ConnectionManager.Instance.ConnectionsList.Password              = null;
                ConnectionManager.Instance.ConnectionsList.ByPassProxyOnLocal    = false;
                ConnectionManager.Instance.ConnectionsList.UseDefaultCredentials = false;
            }

            try
            {
                WebProxyHelper.ApplyProxy();

                ConnectionManager.Instance.SaveConnectionsFile();

                DialogResult = DialogResult.OK;
                Close();
            }
            catch (Exception error)
            {
                MessageBox.Show(this, "An error occured: " + error.Message, "Error", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
        }
Пример #2
0
        public async Task <ActionResult> EditFilm(int id, FilmViewModel updatedFilm)
        {
            var film = FilmStore.Films.SingleOrDefault(x => x.Id == id);
            var url  = WebProxyHelper.RemoveProxyDecoration(updatedFilm.Url);

            if (film == null)
            {
                return(_Failure("Film with id {0} not found!", id));
            }

            var parser = await WebsiteParserFactory.CreateParserForUrl(url);

            if (parser == null)
            {
                return(_Failure("No parser found for {0}!", url));
            }

            film.Name     = updatedFilm.Name;
            film.Url      = url;
            film.Season   = updatedFilm.Season;
            film.Episode  = updatedFilm.Episode;
            film.CoverUrl = updatedFilm.CoverUrl;

            await FilmStore.SaveChangesAsync();

            return(_Success());
        }
Пример #3
0
        public async Task <ActionResult> AddFilm(FilmViewModel model)
        {
            var url = WebProxyHelper.RemoveProxyDecoration(model.Url);

            var film = new Film
            {
                Name       = model.Name,
                Url        = url,
                CoverUrl   = model.CoverUrl,
                Season     = model.Season > 0 ? model.Season : 1,
                Episode    = model.Episode > 0 ? model.Episode : 1,
                IsFavorite = model.IsFavorite
            };

            var parser = await WebsiteParserFactory.CreateParserForUrl(url);

            if (parser == null)
            {
                return(_Failure("No parser found for {0}!", url));
            }

            film.IsFavorite = true;

            FilmStore.AddFilm(film);
            await FilmStore.SaveChangesAsync();

            return(_Success());
        }
Пример #4
0
        private void InitialiseApplication()
        {
            //TASK: Load the global SkyCity proxy server list
            webProxyServersList = WebProxyHelper.ReturnSkyCityWebProxyServerList();

            //TASK: Load the visible proxy list combo with proxy server entries
            InitializeProxyListControl();

            RefreshProxySettings();
        }
Пример #5
0
        private void BtnOkClick(object sender, EventArgs e)
        {
            option.AllowLogUsage                = chkAllowUsageStatistics.Checked;
            option.DisplayLargeIcons            = rdbToolsListLarge.Checked;
            option.DisplayMostUsedFirst         = chkDisplayMuFirst.Checked;
            option.CloseEachPluginSilently      = chkCloseEachPluginSilently.Checked;
            option.CloseOpenedPluginsSilently   = chkClosePluginsSilently.Checked;
            option.DisplayPluginsStoreOnStartup = chkDisplayPluginsStoreOnStartup.Checked;
            option.DoNotCheckForUpdates         = chkDoNotCheckForUpdate.Checked;

            option.HiddenPlugins =
                lvPlugins.Items.Cast <ListViewItem>().Where(i => i.Checked == false).Select(i => i.Text).ToList();

            option.Save();

            if (cbbProxyUsage.SelectedIndex == 2)
            {
                ConnectionManager.Instance.ConnectionsList.UseCustomProxy           = true;
                ConnectionManager.Instance.ConnectionsList.UseInternetExplorerProxy = false;
                ConnectionManager.Instance.ConnectionsList.ProxyAddress             = txtProxyAddress.Text;
                ConnectionManager.Instance.ConnectionsList.UserName              = txtProxyUser.Text;
                ConnectionManager.Instance.ConnectionsList.Password              = txtProxyPassword.Text;
                ConnectionManager.Instance.ConnectionsList.ByPassProxyOnLocal    = chkByPassProxyOnLocal.Checked;
                ConnectionManager.Instance.ConnectionsList.UseDefaultCredentials = !rbCustomAuthYes.Checked;
            }
            else
            {
                ConnectionManager.Instance.ConnectionsList.UseInternetExplorerProxy = cbbProxyUsage.SelectedIndex == 1;
                ConnectionManager.Instance.ConnectionsList.UseCustomProxy           = false;
                ConnectionManager.Instance.ConnectionsList.ProxyAddress             = null;
                ConnectionManager.Instance.ConnectionsList.UserName              = null;
                ConnectionManager.Instance.ConnectionsList.Password              = null;
                ConnectionManager.Instance.ConnectionsList.ByPassProxyOnLocal    = false;
                ConnectionManager.Instance.ConnectionsList.UseDefaultCredentials = false;
            }

            try
            {
                WebProxyHelper.ApplyProxy();

                ConnectionManager.Instance.SaveConnectionsFile();

                DialogResult = DialogResult.OK;
                Close();
            }
            catch (Exception error)
            {
                MessageBox.Show(this, "An error occured: " + error.Message, "Error", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
        }
Пример #6
0
        private void BtnOkClick(object sender, EventArgs e)
        {
            Option = (Options)propertyGrid1.SelectedObject;
            Option.OptinForApplicationInsights = chkOptinAI.Checked;

            Option.Save();

            if (cbbProxyUsage.SelectedIndex == 2)
            {
                ConnectionManager.Instance.ConnectionsList.UseCustomProxy           = true;
                ConnectionManager.Instance.ConnectionsList.UseInternetExplorerProxy = false;
                ConnectionManager.Instance.ConnectionsList.ProxyAddress             = txtProxyAddress.Text;
                ConnectionManager.Instance.ConnectionsList.UserName              = txtProxyUser.Text;
                ConnectionManager.Instance.ConnectionsList.Password              = txtProxyPassword.Text;
                ConnectionManager.Instance.ConnectionsList.ByPassProxyOnLocal    = chkByPassProxyOnLocal.Checked;
                ConnectionManager.Instance.ConnectionsList.UseDefaultCredentials = !rbCustomAuthYes.Checked;
            }
            else
            {
                ConnectionManager.Instance.ConnectionsList.UseInternetExplorerProxy = cbbProxyUsage.SelectedIndex == 1;
                ConnectionManager.Instance.ConnectionsList.UseCustomProxy           = false;
                ConnectionManager.Instance.ConnectionsList.ProxyAddress             = null;
                ConnectionManager.Instance.ConnectionsList.UserName              = null;
                ConnectionManager.Instance.ConnectionsList.Password              = null;
                ConnectionManager.Instance.ConnectionsList.ByPassProxyOnLocal    = false;
                ConnectionManager.Instance.ConnectionsList.UseDefaultCredentials = false;
            }

            try
            {
                WebProxyHelper.ApplyProxy();

                ConnectionManager.Instance.SaveConnectionsFile();

                DialogResult = DialogResult.OK;
                Close();
            }
            catch (Exception error)
            {
                MessageBox.Show(this, @"An error occured: " + error.Message, @"Error", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
        }
Пример #7
0
        public ActionResult Index(bool allFilms = false)
        {
            ViewBag.FavoritesClass     = allFilms ? "" : "selected";
            ViewBag.AllFilmsClass      = allFilms ? "selected" : "";
            ViewBag.CanChangeSortIndex = allFilms == false;

            var list = allFilms
                ? FilmStore.Films.OrderBy(x => x.Name).ToList()
                : FilmStore.Films.Where(x => x.IsFavorite).OrderBy(x => x.SortIndex).ToList();

            var films = list.Select(f => new FilmViewModel
            {
                Id             = f.Id,
                Name           = f.Name,
                Season         = f.Season,
                Episode        = f.Episode,
                IsFavorite     = f.IsFavorite,
                Url            = WebProxyHelper.DecorateUrl(f.Url),
                UndecoratedUrl = f.Url,
                CoverUrl       = f.CoverUrl
            });

            return(View(films.ToList()));
        }
Пример #8
0
        private async void MainForm_Load(object sender, EventArgs e)
        {
            this.Opacity = 0;

            tstxtFilterPlugin.Focus();

            pManager = new PluginManagerExtended(this)
            {
                IsWatchingForNewPlugins = true
            };
            pManager.Initialize();
            pManager.PluginsListUpdated += pManager_PluginsListUpdated;

            tstxtFilterPlugin.AutoCompleteCustomSource.AddRange(pManager.Plugins.Select(p => p.Metadata.Name).ToArray());

            this.DisplayPlugins();

            var tasks = new List <Task>
            {
                this.LaunchWelcomeDialog(),
                this.CheckForPluginsUpdate(),
            };

            //if (!Debugger.IsAttached)
            //{
            tasks.Add(this.LaunchVersionCheck());
            //}

            if (!string.IsNullOrEmpty(this.initialConnectionName))
            {
                var connectionDetail = ConnectionManager.Instance.ConnectionsList.Connections.FirstOrDefault(x => x.ConnectionName == this.initialConnectionName);;

                if (connectionDetail != null)
                {
                    // If initiall connection is present, connect to given sever is initiated.
                    // After connection try to open intial plugin will be attempted.
                    tasks.Add(this.launchInitialConnection(connectionDetail));
                }
                else
                {
                    // Connection detail was not found, so name provided was incorrect.
                    // But if name of the plugin is set, it should be started
                    if (!string.IsNullOrEmpty(this.initialPluginName))
                    {
                        this.StartPluginWithoutConnection();
                    }
                }
            }
            else if (!string.IsNullOrEmpty(this.initialPluginName))
            {
                // If there is no initial connection, but initial plugin is set, openning plugin
                this.StartPluginWithoutConnection();
            }

            tasks.ForEach(x => x.Start());

            await Task.WhenAll(tasks.ToArray());

            // Adapt size of current form
            if (currentOptions.Size.IsMaximized)
            {
                WindowState = FormWindowState.Maximized;
            }
            else
            {
                currentOptions.Size.ApplyFormSize(this);
            }

            AdaptPluginControlSize();

            WebProxyHelper.ApplyProxy();

            this.Opacity = 100;

            if (!currentOptions.AllowLogUsage.HasValue)
            {
                currentOptions.AllowLogUsage = LogUsage.PromptToLog();
                currentOptions.Save();
            }

            if (currentOptions.DisplayPluginsStoreOnStartup)
            {
                var dlg = new PluginsChecker();
                dlg.ShowDialog(this);
            }
        }
Пример #9
0
        private async void MainForm_Load(object sender, EventArgs e)
        {
            WebProxyHelper.ApplyProxy();

            pManager = new PluginManagerExtended(this)
            {
                IsWatchingForNewPlugins = true
            };
            pManager.Initialize();
            pManager.PluginsListUpdated += pManager_PluginsListUpdated;

            tstxtFilterPlugin.AutoCompleteCustomSource.AddRange(pManager.Plugins.Select(p => p.Metadata.Name).ToArray());

            blackScreen.SetWorkingMessage("Loading plugins...");
            DisplayPlugins();

            var tasks = new List <Task>
            {
                LaunchVersionCheck()
            };

            if (!string.IsNullOrEmpty(initialConnectionName))
            {
                var connectionDetail = ConnectionManager.Instance.ConnectionsList.Connections.FirstOrDefault(x => x.ConnectionName == initialConnectionName);;

                if (connectionDetail != null)
                {
                    // If initiall connection is present, connect to given sever is initiated.
                    // After connection try to open intial plugin will be attempted.
                    tasks.Add(launchInitialConnection(connectionDetail));
                }
                else
                {
                    // Connection detail was not found, so name provided was incorrect.
                    // But if name of the plugin is set, it should be started
                    if (!string.IsNullOrEmpty(initialPluginName))
                    {
                        StartPluginWithoutConnection();
                    }
                }
            }
            else if (!string.IsNullOrEmpty(initialPluginName))
            {
                // If there is no initial connection, but initial plugin is set, openning plugin
                StartPluginWithoutConnection();
            }

            tasks.ForEach(x => x.Start());
            await Task.WhenAll(tasks.ToArray());

            // Adapt size of current form
            if (currentOptions.Size.IsMaximized)
            {
                WindowState = FormWindowState.Maximized;
            }
            else
            {
                currentOptions.Size.ApplyFormSize(this);
            }

            AdaptPluginControlSize();

            // Hide & remove Welcome screen
            Opacity = 100;
            blackScreen.Hide();
            blackScreen.Dispose();

            if (!currentOptions.AllowLogUsage.HasValue)
            {
                currentOptions.AllowLogUsage = LogUsage.PromptToLog();
                currentOptions.Save();
            }

            if (currentOptions.DisplayPluginsStoreOnStartup)
            {
                if (currentOptions.DisplayPluginsStoreOnlyIfUpdates)
                {
                    if (store == null)
                    {
                        store = new Store();
                    }

                    if (store.Packages == null)
                    {
                        store.LoadNugetPackages();
                    }

                    if (store.Packages.Any(p => p.Action == PluginsStore.PackageInstallAction.Update))
                    {
                        pbOpenPluginsStore_Click(sender, e);
                    }
                }
                else
                {
                    pbOpenPluginsStore_Click(sender, e);
                }
            }

            Action action = CheckForPluginsUpdate;

            action.BeginInvoke(ar => action.EndInvoke(ar), null);

            tstxtFilterPlugin.Focus();
        }
Пример #10
0
        private async void MainForm_Load(object sender, EventArgs e)
        {
            this.Opacity = 0;

            pManager = new PluginManager();
            pManager.LoadPlugins();

            this.DisplayPlugins();

            var tasks = new List <Task>
            {
                this.LaunchWelcomeDialog(),
                this.LaunchVersionCheck()
            };

            if (!string.IsNullOrEmpty(this.initialConnectionName))
            {
                var connectionDetail = ConnectionManager.Instance.ConnectionsList.Connections.FirstOrDefault(x => x.ConnectionName == this.initialConnectionName);;

                if (connectionDetail != null)
                {
                    // If initiall connection is present, connect to given sever is initiated.
                    // After connection try to open intial plugin will be attempted.
                    tasks.Add(this.launchInitialConnection(connectionDetail));
                }
                else
                {
                    // Connection detail was not found, so name provided was incorrect.
                    // But if name of the plugin is set, it should be started
                    if (!string.IsNullOrEmpty(this.initialPluginName))
                    {
                        this.StartPluginWithoutConnection();
                    }
                }
            }
            else if (!string.IsNullOrEmpty(this.initialPluginName))
            {
                // If there is no initial connection, but initial plugin is set, openning plugin
                this.StartPluginWithoutConnection();
            }

            tasks.ForEach(x => x.Start());

            await Task.WhenAll(tasks.ToArray());

            // Adapt size of current form
            if (currentOptions.Size.IsMaximized)
            {
                WindowState = FormWindowState.Maximized;
            }
            else
            {
                currentOptions.Size.ApplyFormSize(this);
            }

            AdaptPluginControlSize();

            WebProxyHelper.ApplyProxy();

            this.Opacity = 100;
        }
Пример #11
0
 private void SetProxyEnabledStatusControl(ref bool lastProxyEnabledState)
 {
     chkIsSelectedProxyEnabled.Checked = WebProxyHelper.IsProxyEnabled();
     lastProxyEnabledState             = chkIsSelectedProxyEnabled.Checked;
 }