Пример #1
0
        private void AddNewScript()
        {
            // выбрать тип скрипта
            var scriptTypes = TerminalScript.GetAllTerminalScripts();
            var dialog      = new ListSelectDialog();

            dialog.Initialize(scriptTypes.Keys.Cast <object>().ToList(), "", Localizer.GetString("TitleSelectScript"));
            if (dialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            var selectedScript = (string)dialog.SelectedItem;

            // создать скрипт с параметрами по-умолчанию
            var script = TerminalScript.MakeScriptByScriptName(selectedScript);

            // добавить в таблицу
            var scripts = gridScripts.rows.Select(r => (TerminalScript)r.ValueObject).ToList();

            scripts.Add(script);
            gridScripts.DataBind(scripts);
            gridScripts.Invalidate();

            // сохранить настройки
            ScriptManager.Instance.UpdateScripts(GetScriptsFromTable());
        }
Пример #2
0
        private void OkButtonClick(object sender, EventArgs e)
        {
            errorProvider.SetError(titleTextBox, "");
            errorProvider.SetError(durationsListBox, "");
            if (titleTextBox.Text == "")
            {
                errorProvider.SetError(titleTextBox, "Введите наименование");
                return;
            }
            var sum = GetTotalDuration();

            if (sum == 0)
            {
                errorProvider.SetError(durationsListBox, "Введите длительности");
                return;
            }
            if (24 * 60 % sum != 0)
            {
                var durations = new List <string>();
                var n         = 1;
                while (true)
                {
                    var x = 24 * 60 / n - sum;
                    if (x > 0 && x < 60 && durations.Count == 0)
                    {
                        durations.Add(String.Format("0:{0:D2}", x));
                        break;
                    }
                    if (x < 60)
                    {
                        break;
                    }
                    durations.Add(String.Format("{0}:{1:D2}", x / 60, x % 60));
                    n++;
                }
                var text = Localizer.GetString("MessageIntervalLackedInChronometer");
                if (durations.Count == 0)
                {
                    MessageBox.Show(this,
                                    text,
                                    Localizer.GetString("TitleWarning"),
                                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                else
                {
                    var form = new ListSelectDialog();
                    form.Initialize(durations.Select(o => o as object), text +
                                    ".\n\n" + Localizer.GetString("MessageChronometerChoseLength") + ":");
                    if (form.ShowDialog(this) == DialogResult.Cancel)
                    {
                        return;
                    }
                    durationsListBox.Items.Add(form.SelectedItem);
                    UpdateDurations();
                }
            }
            DialogResult = DialogResult.OK;
        }
Пример #3
0
        private void GridUserHitCell(object sender, MouseEventArgs e, int rowIndex, FastColumn col)
        {
            if (e.Button != MouseButtons.Left)
            {
                return;
            }
            var selPerformer = (PerformerStatEx)grid.rows[rowIndex].ValueObject;

            if (col.PropertyName == selPerformer.Property(t => t.IsSubscribed))
            {
                PerformerStatistic.SubscribeOrUnsubscribe(selPerformer, true);
                if (PageTargeted != null)
                {
                    PageTargeted(SubscriptionControl.ActivePage.Subscription);
                }
            }
            else if ((col.PropertyName == selPerformer.Property(t => t.TradeSignalTitle) ||
                      col.PropertyName == selPerformer.Property(t => t.ChartIndex) ||
                      col.PropertyName == selPerformer.Property(t => t.Login)))
            {
                var form = new SubscriberStatisticsForm(selPerformer);
                form.EnterRoomRequested += OnEnterRoomRequested;
                form.pageTargeted       += p => { if (PageTargeted != null)
                                                  {
                                                      PageTargeted(p);
                                                  }
                };
                form.Show(this);
            }
            else if (col.PropertyName == selPerformer.Property(t => t.UserScore))
            {
                //ChangeCriteria();
            }
            else if (col.PropertyName == selPerformer.Property(t => t.Rooms))
            {
                var performer = (PerformerStatEx)grid.rows[rowIndex].ValueObject;
                if (EnterRoomRequested != null && !string.IsNullOrEmpty(performer.Rooms))
                {
                    var rooms = performer.Rooms.Split(new[] { ", " }, StringSplitOptions.None);
                    if (rooms.Length == 1)
                    {
                        EnterRoomRequested(rooms[0]);
                    }
                    else
                    {
                        var form = new ListSelectDialog();
                        form.Initialize(rooms.Select(o => o as object), "Выберите комнату чата:");
                        if (form.ShowDialog(this) == DialogResult.OK)
                        {
                            EnterRoomRequested(form.SelectedItem.ToString());
                        }
                    }
                }
            }
        }
Пример #4
0
        private void buttonAddProperty_Click(object sender, EventArgs e)
        {
            List <KeyValuePair <string, object> > properties = new List <KeyValuePair <string, object> >();

            foreach (KeyValuePair <Guid, string> kvp in ApplicationServices.GetAvailableModules <IPropertyModuleInstance>())
            {
                properties.Add(new KeyValuePair <string, object>(kvp.Value, kvp.Key));
            }
            using (ListSelectDialog addForm = new ListSelectDialog("Add Property", (properties)))
            {
                if (addForm.ShowDialog() == DialogResult.OK)
                {
                    _displayedNode.Properties.Add((Guid)addForm.SelectedItem);
                    PopulatePropertiesArea(_displayedNode);

                    _changesMade = true;
                }
            }
        }
        private void MenuItemAddButtonClick(object sender, EventArgs e)
        {
            var dialog = new ListSelectDialog();

            dialog.Initialize(ChartToolButtonStorage.Instance.allButtons.Where(b => b.ButtonType == buttonType));
            if (dialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            var button = dialog.SelectedItem as ChartToolButtonSettings;

            if (button == null)
            {
                return;
            }
            var item = new TreeNode(button.ToString(), button.Image, button.Image);

            treeButtons.Nodes.Add(item);
            item.Tag = new ChartToolButtonSettings(button);
        }
Пример #6
0
        private void buttonAddProperty_Click(object sender, EventArgs e)
        {
            List <KeyValuePair <string, object> > properties = new List <KeyValuePair <string, object> >();

            foreach (KeyValuePair <Guid, string> kvp in ApplicationServices.GetAvailableModules <IPropertyModuleInstance>())
            {
                properties.Add(new KeyValuePair <string, object>(kvp.Value, kvp.Key));
            }
            using (ListSelectDialog addForm = new ListSelectDialog("Add Property", (properties))) {
                addForm.SelectionMode = SelectionMode.One;
                if (addForm.ShowDialog() == DialogResult.OK)
                {
                    // TODO: something smarter about picking subelements vs. applying it to the groups. For now, will just apply it to the actual selected items.

                    foreach (ElementNode node in elementTree.SelectedElementNodes)
                    {
                        node.Properties.Add((Guid)addForm.SelectedItem);
                    }

                    UpdateFormWithNode();
                    OnElementsChanged(new ElementsChangedEventArgs(ElementsChangedEventArgs.ElementsChangedAction.Edit));
                }
            }
        }