private void AddChargeToReportListbox(ArrestChargeLineItem lineItem)
 {
     lb_charges.AddRow(
         String.Format("({0}) {1}", lineItem.IsFelony ? "F" : "M", lineItem.Charge)
         , lineItem.Charge,
         lineItem
         ).Clicked += ChargeRowSelected;
 }
Ejemplo n.º 2
0
 private void RecentTextChangedHandler()
 {
     list_recent.Clear();
     foreach (string r in EntryPoint.recent_text.Reverse <String>())
     {
         list_recent.AddRow(r);
     }
 }
        private void FillData()
        {
            evidence_values_box.AddRow(String.Format("{0}{1}{2}{3}{4}", "Evidence Name", " | ",
                                                     "Traces found on Evidence", " | ", "Evidence Importance Level"));
            foreach (var data in _eList)
            {
                if (!data.Collected)
                {
                    continue;
                }
                ;

                var testResult = data.IsTested ? data.Importance.ToString() : "Not tested";

                evidence_values_box.AddRow(String.Format("{0}{1}{2}{3}{4}", data.Name.PadRight(24), "   ",
                                                         data.Trace.ToString().PadRight(34), "   ", testResult));
            }
        }
Ejemplo n.º 4
0
        private void UpdateCamerasListBox()
        {
            camerasListBox.Clear();

            camerasListBox.AddRow("Gameplay camera", "gameplayCam", null);

            foreach (var(cameraValue, index) in Scenario.CameraSettings.Cameras.WithIndex())
            {
                string rowLabel = $"Camera {index}";
                string rowName  = $"camera{index}";
                camerasListBox.AddRow(rowLabel, rowName, cameraValue);
            }

            if (camerasListBox.RowCount == 0)
            {
                deleteCameraButton.Disable();
                viewCameraButton.Disable();
            }
        }
Ejemplo n.º 5
0
        private void AddQuestToList(string name, Color clr, Guid questId)
        {
            var item = mQuestList.AddRow(name);

            item.UserData  = questId;
            item.Clicked  += QuestListItem_Clicked;
            item.Selected += Item_Selected;
            item.SetTextColor(clr);
            item.RenderColor = new Color(50, 255, 255, 255);
        }
