예제 #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 OnExtractFileArchivePath(string path)
        {
            // Get the appropriate archive type
            string      extension = Path.GetExtension(path);
            ArchiveFile archive;

            switch (extension.ToLower())
            {
            case ".vol":    archive = new VolFile(path);    break;

            case ".clm":    archive = new ClmFile(path);    break;

            default:
                interactable = true;
                Debug.Log("Invalid archive selected.");
                return;
            }

            // Get list of files from the archive
            List <string> fileNames = new List <string>();

            for (int i = 0; i < archive.GetCount(); ++i)
            {
                fileNames.Add(archive.GetName(i));
            }

            // Open list of file names for selection
            ListSelectDialog.Create(fileNames, "Extract File", "Select", (string fileName) => OnExtractFileSelected(archive, fileName), () => OnExtractFileCanceled(archive));
        }
예제 #3
0
        private void OnImportMapPath(string path)
        {
            string extension = Path.GetExtension(path);

            switch (extension.ToLower())
            {
            case ".vol":
                List <string> fileNames = new List <string>();

                // Get list of map names from the archive
                VolFile vol = new VolFile(path);
                for (int i = 0; i < vol.GetCount(); ++i)
                {
                    string name = vol.GetName(i);
                    if (Path.GetExtension(name).ToLower() == ".map")
                    {
                        fileNames.Add(name);
                    }
                }

                // Open list of map names for selection
                ListSelectDialog.Create(fileNames, "Select Map", "Import", (string mapName) => OnImportMapSelected(vol, mapName), () =>
                {
                    interactable = true;
                    vol.Dispose();
                });

                break;

            default:
                CreateNew_NoRefresh();

                interactable = true;

                if (UserData.current.ImportMap(path))
                {
                    interactable = false;

                    m_MapRenderer.Refresh(() =>
                    {
                        interactable = true;
                        Debug.Log("Import Complete.");
                    });
                }
                else
                {
                    // Import failed
                    interactable = false;

                    m_MapRenderer.Refresh(() =>
                    {
                        interactable = true;
                        Debug.LogError("Failed to read map: " + path);
                    });
                }
                break;
            }
        }
예제 #4
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;
        }
예제 #5
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());
                        }
                    }
                }
            }
        }
예제 #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)))
            {
                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);
        }
예제 #8
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));
                }
            }
        }
예제 #9
0
 public void OnClick_DeleteFile()
 {
     ListSelectDialog.Create(missionData.fileNames, "Delete File", "Delete", OnSelected_DeleteFileName);
 }