Ejemplo n.º 1
0
        public WebPanelItemCollection SelectRange(IEnumerable <int> list)
        {
            WebPanelItemCollection collection = new WebPanelItemCollection(this.CollectionType);

            collection.AddRange(from n in list select this[n]);
            return(collection);
        }
Ejemplo n.º 2
0
        public static SubDomainItem FindAndMake(string FullName, WebPanelItemCollection topDomainList)
        {
            SubDomainItem foundSubDomain = null;

            if (!string.IsNullOrEmpty(FullName))
            {
                for (int lastPos = 0; lastPos < topDomainList.Count; lastPos++)
                {
                    WebPanelItemBase topDomainNow = topDomainList[lastPos];
                    int pos = FullName.Length - topDomainNow.Name.Length;
                    if (pos <= 1)
                    {
                        continue;
                    }
                    pos = FullName.IndexOf(topDomainNow.Name, (pos - 1)) - 1;
                    if (pos > 0 && FullName[pos] == '.')
                    {
                        foundSubDomain = new SubDomainItem(topDomainNow.Name, FullName.Substring(0, pos));
                        topDomainList.RemoveAt(lastPos);
                        topDomainList.Insert(0, topDomainNow);
                        break;
                    }
                }
            }
            return(foundSubDomain);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Обрабатываем получения элемента списка
        /// </summary>
        private void DisplayListView_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
        {
            ListView listView = sender as ListView;
            Type     dType    = null;

            if (AccountManager.SelectAccount != null && listView != null)
            {
                WebPanelItems.WebPanelItemCollection collection = null;
                if (listView == this.SubDomainListView)
                {
                    dType = typeof(WebPanelItems.SubDomainItem);
                }
                else if (listView == this.DomainListView)
                {
                    dType = typeof(WebPanelItems.DomainItem);
                }
                collection = AccountManager.SelectAccount.PanelItems[dType];
                if (e.ItemIndex != -1 && e.ItemIndex < collection.Count)
                {
                    e.Item = collection[e.ItemIndex].ToListViewItem();
                    if (e.ItemIndex % 2 == 1)
                    {
                        e.Item.UseItemStyleForSubItems = false;
                        foreach (ListViewItem.ListViewSubItem subItem in e.Item.SubItems)
                        {
                            subItem.BackColor = Color.FromArgb(213, 218, 224); //System.Drawing.Color.Azure;
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Открываем форму редактирования выделенных объектов
        /// </summary>
        private void ItemEditButton_Click(object sender, EventArgs e)
        {
            Type     editType = null;
            ListView listView = null;

            WebPanelOptionData.IOptionData options = AccountManager.SelectAccount.WebPanelAPIOptions.Clone() as WebPanelOptionData.IOptionData;
            if (sender.Equals(this.IDomainEditButton))
            {
                editType = typeof(WebPanelItems.DomainItem);
                listView = this.DomainListView;
            }
            else if (sender.Equals(this.ISubDomainEditButton))
            {
                editType = typeof(WebPanelItems.SubDomainItem);
                listView = this.SubDomainListView;
            }
            WebPanelItems.WebPanelItemCollection remCollection = WebPanelAccount.AccountManager.SelectAccount.PanelItems[editType].SelectRange(listView.SelectedIndices.Cast <int>().Select(item => item));
            ActionsTaskForm editForm = new ActionsTaskForm(remCollection, options);

            editForm.FormClosedEvent += new EventHandler <BatchDomainTools.WebPanelCommons.SimpleEventArgs>((_sender, _e) =>
            {
                if ((bool)_e.EventArg)
                {
                    ItemListUpdButton_Click(editType, e);
                }
            });
            editForm.ShowDialog();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Метода получает список с объектами панели
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UpdateList_DoWork(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker worker = sender as BackgroundWorker;

            IWebPanelBasicActions.IGet           getObject  = WebPanelAccount.AccountManager.SelectAccount.WebPanelAPI;
            WebPanelItems.WebPanelItemCollection collection = WebPanelAccount.AccountManager.SelectAccount.PanelItems[(Type)e.Argument];
            worker.ReportProgress(99, "Пытаемся получить список.");
            collection.Clear();
            WebPanelActionResult.ActionResultBase result = getObject.Get(collection);
            if (!result)
            {
                worker.ReportProgress(0, String.Format("Во время получения списка произошла ошибка:[MCOLOR:Red]{0}[/MCOLOR].", result.ErrorMessage));
                e.Result = false;
            }
            else
            {
                e.Result = true;
            }
        }
Ejemplo n.º 6
0
        private void StartActionsButton_Click(object sender, EventArgs e)
        {
            this.LogRTBox.Clear();
            this.ProgressListBox.Items.Clear();
            this.workCollection = new WebPanelItemCollection(this.workType);
            System.Text.RegularExpressions.Regex domainPatern = new System.Text.RegularExpressions.Regex(".+\\..{2,8}$");
            for (int id = 0; id < this.DomaintBox.Lines.Length; id++)
            {
                string Domain = this.DomaintBox.Lines[id].Trim().ToLower().Replace("https://", "").Replace("http://", "");
                int    foundSlashSubdomain = Domain.IndexOf("/");
                if (foundSlashSubdomain != -1)
                {
                    Domain = Domain.Remove(foundSlashSubdomain, Domain.Length - foundSlashSubdomain);
                }
                if (Domain.StartsWith("www."))
                {
                    Domain = Domain.TrimStart('w', '.');
                }
                if (!String.IsNullOrEmpty(Domain) && domainPatern.IsMatch(Domain))
                {
                    this.ProgressListBox.Items.Add(new ListViewItem(Domain)
                    {
                        Name = Domain
                    });
                    this.workCollection.Add(new WebPanelItems.DomainItem(Domain));
                }
            }
            this.DomaintBox.Lines = this.workCollection.ToStringArray();
            if (this.workCollection.Count == 0)
            {
                this.StartAddButton.Enabled = false;
                MessageBox.Show("Прежде чем продолжить, укажите объекты для добавления в правильном формате!");
                this.tablessControl1.SelectedIndex = 0;
                return;
            }
            this.StopAddButton.Enabled = !(this.buttonStepBack.Enabled = this.StartAddButton.Enabled = false);

            this.LogRTBox.WriteToLog("Процесс начат.");
            this.ActionBackGroundWorker.PropertyData = this.PropertyData;
            this.ActionBackGroundWorker.RunWorkerAsync(this.workCollection);
        }