Ejemplo n.º 6
0
        private void UpdateItemList()
        {
            m_Items.Clear();

            IOrderedEnumerable <IFileSystemDirectoryInfo> directories;
            IOrderedEnumerable <IFileSystemFileInfo>      files = null;

            try
            {
                directories = GetDirectories(m_CurrentFolder).OrderBy(di => di.Name);
                if (!m_FoldersOnly)
                {
                    files = GetFiles(m_CurrentFolder, m_CurrentFilter).OrderBy(fi => fi.Name);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(View, ex.Message, Title, MessageBoxButtons.OK);
                return;
            }

            foreach (IFileSystemDirectoryInfo di in directories)
            {
                ListBoxRow row = m_Items.AddRow(di.Name, null, di.FullName);
                row.SetCellText(1, "<dir>");
                row.SetCellText(2, di.FormattedLastWriteTime);
            }

            if (!m_FoldersOnly)
            {
                foreach (IFileSystemFileInfo fi in files)
                {
                    ListBoxRow row = m_Items.AddRow(fi.Name, null, fi.FullName);
                    row.SetCellText(1, fi.FormattedFileLength);
                    row.SetCellText(2, fi.FormattedFileLength);
                }
            }
        }
Ejemplo n.º 7
0
        private void ListSongs(ControlBase parent)
        {
            ListBox Songs = new ListBox(parent);

            Songs.AllowMultiSelect = false;
            Songs.RowSelected     += (o, e) =>
            {
                var str  = (string)e.SelectedItem.UserData;
                var song = _editor.Song;
                song.Location = str;
                _editor.Song  = song;
            };
            Songs.Dock = Dock.Fill;
            var filedir = Program.UserDirectory + "Songs";

            if (Directory.Exists(filedir))
            {
                var      songfiles          = Directory.GetFiles(filedir, "*.*");
                var      supportedfiles     = new List <string>();
                string[] supportedfiletypes = new string[]
                {
                    ".mp3", ".wav", ".wave", ".ogg", ".wma", ".m4a", ".aac"
                };

                foreach (var file in songfiles)
                {
                    var lower = file.ToLower(Program.Culture);
                    foreach (var type in supportedfiletypes)
                    {
                        if (lower.EndsWith(type, StringComparison.OrdinalIgnoreCase))
                        {
                            supportedfiles.Add(file);
                            break;
                        }
                    }
                }

                foreach (var sf in supportedfiles)
                {
                    var name     = Path.GetFileName(sf);
                    var nodename = IsOgg(name) ? name : "[convert] " + name;
                    var node     = Songs.AddRow(nodename);
                    node.UserData = name;
                    if (name == _editor.Song.Location)
                    {
                        Songs.SelectRow(node, true);
                    }
                }
            }
        }
Ejemplo n.º 8
0
        public override void InitializeLayout()
        {
            base.InitializeLayout();
            this.Window.Skin.SetDefaultFont(Configs.FontName, Configs.FontSize);
            this.cb_toggle_background.IsChecked = Globals.ShowBackgroundWhenOpen;
            this.cb_toggle_pause.IsChecked      = Globals.PauseGameWhenOpen;
            this.btn_logout.Clicked            += this.LogoutButtonClickedHandler;
            this.btn_ped_db.Clicked            += this.PedDBButtonClickedHandler;
            this.btn_veh_db.Clicked            += this.VehDBButtonClickedHandler;
            this.btn_request.Clicked           += this.RequestBackupButtonClickedHandler;
            this.btn_notepad.Clicked           += OpenNotepadHandler;
            //this.btn_arrest_report.Clicked += this.ReportsClickedHandler;
            //this.btn_browse_report.Clicked += this.ReportsClickedHandler;

            this.btn_browse_report.Disable();
            this.btn_browse_report.Hide();
            this.btn_arrest_report.Disable();
            this.btn_arrest_report.Hide();

            this.cb_toggle_background.CheckChanged += checkbox_change;
            this.cb_toggle_pause.CheckChanged      += checkbox_change;
            this.Window.KeyboardInputEnabled        = true;

            GameFiber.StartNew(() =>
            {
                while (true)
                {
                    if (this.cb_toggle_pause.IsChecked != Globals.PauseGameWhenOpen)
                    {
                        this.cb_toggle_pause.IsChecked = Globals.PauseGameWhenOpen;
                    }
                    GameFiber.Yield();
                }
            });
            this.btn_activecalls.Clicked += this.ActiveCallsClickedHandler;
            this.Window.DisableResizing();
            foreach (string r in EntryPoint.recent_text)
            {
                list_recent.AddRow(r);
            }
            this.Position = new Point(Game.Resolution.Width / 2 - this.Window.Width / 2, Game.Resolution.Height / 2 - this.Window.Height / 2);

            if (ShouldShowExtraUIControls)
            {
                ControlExternalUISelectVisibility(ShouldShowExtraUIControls);
                external_ui_default = list_external_ui.AddItem("Select One", "placeholder");
                Globals.SortedExternalUI.ToList().ForEach(x => list_external_ui.AddItem(x.DisplayName, x.Identifier.ToString()));
                list_external_ui.ItemSelected += ExternalUISelected;
            }
        }
Ejemplo n.º 9
0
        private void FillData()
        {
            lab_progress_bar.Value = 0.01f;
            foreach (var data in _eList)
            {
                if (!data.Collected)
                {
                    continue;
                }

                lab_item_box.AddRow(String.Format("{0}{1}",
                                                  Rand.RandomNumber(300, 333333).ToString().PadRight(15),
                                                  data.Name));
            }
        }
Ejemplo n.º 10
0
        private void UpdatePedsInListBox()
        {
            lb_allParties.Clear();
            if (Report == null)
            {
                return;
            }

            var filter  = (ArrestReportAdditionalParty.PartyTypes) this.RightDock.TabControl.CurrentButton.UserData;
            var parties = filter == ArrestReportAdditionalParty.PartyTypes.UNKNOWN ? Report.AdditionalParties.ToArray() : Report.AdditionalParties.Where(x => x.PartyType == filter).ToArray();

            if (filter == ArrestReportAdditionalParty.PartyTypes.UNKNOWN)
            {
                //Add the Arrestee to the "All" list
                if (!String.IsNullOrWhiteSpace(Report.FullName))
                {
                    lb_allParties.AddRow(Report.FullName, Report.Id(), Report);
                }
            }
            foreach (var party in parties)
            {
                lb_allParties.AddRow(party.FullName, party.Id(), party);
            }
        }
Ejemplo n.º 11
0
 public override void InitializeLayout()
 {
     base.InitializeLayout();
     this.btn_logout.Clicked  += this.LogoutButtonClickedHandler;
     this.btn_ped_db.Clicked  += this.PedDBButtonClickedHandler;
     this.btn_veh_db.Clicked  += this.VehDBButtonClickedHandler;
     this.btn_request.Clicked += this.RequestBackupButtonClickedHandler;
     //this.btn_ReportMain.Clicked += this.ReportMainClickedHandler;  // Fiskey111 Edit
     this.btn_activecalls.Clicked += this.ActiveCallsClickedHandler;
     this.Window.DisableResizing();
     foreach (string r in EntryPoint.recent_text)
     {
         list_recent.AddRow(r);
     }
     this.Position = new Point(Game.Resolution.Width / 2 - this.Window.Width / 2, Game.Resolution.Height / 2 - this.Window.Height / 2);
     if (!Function.IsBackgroundEnabled())
     {
         Function.EnableBackground();
     }
 }
Ejemplo n.º 12
0
        private void AddChargeToListBox(ArrestChargeLineItem charge)
        {
            if (charge == null || lb_charges == null)
            {
                return;
            }
            var row = lb_charges.AddRow(
                String.Format("{0}. {1}", lb_charges.RowCount + 1, charge.Charge),
                charge.id.ToString(),
                charge
                );

            if (!String.IsNullOrWhiteSpace(charge.Note))
            {
                row.SetToolTipText(charge.Note);
                row.SetCellText(0, "* " + row.Text);
            }
            if (charge.IsFelony)
            {
                row.SetCellText(0, row.Text + " (Felony)");
            }
        }
Ejemplo n.º 13
0
        internal static ListBoxRow AddPed(this ListBox listBox, Tuple <Ped, Persona> ped)
        {
            if (listBox == null)
            {
                return(null);
            }
            String rowId = String.Format("{0}_{1}",
                                         ped.Item2.Forename,
                                         ped.Item2.Surname
                                         );
            ListBoxRow previousRow = listBox.FindChildByName(rowId) as ListBoxRow;

            if (previousRow == null)
            {
                listBox.AddRow(
                    String.Format("({0}) {1} | {2}", ped.Item2.Gender == Gender.Male ? "M" : "F", ped.Item2.FullName, ped.Item2.BirthDay.ToString("MMMM dd yyyy")),
                    String.Format("{0}_{1}", ped.Item2.Forename, ped.Item2.Surname),
                    ped);
            }

            return(previousRow);
        }
Ejemplo n.º 14
0
        public void UpdateList()
        {
            //Clear previous instances if already existing
            if (mGuildMembers != null)
            {
                mGuildMembers.Clear();
            }

            foreach (var f in Globals.Me.GuildMembers)
            {
                var str = f.Online ? Strings.Guilds.OnlineListEntry : Strings.Guilds.OfflineListEntry;
                var row = mGuildMembers.AddRow(str.ToString(Options.Instance.Guild.Ranks[f.Rank].Title, f.Name, f.Map));
                row.Name = "GuildMemberRow";
                row.LoadJsonUi(GameContentManager.UI.InGame, Graphics.Renderer.GetResolutionString());
                row.SetToolTipText(Strings.Guilds.Tooltip.ToString(f.Level, f.Class));
                row.UserData      = f;
                row.Clicked      += member_Clicked;
                row.RightClicked += member_RightClicked;

                //Row Render color (red = offline, green = online)
                if (f.Online == true)
                {
                    row.SetTextColor(Color.Green);
                }
                else
                {
                    row.SetTextColor(Color.Red);
                }

                row.RenderColor = new Color(50, 255, 255, 255);
            }

            //Determine if we can invite
            mAddButton.IsHidden        = Globals.Me == null || Globals.Me.GuildRank == null || !Globals.Me.GuildRank.Permissions.Invite || !mAddButtonUsed;
            mTextboxContainer.IsHidden = Globals.Me == null || Globals.Me.GuildRank == null || !Globals.Me.GuildRank.Permissions.Invite || !mAddButtonUsed;
            mAddPopupButton.IsHidden   = Globals.Me == null || Globals.Me.GuildRank == null || !Globals.Me.GuildRank.Permissions.Invite || !mAddPopupButtonUsed;
            mLeave.IsHidden            = Globals.Me != null && Globals.Me.Rank == 0;
        }
Ejemplo n.º 15
0
        private void AddReportsToList(bool clearPrevious = true, bool selectFirstElementInList = false)
        {
            if (Reports == null)
            {
                return;
            }
            if (clearPrevious)
            {
                list.Clear();
            }

            foreach (var report in Reports)
            {
                try
                {
                    var row = list.AddRow(String.Empty, report.Id(), report);
                    OnRenderRowText(report, row);
                    if (ListClickStyle == ListItemClickType.DOUBLE)
                    {
                        row.DoubleClicked += RowClicked;
                    }
                    else
                    {
                        row.Clicked += RowClicked;
                    }
                }
                catch (Exception e)
                {
                    Function.Log(e.ToString());
                    throw e;
                }
            }
            if (selectFirstElementInList)
            {
                list.SelectRow(0, true);
            }
        }
Ejemplo n.º 16
0
        //Update
        public void Update()
        {
            if (mReceivedMessage)
            {
                mChatboxMessages.ScrollToBottom();
                mReceivedMessage = false;
            }

            var msgs = ChatboxMsg.GetMessages();

            for (var i = mMessageIndex; i < msgs.Count; i++)
            {
                var msg    = msgs[i];
                var myText = Interface.WrapText(
                    msg.GetMessage(), mChatboxMessages.Width - mChatboxMessages.GetVerticalScrollBar().Width - 8,
                    mChatboxText.Font
                    );

                foreach (var t in myText)
                {
                    var rw = mChatboxMessages.AddRow(t.Trim());
                    rw.SetTextFont(mChatboxText.Font);
                    rw.SetTextColor(msg.GetColor());
                    rw.ShouldDrawBackground = false;
                    rw.UserData             = msg.GetTarget();
                    rw.Clicked      += ChatboxRow_Clicked;
                    mReceivedMessage = true;

                    while (mChatboxMessages.RowCount > ClientConfiguration.Instance.ChatLines)
                    {
                        mChatboxMessages.RemoveRow(0);
                    }
                }

                mMessageIndex++;
            }
        }
Ejemplo n.º 17
0
        internal static ListBoxRow AddPed(this ListBox listBox, ComputerPlusEntity entry)
        {
            if (listBox == null)
            {
                return(null);
            }
            String alert = entry.PedPersona.Wanted ? "(ALERT) " : String.Empty;
            String rowId = String.Format("{0}_{1}_{2}",
                                         entry.PedPersona.FullName,
                                         entry.PedPersona.Surname,
                                         entry.Ped.Model.Name
                                         );
            var previousRow = listBox.FindChildByName(rowId);

            if (previousRow == null)
            {
                var row = listBox.AddRow(
                    String.Format("{0}({1}) | {2}", alert, entry.PedPersona.Gender.ToFriendlyString().First(), entry.PedPersona.FullName),
                    rowId,
                    entry);
                return(row);
            }
            return(previousRow as ListBoxRow);
        }
Ejemplo n.º 18
0
        private void AddPursuitUnits()
        {
            list_unit.Clear();

            list_unit.AddRow("Local Patrol Unit", "localPatrol", EBackupUnitType.LocalUnit);
            list_unit.AddRow("State Patrol Unit", "statePatrol", EBackupUnitType.StateUnit);
            list_unit.AddRow("Local SWAT Team", "localSwat", EBackupUnitType.SwatTeam);
            list_unit.AddRow("NOOSE SWAT Team", "nooseSwat", EBackupUnitType.NooseTeam);
            list_unit.AddRow("Local Air Support Unit", "localAir", EBackupUnitType.AirUnit);
            list_unit.AddRow("NOOSE Air Support Unit", "nooseAir", EBackupUnitType.NooseAirUnit);
            list_unit.SelectRow(0);
        }
Ejemplo n.º 19
0
        //Update the crafting bar
        public void Update()
        {
            if (!mInitialized)
            {
                for (var i = 0; i < Globals.ActiveCraftingTable?.Crafts?.Count; ++i)
                {
                    var activeCraft = CraftBase.Get(Globals.ActiveCraftingTable.Crafts[i]);
                    if (activeCraft == null)
                    {
                        continue;
                    }

                    var tmpRow = mRecipes?.AddRow(i + 1 + ") " + ItemBase.GetName(activeCraft.ItemId));
                    if (tmpRow == null)
                    {
                        continue;
                    }

                    tmpRow.UserData       = Globals.ActiveCraftingTable.Crafts[i];
                    tmpRow.DoubleClicked += tmpNode_DoubleClicked;
                    tmpRow.Clicked       += tmpNode_DoubleClicked;
                    tmpRow.SetTextColor(Color.White);
                    tmpRow.RenderColor = new Color(50, 255, 255, 255);
                }

                //Load the craft data
                if (Globals.ActiveCraftingTable?.Crafts?.Count > 0)
                {
                    LoadCraftItems(Globals.ActiveCraftingTable.Crafts[0]);
                }

                mInitialized = true;
            }

            if (!Crafting)
            {
                mBar.Width = 0;

                return;
            }

            var craft = CraftBase.Get(mCraftId);

            if (craft == null)
            {
                return;
            }

            var delta = Globals.System.GetTimeMs() - mBarTimer;

            if (delta > craft.Time)
            {
                delta    = craft.Time;
                Crafting = false;
                if (mCraftWindow != null)
                {
                    mCraftWindow.IsClosable = true;
                }

                LoadCraftItems(mCraftId);
                mBar.Width = 0;
            }

            var ratio = craft.Time == 0 ? 0 : Convert.ToDecimal(delta) / Convert.ToDecimal(craft.Time);
            var width = ratio * mBarContainer?.Width ?? 0;

            if (mBar == null)
            {
                return;
            }

            mBar.SetTextureRect(
                0, 0, Convert.ToInt32(ratio * mBar.Texture?.GetWidth() ?? 0), mBar.Texture?.GetHeight() ?? 0
                );

            mBar.Width = Convert.ToInt32(width);
        }
Ejemplo n.º 20
0
        //Update the crafting bar
        public void Update()
        {
            if (!mInitialized)
            {
                //Quickly Look through the inventory and count the luck stat
                double luck = 0;
                foreach (var equip in Globals.Me.Equipment)
                {
                    if (ItemBase.Get(equip)?.Effect?.Type == EffectType.Luck)
                    {
                        luck += ItemBase.Get(equip).Effect.Percentage;
                    }
                }
                var j = 0;
                for (var i = 0; i < Globals.ActiveCraftingTable?.Crafts?.Count; ++i)
                {
                    var activeCraft = CraftBase.Get(Globals.ActiveCraftingTable.Crafts[i]);
                    if (activeCraft == null)
                    {
                        continue;
                    }
                    if (!Globals.ActiveCraftingTableReqs.Contains(i + "-"))
                    {
                        j++;
                        var tmpRow = mRecipes?.AddRow(j + ") " + ItemBase.GetName(activeCraft.ItemId) + " (" + Math.Min(activeCraft.SuccessRate + (luck / 10), 100) + "%) ");
                        if (tmpRow == null)
                        {
                            continue;
                        }

                        tmpRow.UserData       = Globals.ActiveCraftingTable.Crafts[i];
                        tmpRow.DoubleClicked += tmpNode_DoubleClicked;
                        tmpRow.Clicked       += tmpNode_DoubleClicked;
                        tmpRow.SetTextColor(Color.White);
                        tmpRow.RenderColor = new Color(50, 255, 255, 255);
                    }
                }

                //Load the craft data
                if (Globals.ActiveCraftingTable?.Crafts?.Count > 0)
                {
                    LoadCraftItems(Globals.ActiveCraftingTable.Crafts[0]);
                }

                mInitialized = true;
            }

            //We received green light to craft, continue crafting
            if (Globals.canCraftrq && clickedCraft)
            {
                Crafting  = true;
                mBarTimer = Globals.System.GetTimeMs();
                PacketSender.SendCraftItem(Globals.canCraftitem);
                mCraftWindow.IsClosable = false;
                Globals.canCraftrq      = false;
                Globals.canCraftitem    = Guid.Empty;
                clickedCraft            = false;
                return;
            }

            //Uncomment next lines to have the craftbutton disable if requirements are not met

            /*
             * if (!Globals.canCraftrq)
             * {
             *  mCraft.Disable();
             * }
             *
             * if (Globals.canCraftrq)
             * {
             *  mCraft.Enable();
             * }
             */

            if (!Crafting)
            {
                mBar.Width = 0;

                return;
            }

            var craft = CraftBase.Get(mCraftId);

            if (craft == null)
            {
                return;
            }

            var delta = Globals.System.GetTimeMs() - mBarTimer;

            if (delta > craft.Time)
            {
                delta    = craft.Time;
                Crafting = false;
                if (mCraftWindow != null)
                {
                    mCraftWindow.IsClosable = true;
                }

                LoadCraftItems(mCraftId);
                mBar.Width = 0;
            }

            var ratio = craft.Time == 0 ? 0 : Convert.ToDecimal(delta) / Convert.ToDecimal(craft.Time);
            var width = ratio * mBarContainer?.Width ?? 0;

            if (mBar == null)
            {
                return;
            }

            mBar.SetTextureRect(
                0, 0, Convert.ToInt32(ratio * mBar.Texture?.GetWidth() ?? 0), mBar.Texture?.GetHeight() ?? 0
                );

            mBar.Width = Convert.ToInt32(width);
        }
Ejemplo n.º 21
0
        public static void Main(string[] args)
        {
            g_testEntries = AllTests.GetTests();
            testCount     = g_testEntries.Count();

            testIndex     = Math.Max(0, Math.Min(testIndex, testCount - 1));
            testSelection = testIndex;

            entry = g_testEntries[testIndex];
            test  = entry.createFcn();

            GraphicsManager.SetWindowState(OpenTK.WindowState.Maximized);
            string title = String.Format("Box2D Version {0}.{1}.{2}", Settings._version.major, Settings._version.minor, Settings._version.revision);

            GraphicsManager.SetTitle(title);

            camera           = new Camera2D();
            camera.OnRender += SimulationLoop;

            camera.SetZoom(12);
            camera.CenterOnTarget(true);
            camera.SetLocation(0, 0);

            GraphicsManager.Update += new GraphicsManager.Updater(GraphicsManager_Update);

            WindowControl glui = new WindowControl(MainCanvas.GetCanvas());

            glui.Dock = Gwen.Pos.Left;

            Label text = new Label(glui);

            text.Text = "Tests";
            text.SetPosition(10, 10);

            testList              = new ListBox(glui);
            testList.RowSelected += delegate(Base sender, ItemSelectedEventArgs tlargs) {
                testSelection = testList.SelectedRowIndex;
            };
            foreach (TestEntry e in g_testEntries)
            {
                testList.AddRow(e.name, "", e);
            }
            testList.SelectedRowIndex = testSelection;
            testList.SetPosition(10, 30);
            testList.SetSize(170, 180);

            //glui.add_separator();
            Base SettingsBox = new Base(glui);

            SettingsBox.SetSize(200, 185);
            SettingsBox.SetPosition(0, 250);
            {
                NumericUpDown spinner = new NumericUpDown(SettingsBox);
                spinner.Text          = "Vel Iters";
                spinner.Min           = 1;
                spinner.Max           = 500;
                spinner.ValueChanged += delegate(Base sender, EventArgs vcargs) {
                    settings.velocityIterations = (int)spinner.Value;
                };
                spinner.Value = settings.velocityIterations;
                spinner.SetPosition(10, 10);

                NumericUpDown posSpinner = new NumericUpDown(SettingsBox);
                posSpinner.Min           = 0;
                posSpinner.Max           = 100;
                posSpinner.Text          = "Pos Iters";
                posSpinner.ValueChanged += delegate(Base sender, EventArgs psargs) {
                    settings.positionIterations = (int)posSpinner.Value;
                };
                posSpinner.Value = settings.positionIterations;
                posSpinner.SetPosition(10, 35);

                NumericUpDown hertzSpinner = new NumericUpDown(SettingsBox);
                hertzSpinner.Text          = "Hertz";
                hertzSpinner.Min           = 5;
                hertzSpinner.Max           = 200;
                hertzSpinner.ValueChanged += delegate(Base sender, EventArgs hargs) {
                    settingsHz = hertzSpinner.Value;
                };
                hertzSpinner.Value = settingsHz;
                hertzSpinner.SetPosition(10, 60);

                LabeledCheckBox scb = new LabeledCheckBox(SettingsBox);
                scb.Text          = "Sleep";
                scb.CheckChanged += delegate(Base sender, EventArgs argsscb) {
                    settings.enableSleep = scb.IsChecked;
                };
                scb.IsChecked = settings.enableSleep;
                scb.SetPosition(10, 85);

                LabeledCheckBox wsu = new LabeledCheckBox(SettingsBox);
                wsu.Text          = "Warm Starting";
                wsu.CheckChanged += delegate(Base sender, EventArgs argsscb) {
                    settings.enableWarmStarting = wsu.IsChecked;
                };
                wsu.IsChecked = settings.enableWarmStarting;
                wsu.SetPosition(10, 110);

                LabeledCheckBox toi = new LabeledCheckBox(SettingsBox);
                toi.Text          = "Time of Impact";
                toi.CheckChanged += delegate(Base sender, EventArgs argsscb) {
                    settings.enableContinuous = toi.IsChecked;
                };
                toi.IsChecked = settings.enableContinuous;
                toi.SetPosition(10, 135);

                LabeledCheckBox ssb = new LabeledCheckBox(SettingsBox);
                ssb.Text          = "Sub-Stepping";
                ssb.CheckChanged += delegate(Base sender, EventArgs argsscb) {
                    settings.enableSubStepping = ssb.IsChecked;
                };
                ssb.IsChecked = settings.enableSubStepping;
                ssb.SetPosition(10, 160);
            }

            Base drawPanel = new Base(glui);

            drawPanel.Dock = Gwen.Pos.Bottom;
            drawPanel.SetSize(200, 225);
            {
                LabeledCheckBox cbShapes = new LabeledCheckBox(drawPanel);
                cbShapes.Text          = "Shapes";
                cbShapes.IsChecked     = settings.drawShapes;
                cbShapes.CheckChanged += delegate(Base cbshapes, EventArgs eacbshapes) {
                    settings.drawShapes = cbShapes.IsChecked;
                };
                cbShapes.SetPosition(10, 10);



                //glui.add_checkbox_to_panel(drawPanel, "Joints", &settings.drawJoints);
                LabeledCheckBox cbJoints = new LabeledCheckBox(drawPanel);
                cbJoints.Text          = "Joints";
                cbJoints.IsChecked     = settings.drawJoints;
                cbJoints.CheckChanged += delegate(Base cbshapes, EventArgs eacbshapes) {
                    settings.drawJoints = cbJoints.IsChecked;
                };
                cbJoints.SetPosition(10, 30);



                //glui.add_checkbox_to_panel(drawPanel, "AABBs", &settings.drawAABBs);
                LabeledCheckBox cbAABBs = new LabeledCheckBox(drawPanel);
                cbAABBs.Text          = "AABBs";
                cbAABBs.IsChecked     = settings.drawAABBs;
                cbAABBs.CheckChanged += delegate(Base cbshapes, EventArgs eacbshapes) {
                    settings.drawAABBs = cbAABBs.IsChecked;
                };
                cbAABBs.SetPosition(10, 50);



                //glui.add_checkbox_to_panel(drawPanel, "Contact Points", &settings.drawContactPoints);
                LabeledCheckBox cbPoints = new LabeledCheckBox(drawPanel);
                cbPoints.Text          = "Contact Points";
                cbPoints.IsChecked     = settings.drawContactPoints;
                cbPoints.CheckChanged += delegate(Base cbshapes, EventArgs eacbshapes) {
                    settings.drawContactPoints = cbPoints.IsChecked;
                };
                cbPoints.SetPosition(10, 70);



                //glui.add_checkbox_to_panel(drawPanel, "Contact Normals", &settings.drawContactNormals);
                LabeledCheckBox cbNormals = new LabeledCheckBox(drawPanel);
                cbNormals.Text          = "Contact Normals";
                cbNormals.IsChecked     = settings.drawContactNormals;
                cbNormals.CheckChanged += delegate(Base cbshapes, EventArgs eacbshapes) {
                    settings.drawContactNormals = cbNormals.IsChecked;
                };
                cbNormals.SetPosition(10, 90);



                //glui.add_checkbox_to_panel(drawPanel, "Contact Impulses", &settings.drawContactImpulse);
                LabeledCheckBox cbImpulses = new LabeledCheckBox(drawPanel);
                cbImpulses.Text          = "Contact Impulses";
                cbImpulses.IsChecked     = settings.drawContactImpulse;
                cbImpulses.CheckChanged += delegate(Base cbshapes, EventArgs eacbshapes) {
                    settings.drawContactImpulse = cbImpulses.IsChecked;
                };
                cbImpulses.SetPosition(10, 110);



                //glui.add_checkbox_to_panel(drawPanel, "Friction Impulses", &settings.drawFrictionImpulse);
                LabeledCheckBox cbFriction = new LabeledCheckBox(drawPanel);
                cbFriction.Text          = "Friction Impulses";
                cbFriction.IsChecked     = settings.drawFrictionImpulse;
                cbFriction.CheckChanged += delegate(Base cbshapes, EventArgs eacbshapes) {
                    settings.drawFrictionImpulse = cbFriction.IsChecked;
                };
                cbFriction.SetPosition(10, 130);



                //glui.add_checkbox_to_panel(drawPanel, "Center of Masses", &settings.drawCOMs);
                LabeledCheckBox cbMasses = new LabeledCheckBox(drawPanel);
                cbMasses.Text          = "Center of Masses";
                cbMasses.IsChecked     = settings.drawCOMs;
                cbMasses.CheckChanged += delegate(Base cbshapes, EventArgs eacbshapes) {
                    settings.drawCOMs = cbMasses.IsChecked;
                };
                cbMasses.SetPosition(10, 150);



                //glui.add_checkbox_to_panel(drawPanel, "Statistics", &settings.drawStats);
                LabeledCheckBox cbStatistics = new LabeledCheckBox(drawPanel);
                cbStatistics.Text          = "Statistics";
                cbStatistics.IsChecked     = settings.drawStats;
                cbStatistics.CheckChanged += delegate(Base cbshapes, EventArgs eacbshapes) {
                    settings.drawStats = cbStatistics.IsChecked;
                };
                cbStatistics.SetPosition(10, 170);



                //glui.add_checkbox_to_panel(drawPanel, "Profile", &settings.drawProfile);
                LabeledCheckBox cbProfile = new LabeledCheckBox(drawPanel);
                cbProfile.Text          = "Profile";
                cbProfile.IsChecked     = settings.drawProfile;
                cbProfile.CheckChanged += delegate(Base cbshapes, EventArgs eacbshapes) {
                    settings.drawProfile = cbProfile.IsChecked;
                };
                cbProfile.SetPosition(10, 190);
            }


            Base Buttons = new Base(glui);

            Buttons.Dock   = Gwen.Pos.Bottom;
            Buttons.Height = 100;
            {
                Button btnPause = new Button(Buttons);
                btnPause.Text     = "Pause";
                btnPause.IsToggle = true;
                btnPause.SetPosition(10, 10);
                btnPause.ToggleState = settings.pause;
                btnPause.Clicked    += delegate(Base sender, ClickedEventArgs evargs) {
                    settings.pause = btnPause.ToggleState;
                };

                Button btnSS = new Button(Buttons);
                btnSS.Text = "Single Step";
                btnSS.SetPosition(10, 40);
                btnSS.Clicked += delegate(Base sender, ClickedEventArgs evargs) {
                    SingleStep();
                };

                Button btnRestart = new Button(Buttons);
                btnRestart.Text = "Restart";
                btnRestart.SetPosition(10, 70);
                btnRestart.Clicked += delegate(Base sender, ClickedEventArgs evargs) {
                    Restart();
                };
            }

            glui.SetSize(200, 300);
            GraphicsManager.Start();
        }
Ejemplo n.º 22
0
        //Update
        public void Update()
        {
            // TODO: Find a cleaner way to do this logic, right now this will only start working properly (ie not resetting scroll height) after a few chat messages.
            // Can't seem to find a cleaner way yet. But works in longer chat convos.
            var scrollAmount   = mChatboxMessages.GetVerticalScrollBar().ScrollAmount;
            var scrollToBottom = mChatboxMessages.GetVerticalScrollBar().ScrollAmount == 1 || (mChatboxMessages.RowCount <= 10 && mChatboxMessages.GetVerticalScrollBar().ScrollAmount <= 1);

            // Did the tab change recently? If so, we need to reset a few things to make it work...
            if (mLastTab != mCurrentTab)
            {
                mChatboxMessages.Clear();
                mChatboxMessages.GetHorizontalScrollBar().SetScrollAmount(0);
                mMessageIndex    = 0;
                mReceivedMessage = true;

                mLastTab = mCurrentTab;
            }

            if (mReceivedMessage)
            {
                mChatboxMessages.ScrollToBottom();
                mReceivedMessage = false;
            }

            var msgs = ChatboxMsg.GetMessages(mCurrentTab);

            for (var i = mMessageIndex; i < msgs.Count; i++)
            {
                var msg    = msgs[i];
                var myText = Interface.WrapText(
                    msg.Message, mChatboxMessages.Width - mChatboxMessages.GetVerticalScrollBar().Width - 8,
                    mChatboxText.Font
                    );

                foreach (var t in myText)
                {
                    var rw = mChatboxMessages.AddRow(t.Trim());
                    rw.SetTextFont(mChatboxText.Font);
                    rw.SetTextColor(msg.Color);
                    rw.ShouldDrawBackground = false;
                    rw.UserData             = msg.Target;
                    rw.Clicked      += ChatboxRow_Clicked;
                    rw.RightClicked += ChatboxRow_RightClicked;
                    mReceivedMessage = true;

                    while (mChatboxMessages.RowCount > ClientConfiguration.Instance.ChatLines)
                    {
                        mChatboxMessages.RemoveRow(0);
                    }
                }

                mMessageIndex++;
            }

            if (!scrollToBottom)
            {
                mChatboxMessages.GetVerticalScrollBar().SetScrollAmount(scrollAmount);
            }
            else
            {
                mChatboxMessages.GetVerticalScrollBar().SetScrollAmount(1);
            }
        }
Ejemplo n.º 23
0
        public void CreateComponents()
        {
            /***** Main Tab Control *****/
            tc_main = new TabControl(this);
            tc_main.SetPosition(15, 12);
            tc_main.SetSize(625, 389);

            /***** Call List Tab *****/
            // base container
            base_calls = new Base(this);
            base_calls.SetPosition(0, 0);
            base_calls.SetSize(617, 358);

            // calls listbox
            list_calls = new ListBox(base_calls);
            list_calls.SetPosition(0, 18);
            list_calls.SetSize(613, 333);

            // "Unit" label
            lbl_c_unit      = new Label(base_calls);
            lbl_c_unit.Text = "Unit";
            lbl_c_unit.SetPosition(3, 1);
            lbl_c_unit.SetSize(26, 13);

            // "Time" label
            lbl_c_time      = new Label(base_calls);
            lbl_c_time.Text = "Time";
            lbl_c_time.SetPosition(50, 1);
            lbl_c_time.SetSize(30, 13);

            // "Status" label
            lbl_c_status      = new Label(base_calls);
            lbl_c_status.Text = "Status";
            lbl_c_status.SetPosition(120, 1);
            lbl_c_status.SetSize(37, 13);

            // "Call" label
            lbl_c_call      = new Label(base_calls);
            lbl_c_call.Text = "Call";
            lbl_c_call.SetPosition(230, 1);
            lbl_c_call.SetSize(24, 13);

            /***** Active Call Tab *****/
            // base container
            base_active = new Base(this);
            base_active.SetPosition(0, 0);
            base_active.SetSize(617, 358);

            // "ID No." label
            lbl_a_id      = new Label(base_active);
            lbl_a_id.Text = "ID No.";
            lbl_a_id.SetPosition(26, 6);
            lbl_a_id.SetSize(38, 13);
            // "ID No." textbox
            out_id = new TextBox(base_active);
            out_id.SetPosition(70, 3);
            out_id.SetSize(306, 20);
            out_id.KeyboardInputEnabled = false;

            // "Time" label
            lbl_a_time      = new Label(base_active);
            lbl_a_time.Text = "Time";
            lbl_a_time.SetPosition(422, 7);
            lbl_a_time.SetSize(30, 13);
            // "Time" date textbox
            out_date = new TextBox(base_active);
            out_date.SetPosition(455, 3);
            out_date.SetSize(66, 20);
            out_date.KeyboardInputEnabled = false;
            // "Time" time textbox
            out_time = new TextBox(base_active);
            out_time.SetPosition(527, 3);
            out_time.SetSize(66, 20);
            out_time.KeyboardInputEnabled = false;

            // "Situation" label
            lbl_a_call      = new Label(base_active);
            lbl_a_call.Text = "Situation";
            lbl_a_call.SetPosition(17, 33);
            lbl_a_call.SetSize(48, 13);
            // "Situation" textbox
            out_call = new TextBox(base_active);
            out_call.SetPosition(70, 29);
            out_call.SetSize(523, 20);
            out_call.KeyboardInputEnabled = false;

            // "Location" label
            lbl_a_loc      = new Label(base_active);
            lbl_a_loc.Text = "Location";
            lbl_a_loc.SetPosition(18, 58);
            lbl_a_loc.SetSize(48, 13);
            // "Location" textbox
            out_loc = new TextBox(base_active);
            out_loc.SetPosition(70, 55);
            out_loc.SetSize(523, 20);
            out_loc.KeyboardInputEnabled = false;

            // "Status" label
            lbl_a_stat      = new Label(base_active);
            lbl_a_stat.Text = "Status";
            lbl_a_stat.SetPosition(27, 84);
            lbl_a_stat.SetSize(37, 13);
            // "Status" textbox
            out_stat = new TextBox(base_active);
            out_stat.SetPosition(70, 81);
            out_stat.SetSize(106, 20);
            out_stat.KeyboardInputEnabled = false;

            // "Unit" label
            lbl_a_unit      = new Label(base_active);
            lbl_a_unit.Text = "Unit";
            lbl_a_unit.SetPosition(258, 84);
            lbl_a_unit.SetSize(26, 13);
            // "Unit" textbox
            out_unit = new TextBox(base_active);
            out_unit.SetPosition(290, 81);
            out_unit.SetSize(86, 20);
            out_unit.KeyboardInputEnabled = false;

            // "Response" label
            lbl_a_resp      = new Label(base_active);
            lbl_a_resp.Text = "Response";
            lbl_a_resp.SetPosition(454, 84);
            lbl_a_resp.SetSize(55, 13);
            // "Response" textbox
            out_resp = new TextBox(base_active);
            out_resp.SetPosition(514, 81);
            out_resp.SetSize(79, 20);
            out_resp.KeyboardInputEnabled = false;

            // "Comments" label
            lbl_a_desc      = new Label(base_active);
            lbl_a_desc.Text = "Comments";
            lbl_a_desc.SetPosition(8, 113);
            lbl_a_desc.SetSize(56, 13);
            // "Comments" textbox
            out_desc = new MultilineTextBox(base_active);
            out_desc.SetPosition(70, 110);
            out_desc.SetSize(523, 103);
            out_desc.KeyboardInputEnabled = false;

            // "Persons" label
            lbl_a_peds      = new Label(base_active);
            lbl_a_peds.Text = "Persons";
            lbl_a_peds.SetPosition(19, 226);
            lbl_a_peds.SetSize(45, 13);
            // "Persons" textbox
            out_peds = new MultilineTextBox(base_active);
            out_peds.SetPosition(70, 226);
            out_peds.SetSize(523, 57);
            out_peds.KeyboardInputEnabled = false;

            // "Vehicles" label
            lbl_a_vehs      = new Label(base_active);
            lbl_a_vehs.Text = "Vehicles";
            lbl_a_vehs.SetPosition(19, 298);
            lbl_a_vehs.SetSize(47, 13);
            // "Vehicles" textbox
            out_vehs = new MultilineTextBox(base_active);
            out_vehs.SetPosition(70, 295);
            out_vehs.SetSize(523, 57);
            out_vehs.KeyboardInputEnabled = false;

            // Add tabs and their corresponding containers
            // Active Call tab is hidden when no callout is active
            if (Globals.ActiveCallout != null)
            {
                tc_main.AddPage("Active Call", base_active);
            }
            else
            {
                base_active.Hide();
            }
            tc_main.AddPage("Call List", base_calls);

            List <CalloutData> mActiveCalls = (from CalloutData x in Globals.CallQueue orderby x.TimeReceived descending select x).ToList();

            foreach (CalloutData x in mActiveCalls)
            {
                list_calls.AddRow(String.Format("{0}{1}{2}{3}", x.PrimaryUnit.PadRight(12), x.TimeReceived.ToLocalTime().ToString("HH:mm").PadRight(21), x.Status.ToFriendlyString().PadRight(31), x.Name.ToUpper()));
            }
        }
Ejemplo n.º 24
0
        private void SetupLeft()
        {
            ControlBase leftcontainer = new ControlBase(this)
            {
                Margin             = new Margin(0, 0, 0, 0),
                Dock               = Dock.Left,
                AutoSizeToContents = true,
            };
            var panel = new ControlBase(leftcontainer);

            panel.Width  = 150;
            panel.Height = 200;
            ControlBase topcontainer = new ControlBase(panel)
            {
                Margin  = new Margin(0, 3, 0, 3),
                Padding = Padding.Five,
                Dock    = Dock.Top,

                Children =
                {
                    new Button(null)
                    {
                        Text               = "-",
                        Name               = "btndelete",
                        Dock               = Dock.Right,
                        Margin             = new Margin(2, 0, 2, 0),
                        Height             = 16,
                        Width              = 16,
                        AutoSizeToContents = false
                    },
                    new Button(null)
                    {
                        Text               = "+",
                        Name               = "btnadd",
                        Dock               = Dock.Right,
                        Margin             = new Margin(2, 0, 2, 0),
                        Width              = 16,
                        Height             = 16,
                        AutoSizeToContents = false
                    }
                },
                AutoSizeToContents = true,
            };
            var add    = topcontainer.FindChildByName("btnadd");
            var delete = topcontainer.FindChildByName("btndelete");

            add.Clicked += (o, e) =>
            {
                GameTrigger trigger;

                switch (_triggertype.SelectedItem.UserData)
                {
                case TriggerType.Zoom:
                    trigger = new GameTrigger()
                    {
                        TriggerType = TriggerType.Zoom,
                        Start       = _editor.Offset,
                        End         = _editor.Offset + 40,
                        ZoomTarget  = (float)_zoomtarget.Value,
                    };
                    break;

                case TriggerType.CameraOffset:
                    trigger = new GameTrigger()
                    {
                        TriggerType     = TriggerType.CameraOffset,
                        Start           = _editor.Offset,
                        End             = _editor.Offset + 40,
                        XOffsetInPixels = (float)_camerapixeloffsetx.Value,
                        YOffsetInPixels = (float)_camerapixeloffsety.Value,
                    };
                    break;

                default:     //Make a standard zoom trigger if something goes wrong
                    trigger = new GameTrigger()
                    {
                        TriggerType = TriggerType.Zoom,
                        Start       = _editor.Offset,
                        End         = _editor.Offset + 40,
                        ZoomTarget  = 4,
                    };
                    break;
                }


                _changemade = true;
                using (var trk = _editor.CreateTrackWriter())
                {
                    trk.Triggers.Add(trigger);
                    _editor.Timeline.TriggerChanged(trigger, trigger);
                    UpdateFrame();
                }
                ToggleDisable(false);
                _lbtriggers.AddRow(GetTriggerLabel(trigger), "", trigger);
                _lbtriggers.SelectByUserData(trigger);
            };
            delete.Clicked += (o, e) =>
            {
                var row = _lbtriggers.SelectedRow;
                if (row != null)
                {
                    var trigger = (GameTrigger)(row.UserData);
                    _changemade = true;
                    using (var trk = _editor.CreateTrackWriter())
                    {
                        trk.Triggers.RemoveAt(SelectedTrigger);
                        _editor.Timeline.TriggerChanged(trigger, trigger);
                        UpdateFrame();
                    }
                    _lbtriggers.Children.Remove(row);
                    ToggleDisable(true);
                }
            };
            _lbtriggers = new ListBox(panel)
            {
                Dock   = Dock.Fill,
                Margin = new Margin(0, 0, 0, 5)
            };
            ControlBase spinnerContainer = new ControlBase(leftcontainer)
            {
                Margin             = new Margin(0, 0, 0, 0),
                Padding            = new Padding(0, 0, 50, 0),
                Dock               = Dock.Bottom,
                AutoSizeToContents = true
            };

            _spinnerStart = new Spinner(null)
            {
                OnlyWholeNumbers = true,
                Min   = 1,
                Max   = Constants.MaxFrames,
                Value = _editor.Offset
                        //TODO set values
            };
            _spinnerDuration = new Spinner(null)
            {
                OnlyWholeNumbers = true,
                Min   = 0,
                Max   = double.MaxValue, //Yeah, I am crazy nuts.  I want more than 2 minutes.
                Value = 0
                                         //TODO set values
            };
            _spinnerStart.ValueChanged    += OnTriggerTimeChanged;
            _spinnerDuration.ValueChanged += OnTriggerTimeChanged;
            GwenHelper.CreateLabeledControl(
                spinnerContainer,
                "Duration:  ",
                _spinnerDuration).Dock = Dock.Bottom;
            GwenHelper.CreateLabeledControl(
                spinnerContainer,
                "Start:",
                _spinnerStart).Dock = Dock.Bottom;


            _lbtriggers.RowSelected += OnTriggerSelected;
        }
Ejemplo n.º 25
0
 private void AddAdditionalPartyToListBox(ArrestReportAdditionalParty party)
 {
     lb_additional_parties.AddRow(party.FullName, party.FullName, party);
 }
Ejemplo n.º 26
0
        private void SetupLeft()
        {
            ControlBase leftcontainer = new ControlBase(this)
            {
                Margin             = new Margin(0, 0, 0, 0),
                Dock               = Dock.Left,
                AutoSizeToContents = true,
            };
            var panel = new ControlBase(leftcontainer);

            panel.Width  = 150;
            panel.Height = 200;
            ControlBase topcontainer = new ControlBase(panel)
            {
                Margin  = new Margin(0, 3, 0, 3),
                Padding = Padding.Five,
                Dock    = Dock.Top,

                Children =
                {
                    new Button(null)
                    {
                        Text               = "-",
                        Name               = "btndelete",
                        Dock               = Dock.Right,
                        Margin             = new Margin(2, 0, 2, 0),
                        Height             = 16,
                        Width              = 16,
                        AutoSizeToContents = false
                    },
                    new Button(null)
                    {
                        Text               = "+",
                        Name               = "btnadd",
                        Dock               = Dock.Right,
                        Margin             = new Margin(2, 0, 2, 0),
                        Width              = 16,
                        Height             = 16,
                        AutoSizeToContents = false
                    }
                },
                AutoSizeToContents = true,
            };
            var add    = topcontainer.FindChildByName("btnadd");
            var delete = topcontainer.FindChildByName("btndelete");

            add.Clicked += (o, e) =>
            {
                GameTrigger trigger = null;
                switch (triggerSelected)
                {
                case (TriggerType.Zoom):
                    _triggeroptions.Children.Clear();
                    _zoomoptions.Parent = _triggeroptions;
                    trigger             = new GameTrigger()
                    {
                        TriggerType = TriggerType.Zoom,
                        Start       = _editor.Offset,
                        End         = _editor.Offset + 40,
                        ZoomTarget  = 4,
                    };

                    break;

                case (TriggerType.BGChange):
                    trigger = new GameTrigger()
                    {
                        TriggerType     = TriggerType.BGChange,
                        Start           = _editor.Offset,
                        End             = _editor.Offset + 40,
                        backgroundRed   = 255,
                        backgroundGreen = 255,
                        backgroundBlue  = 255,
                    };
                    break;

                case (TriggerType.LineColor):
                    trigger = new GameTrigger()
                    {
                        TriggerType = TriggerType.LineColor,
                        Start       = _editor.Offset,
                        End         = _editor.Offset + 40,
                        lineRed     = 255,
                        lineGreen   = 255,
                        lineBlue    = 255,
                    };
                    break;

                default:     //Default to the zoom trigger if something goes wrong
                    trigger = new GameTrigger()
                    {
                        TriggerType = TriggerType.Zoom,
                        Start       = _editor.Offset,
                        End         = _editor.Offset + 40,
                        ZoomTarget  = 4,
                    };
                    break;
                }

                _changemade = true;
                using (var trk = _editor.CreateTrackWriter())
                {
                    trk.Triggers.Add(trigger);
                    _editor.Timeline.TriggerChanged(trigger, trigger);
                    UpdateFrame();
                }
                ToggleDisable(false);
                _lbtriggers.AddRow(GetTriggerLabel(trigger), "", trigger);
                _lbtriggers.SelectByUserData(trigger);
            };
            delete.Clicked += (o, e) =>
            {
                var row = _lbtriggers.SelectedRow;
                if (row != null)
                {
                    var trigger = (GameTrigger)(row.UserData);
                    _changemade = true;
                    using (var trk = _editor.CreateTrackWriter())
                    {
                        try
                        {
                            trk.Triggers.RemoveAt(SelectedTrigger);
                            _editor.Timeline.TriggerChanged(trigger, trigger);
                        }
                        catch { /*Do nothing*/ }
                        UpdateFrame();
                    }
                    _lbtriggers.Children.Remove(row);
                    ToggleDisable(true);
                }
            };
            _lbtriggers = new ListBox(panel)
            {
                Dock   = Dock.Fill,
                Margin = new Margin(0, 0, 0, 5)
            };
            ControlBase spinnerContainer = new ControlBase(leftcontainer)
            {
                Margin             = new Margin(0, 0, 0, 0),
                Padding            = new Padding(0, 0, 50, 0),
                Dock               = Dock.Bottom,
                AutoSizeToContents = true
            };

            _spinnerStart = new Spinner(null)
            {
                OnlyWholeNumbers = true,
                Min   = 1,
                Max   = int.MaxValue - 1,
                Value = _editor.Offset
                        //TODO set values
            };
            _spinnerDuration = new Spinner(null)
            {
                OnlyWholeNumbers = true,
                Min   = 0,
                Max   = int.MaxValue - 1, //Yeah I'm crazy for wanting a more than 2 min trigger
                Value = 0
                                          //TODO set values
            };
            _spinnerStart.ValueChanged    += OnTriggerTimeChanged;
            _spinnerDuration.ValueChanged += OnTriggerTimeChanged;
            GwenHelper.CreateLabeledControl(
                spinnerContainer,
                "Duration:  ",
                _spinnerDuration).Dock = Dock.Bottom;
            GwenHelper.CreateLabeledControl(
                spinnerContainer,
                "Start:",
                _spinnerStart).Dock = Dock.Bottom;


            _lbtriggers.RowSelected += OnTriggerSelected;
        }
Ejemplo n.º 27
0
        public ListBoxTest(ControlBase parent)
            : base(parent)
        {
            HorizontalLayout hlayout = new HorizontalLayout(this);

            hlayout.Dock = Dock.Top;

            {
                ListBox ctrl = new ListBox(hlayout);
                ctrl.AutoSizeToContent = true;
                ctrl.AllowMultiSelect  = true;

                ctrl.AddRow("First");
                ctrl.AddRow("Blue");
                ctrl.AddRow("Yellow");
                ctrl.AddRow("Orange");
                ctrl.AddRow("Brown");
                ctrl.AddRow("Black");
                ctrl.AddRow("Green");
                ctrl.AddRow("Dog");
                ctrl.AddRow("Cat Blue");
                ctrl.AddRow("Shoes");
                ctrl.AddRow("Shirts");
                ctrl.AddRow("Chair");
                ctrl.AddRow("I'm autosized");
                ctrl.AddRow("Last");

                ctrl.SelectRowsByRegex("Bl.e|Dog");

                ctrl.RowSelected   += RowSelected;
                ctrl.RowUnselected += RowUnSelected;
            }

            {
                Table ctrl = new Table(hlayout);

                ctrl.AddRow("First");
                ctrl.AddRow("Blue");
                ctrl.AddRow("Yellow");
                ctrl.AddRow("Orange");
                ctrl.AddRow("Brown");
                ctrl.AddRow("Black");
                ctrl.AddRow("Green");
                ctrl.AddRow("Dog");
                ctrl.AddRow("Cat Blue");
                ctrl.AddRow("Shoes");
                ctrl.AddRow("Shirts");
                ctrl.AddRow("Chair");
                ctrl.AddRow("I'm autosized");
                ctrl.AddRow("Last");

                ctrl.SizeToContent();
            }

            {
                ListBox ctrl = new ListBox(hlayout);
                ctrl.AutoSizeToContent = true;
                ctrl.ColumnCount       = 3;
                ctrl.RowSelected      += RowSelected;
                ctrl.RowUnselected    += RowUnSelected;

                {
                    TableRow row = ctrl.AddRow("Baked Beans");
                    row.SetCellText(1, "Heinz");
                    row.SetCellText(2, "£3.50");
                }

                {
                    TableRow row = ctrl.AddRow("Bananas");
                    row.SetCellText(1, "Trees");
                    row.SetCellText(2, "£1.27");
                }

                {
                    TableRow row = ctrl.AddRow("Chicken");
                    row.SetCellText(1, "\u5355\u5143\u6D4B\u8BD5");
                    row.SetCellText(2, "£8.95");
                }
            }

            VerticalLayout vlayout = new VerticalLayout(hlayout);

            {
                // fixed-size list box
                ListBox ctrl = new ListBox(vlayout);
                ctrl.AutoSizeToContent   = true;
                ctrl.HorizontalAlignment = HorizontalAlignment.Left;
                ctrl.ColumnCount         = 3;

                ctrl.SetColumnWidth(0, 150);
                ctrl.SetColumnWidth(1, 150);
                ctrl.SetColumnWidth(2, 150);

                var row1 = ctrl.AddRow("Row 1");
                row1.SetCellText(1, "R1 cell 1");
                row1.SetCellText(2, "Row 1 cell 2");

                ctrl.AddRow("Row 2, slightly bigger");
                ctrl[1].SetCellText(1, "Center cell");

                ctrl.AddRow("Row 3, medium");
                ctrl[2].SetCellText(2, "Last cell");
            }

            {
                // autosized list box
                ListBox ctrl = new ListBox(vlayout);
                ctrl.AutoSizeToContent   = true;
                ctrl.HorizontalAlignment = HorizontalAlignment.Left;
                ctrl.ColumnCount         = 3;

                var row1 = ctrl.AddRow("Row 1");
                row1.SetCellText(1, "R1 cell 1");
                row1.SetCellText(2, "Row 1 cell 2");

                ctrl.AddRow("Row 2, slightly bigger");
                ctrl[1].SetCellText(1, "Center cell");

                ctrl.AddRow("Row 3, medium");
                ctrl[2].SetCellText(2, "Last cell");
            }

            hlayout      = new HorizontalLayout(this);
            hlayout.Dock = Dock.Top;

            /* Selecting Rows in Code */
            {
                ListBox ctrl = new ListBox(hlayout);
                ctrl.AutoSizeToContent = true;

                ListBoxRow Row = ctrl.AddRow("Row");
                ctrl.AddRow("Text");
                ctrl.AddRow("InternalName", "Name");
                ctrl.AddRow("UserData", "Internal", 12);

                LabeledCheckBox multiline = new LabeledCheckBox(this);
                multiline.Dock          = Dock.Top;
                multiline.Text          = "Enable MultiSelect";
                multiline.CheckChanged += delegate(ControlBase sender, EventArgs args)
                {
                    ctrl.AllowMultiSelect = multiline.IsChecked;
                };

                vlayout = new VerticalLayout(hlayout);
                //Select by Menu Item
                {
                    Button TriangleButton = new Button(vlayout);
                    TriangleButton.Text     = "Row";
                    TriangleButton.Width    = 100;
                    TriangleButton.Clicked += delegate(ControlBase sender, ClickedEventArgs args)
                    {
                        ctrl.SelectedRow = Row;
                    };
                }

                //Select by Text
                {
                    Button TestBtn = new Button(vlayout);
                    TestBtn.Text     = "Text";
                    TestBtn.Width    = 100;
                    TestBtn.Clicked += delegate(ControlBase sender, ClickedEventArgs args)
                    {
                        ctrl.SelectByText("Text");
                    };
                }

                //Select by Name
                {
                    Button TestBtn = new Button(vlayout);
                    TestBtn.Text     = "Name";
                    TestBtn.Width    = 100;
                    TestBtn.Clicked += delegate(ControlBase sender, ClickedEventArgs args)
                    {
                        ctrl.SelectByName("Name");
                    };
                }

                //Select by UserData
                {
                    Button TestBtn = new Button(vlayout);
                    TestBtn.Text     = "UserData";
                    TestBtn.Width    = 100;
                    TestBtn.Clicked += delegate(ControlBase sender, ClickedEventArgs args)
                    {
                        ctrl.SelectByUserData(12);
                    };
                }
            }
        }
Ejemplo n.º 28
0
 public void PrintText(string str)
 {
     m_TextOutput.AddRow(str);
     m_TextOutput.ScrollToBottom();
 }
Ejemplo n.º 29
0
 private void AddPursuitUnits()
 {
     list_unit.Clear();
     list_unit.AddRow("Local Patrol Unit");
     list_unit.AddRow("State Patrol Unit");
     list_unit.AddRow("Local SWAT Team");
     list_unit.AddRow("NOOSE SWAT Team");
     list_unit.AddRow("Local Air Support Unit");
     list_unit.AddRow("NOOSE Air Support Unit");
     list_unit.AddRow("FIB Air Support Unit");
 }