示例#1
0
        private void cSSBlockToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            Control[] ctl      = builder.Controls.Find("listBox1", true);
            Control[] ctl1     = builder.Controls.Find("checkedListBox2", true);
            ListBox   listBox1 = (ListBox)ctl[0];

            if (listBox1.SelectedItem != null)
            {
                sb.AppendLine(listBox1.SelectedItem.ToString() + "\t" + "{");
            }
            CheckedListBox clb = (CheckedListBox)ctl1[0];

            foreach (var item in clb.CheckedItems)
            {
                string    displayname = item.ToString();
                int       index       = clb.FindStringExact(displayname);
                string    name        = "textBox" + (index + 1).ToString();
                Control[] c           = clb.Controls.Find(name, true);
                TextBox   tb          = (TextBox)c[0];
                sb.AppendLine(displayname + ":" + tb.Text + ";");
            }
            sb.AppendLine("}");
            rtb1.AppendText(sb.ToString());
            sb.Clear();
            toolStripStatusLabel1.Text         = "CSS For " + listBox1.SelectedItem.ToString() + " added";
            cSSBlockToolStripMenuItem1.Enabled = false;
        }
        protected override void LoadScene()
        {
            if (model != null)
            {
                modelSceneNode = new ModelSceneNode(Scene, model);
                SetAvailableAnimations(modelSceneNode.GetSupportedAnimationNames());
                Scene.Add(modelSceneNode, false);

                var meshGroups = modelSceneNode.GetMeshGroups();

                if (meshGroups.Count() > 1)
                {
                    meshGroupListBox = ViewerControl.AddMultiSelection("Mesh Group", selectedGroups =>
                    {
                        modelSceneNode.SetActiveMeshGroups(selectedGroups);
                    });

                    meshGroupListBox.Items.AddRange(modelSceneNode.GetMeshGroups().ToArray <object>());
                    foreach (var group in modelSceneNode.GetActiveMeshGroups())
                    {
                        meshGroupListBox.SetItemChecked(meshGroupListBox.FindStringExact(group), true);
                    }
                }
            }
            else
            {
                SetAvailableAnimations(Enumerable.Empty <string>());
            }

            if (mesh != null)
            {
                meshSceneNode = new MeshSceneNode(Scene, mesh);
                Scene.Add(meshSceneNode, false);
            }
        }
        // On MouseHover of a building image display a list of projects for the respective building.
        // and set the appropriate checkboxes if the building was already marked as finished in the save file.
        private static void BuildingPictureBox_MouseHover(object sender, EventArgs e)
        {
            if (cData.Character == null || cData.PlayerData == null)
            {
                return;
            }
            var clickedElement = (PictureBox)sender;
            var padding        = 15;
            var projectsPanel  = new Panel
            {
                Name        = clickedElement.Name,
                AutoScroll  = true,
                Location    = new Point(clickedElement.Location.X - (padding * 3), clickedElement.Location.Y - padding),
                BorderStyle = BorderStyle.FixedSingle,
                BackColor   = Color.FromArgb(29, 29, 29),
                ForeColor   = Color.White,
                Size        = new Size(81 + (padding * 6), 106 + (padding * 6))
            };

            charCityForm.Controls.Add(projectsPanel);

            List <string> buildingProjects = WolcenStaticData.CityBuildings[clickedElement.Name];

            buildingProjects = buildingProjects.Select(x => WolcenStaticData.CityProjectLocalization[x]).ToList();
            var buildingListView = new CheckedListBox();

            buildingListView.Items.AddRange(buildingProjects.ToArray());
            buildingListView.BackColor   = Color.FromArgb(29, 29, 29);
            buildingListView.ForeColor   = Color.White;
            buildingListView.BorderStyle = BorderStyle.None;
            //buildingListView.Font = new Font(Form1.DefaultFont.FontFamily, 8, FontStyle.Regular);
            buildingListView.Parent       = projectsPanel;
            buildingListView.Dock         = DockStyle.Fill;
            buildingListView.CheckOnClick = true;

            buildingListView.MouseLeave += BuildingListView_MouseLeave;

            foreach (var project in buildingProjects)
            {
                var i = buildingListView.FindStringExact(project);
                foreach (var item in cData.PlayerData.SoftcoreSeason.CityBuilding.FinishedProjects)
                {
                    if (project == WolcenStaticData.CityProjectLocalization[item.Name])
                    {
                        buildingListView.SetItemChecked(i, true);
                    }
                }
            }

            projectsPanel.Controls.Add(buildingListView);

            charCityForm.MouseLeave   += (sender2, e2) => { charCityForm.Controls.Remove(projectsPanel); };
            charCityForm.ControlAdded += (sender2, e2) => { charCityForm.Controls.Remove(projectsPanel); };
            projectsPanel.BringToFront();
        }
 private void UncheckOtherItems(ItemCheckEventArgs e, CheckedListBox listbox, Dictionary <string, int> columnInfo)
 {
     foreach (var column in columnInfo.Where(c => listbox.CheckedItems.Contains(c.Key)))
     {
         var index = listbox.FindStringExact(column.Key);
         if (index != e.Index)
         {
             listbox.SetItemCheckState(index, CheckState.Unchecked);
         }
     }
 }
示例#5
0
 private void AddToList(IEnumerable <KeyValuePair <string, bool> > tagList, CheckedListBox listBox)
 {
     foreach (var item in tagList)
     {
         // Ensure we are not adding a placeholder the plug-in made
         if (control.Settings.Placeholders.All(ph => ph.Content != item.Key))
         {
             if (listBox.FindStringExact(item.Key) == ListBox.NoMatches)
             {
                 listBox.Items.Add(item.Key, item.Value);
             }
         }
     }
 }
        protected override void LoadScene()
        {
            if (model != null)
            {
                modelSceneNode = new ModelSceneNode(Scene, model);
                SetAvailableAnimations(modelSceneNode.GetSupportedAnimationNames());
                Scene.Add(modelSceneNode, false);

                var meshGroups = modelSceneNode.GetMeshGroups();

                if (meshGroups.Count() > 1)
                {
                    meshGroupListBox = ViewerControl.AddMultiSelection("Mesh Group", selectedGroups =>
                    {
                        modelSceneNode.SetActiveMeshGroups(selectedGroups);
                    });

                    meshGroupListBox.Items.AddRange(modelSceneNode.GetMeshGroups().ToArray <object>());
                    foreach (var group in modelSceneNode.GetActiveMeshGroups())
                    {
                        meshGroupListBox.SetItemChecked(meshGroupListBox.FindStringExact(group), true);
                    }
                }

                modelSceneNode.AnimationController.RegisterUpdateHandler((animation, frame) =>
                {
                    if (animationTrackBar.TrackBar.Value != frame)
                    {
                        animationTrackBar.UpdateValueSilently(frame);
                    }
                    var maximum = animation == null ? 1 : animation.FrameCount - 1;
                    if (animationTrackBar.TrackBar.Maximum != maximum)
                    {
                        animationTrackBar.TrackBar.Maximum = maximum;
                    }
                    animationTrackBar.Enabled  = animation != null;
                    animationPlayPause.Enabled = animation != null;
                });
            }
            else
            {
                SetAvailableAnimations(Enumerable.Empty <string>());
            }

            if (mesh != null)
            {
                meshSceneNode = new MeshSceneNode(Scene, mesh);
                Scene.Add(meshSceneNode, false);
            }
        }
示例#7
0
 /// <summary>
 /// Настройка списка с CheckBox
 /// </summary>
 /// <param name="checkedListBox">Ссылка на элемент управления</param>
 /// <param name="selectedDevices">Массив выбранных устройств</param>
 private void SetUpCheckedListBox(CheckedListBox checkedListBox,
                                  string[] selectedDevices, List <string> allDevices)
 {
     foreach (var item in allDevices)
     {
         int itemNum = checkedListBox.FindStringExact(item.ToString());
         if (selectedDevices.Contains(item.ToString()))
         {
             checkedListBox.SetItemChecked(itemNum, true);
         }
         else
         {
             checkedListBox.SetItemChecked(itemNum, false);
         }
     }
 }
示例#8
0
        private void UpdateCheckedListBox(CheckedListBox cb, List <string> stringList)
        {
            // Uncheck all items
            foreach (int i in cb.CheckedIndices)
            {
                cb.SetItemCheckState(i, CheckState.Unchecked);
            }

            string[] destination = new string[cb.Items.Count];
            cb.Items.CopyTo(destination, 0);

            // Check items in stringList
            foreach (string s in stringList)
            {
                int index = cb.FindStringExact(s);
                if (index != ListBox.NoMatches)
                {
                    cb.SetItemCheckState(index, CheckState.Checked);
                }
            }
        }
示例#9
0
        private void bindControls()
        {
            refreshCounter1.CountdownTimer.Value = new DateTime(2000, 1, 1).Add(Settings.Default.PlaylistRefreshInterval);
            selectedChannelColorPicker.Color     = Settings.Default.SelectedChannelBackground;
            alternatingChannelColorPicker.Color  = Settings.Default.AlternatingChannelBackground;
            channelColorPicker.Color             = Settings.Default.ChannelBackground;

            // set selected values
            sortOrderValue.Text        = Settings.Default.ChannelSortOrder;
            sortByValue.Text           = Settings.Default.ChannelSortBy;
            transparencyTrackBar.Value = ((int)(Settings.Default.FormOpacityValue * 100));
            calendarFormatValue.Text   = Settings.Default.CalendarFormat;

            serviceLevelValues.ClearSelected();
            serviceLevelValues.SetItemChecked(serviceLevelValues.FindStringExact(Settings.Default.SubscriptionType),
                                              true);

            UsernameTextbox.Text  = Settings.Default.Username;
            PasswordTextbox.Text  = Settings.Default.Password;
            ListenKeyTextbox.Text = Settings.Default.ListenKey;

            // set the Listen Key link here
            //LinkLabel.Link link = new LinkLabel.Link();
            //link.LinkData = P.Resources.ListenKeyLinkData;
            ListenKeyLinkLabel.Links[0].LinkData = P.Resources.ListenKeyLinkData;

            // radio buttons
            if (!Settings.Default.RememberPreviousChannel)
            {
                rememberNoRadio.PerformClick();
            }

            if (!Settings.Default.ShowUserToast)
            {
                toastNoRadio.PerformClick();
            }

            togglePremiumTextboxes(serviceLevelValues.SelectedIndex);
        }
示例#10
0
 /// <summary>
 ///     traversiert sämtliche Items und merkt sich jeden Typ genau einmal und gibt diesen aus
 /// </summary>
 public void loadCheckBoxes()
 {
     typeOutput.Items.Clear();
     for (int i = 0; i < lootLib.lootList.Count; i++)
     {
         string temp = lootLib.lootList[i].type;
         if (typeOutput.FindStringExact(temp) == -1)
         {
             typeOutput.Items.Add(temp, true);
         }
         if ((config.useAreaCheckBx) && (lootLib.lootList[i].areaTags.Count != 0))
         {
             areaTags.Items.Clear();
             for (int j = 0; j < lootLib.lootList[i].areaTags.Count; j++)
             {
                 temp = lootLib.lootList[i].areaTags[j];
                 if ((areaTags.FindStringExact(temp) == -1) && (config.useAreaCheckBx))
                 {
                     areaTags.Items.Add(temp, true);
                 }
             }
         }
         if ((config.useQuestCheckBx) && (lootLib.lootList[i].questTags.Count != 0))
         {
             questTags.Items.Clear();
             for (int j = 0; j < lootLib.lootList[i].questTags.Count; j++)
             {
                 temp = lootLib.lootList[i].questTags[j];
                 if ((questTags.FindStringExact(temp) == -1) && (config.useQuestCheckBx))
                 {
                     questTags.Items.Add(temp, true);
                 }
             }
         }
     }
 }
        protected override void LoadScene()
        {
            if (world != null)
            {
                var loader = new WorldLoader(GuiContext, world);
                var result = loader.Load(Scene);

                if (result.Skybox != null)
                {
                    SkyboxScene = new Scene(GuiContext);
                    var skyboxLoader = new WorldLoader(GuiContext, result.Skybox);
                    var skyboxResult = skyboxLoader.Load(SkyboxScene);

                    SkyboxScale  = skyboxResult.SkyboxScale;
                    SkyboxOrigin = skyboxResult.SkyboxOrigin;

                    ViewerControl.AddCheckBox("Show Skybox", ShowSkybox, (v) => ShowSkybox = v);
                }

                var worldLayers = Scene.AllNodes
                                  .Select(r => r.LayerName)
                                  .Distinct();
                SetAvailableLayers(worldLayers);

                if (worldLayers.Any())
                {
                    // TODO: Since the layers are combined, has to be first in each world node?
                    worldLayersComboBox.SetItemCheckState(0, CheckState.Checked);

                    foreach (var worldLayer in result.DefaultEnabledLayers)
                    {
                        worldLayersComboBox.SetItemCheckState(worldLayersComboBox.FindStringExact(worldLayer), CheckState.Checked);
                    }
                }

                if (result.CameraMatrices.Any())
                {
                    if (cameraComboBox == default)
                    {
                        cameraComboBox = ViewerControl.AddSelection("Camera", (cameraName, index) =>
                        {
                            if (index > 0)
                            {
                                if (result.CameraMatrices.TryGetValue(cameraName, out var cameraMatrix))
                                {
                                    Scene.MainCamera.SetFromTransformMatrix(cameraMatrix);
                                }

                                cameraComboBox.SelectedIndex = 0;
                            }
                        });

                        cameraComboBox.Items.Add("Set view to camera...");
                        cameraComboBox.SelectedIndex = 0;
                    }

                    cameraComboBox.Items.AddRange(result.CameraMatrices.Keys.ToArray <object>());
                }

                var physNodes = Scene.AllNodes.OfType <PhysSceneNode>().Distinct();
                triggerNodes  = physNodes.Where(n => n.IsTrigger);
                colliderNodes = physNodes.Where(n => !n.IsTrigger);
            }

            if (worldNode != null)
            {
                var loader = new WorldNodeLoader(GuiContext, worldNode);
                loader.Load(Scene);

                var worldLayers = Scene.AllNodes
                                  .Select(r => r.LayerName)
                                  .Distinct()
                                  .ToList();
                SetAvailableLayers(worldLayers);

                for (var i = 0; i < worldLayersComboBox.Items.Count; i++)
                {
                    worldLayersComboBox.SetItemChecked(i, true);
                }
            }

            ShowBaseGrid = false;

            ViewerControl.Invoke((Action)savedCameraPositionsControl.RefreshSavedPositions);
        }
示例#12
0
        protected override void LoadScene()
        {
            if (model != null)
            {
                modelSceneNode = new ModelSceneNode(Scene, model);
                SetAvailableAnimations(modelSceneNode.GetSupportedAnimationNames());
                Scene.Add(modelSceneNode, false);

                phys = model.GetEmbeddedPhys();
                if (phys == null)
                {
                    var refPhysicsPaths = model.GetReferencedPhysNames();
                    if (refPhysicsPaths.Any())
                    {
                        //TODO are there any models with more than one vphys?
                        if (refPhysicsPaths.Count() != 1)
                        {
                            Console.WriteLine($"Model has more than 1 vphys ({refPhysicsPaths.Count()})." +
                                              " Please report this on https://github.com/SteamDatabase/ValveResourceFormat and provide the file that caused this.");
                        }

                        var newResource = Scene.GuiContext.LoadFileByAnyMeansNecessary(refPhysicsPaths.First() + "_c");
                        if (newResource != null)
                        {
                            phys = (PhysAggregateData)newResource.DataBlock;
                        }
                    }
                }

                var meshGroups = modelSceneNode.GetMeshGroups();

                if (meshGroups.Count() > 1)
                {
                    meshGroupListBox = ViewerControl.AddMultiSelection("Mesh Group", selectedGroups =>
                    {
                        modelSceneNode.SetActiveMeshGroups(selectedGroups);
                    });

                    meshGroupListBox.Items.AddRange(modelSceneNode.GetMeshGroups().ToArray <object>());
                    foreach (var group in modelSceneNode.GetActiveMeshGroups())
                    {
                        meshGroupListBox.SetItemChecked(meshGroupListBox.FindStringExact(group), true);
                    }
                }

                var materialGroups = model.GetMaterialGroups();

                if (materialGroups.Count() > 1)
                {
                    materialGroupListBox = ViewerControl.AddSelection("Material Group", (selectedGroup, _) =>
                    {
                        modelSceneNode?.SetSkin(selectedGroup);
                    });

                    materialGroupListBox.Items.AddRange(materialGroups.ToArray <object>());
                    materialGroupListBox.SelectedIndex = 0;
                }

                modelSceneNode.AnimationController.RegisterUpdateHandler((animation, frame) =>
                {
                    if (animationTrackBar.TrackBar.Value != frame)
                    {
                        animationTrackBar.UpdateValueSilently(frame);
                    }
                    var maximum = animation == null ? 1 : animation.FrameCount - 1;
                    if (animationTrackBar.TrackBar.Maximum != maximum)
                    {
                        animationTrackBar.TrackBar.Maximum = maximum;
                    }
                    animationTrackBar.Enabled  = animation != null;
                    animationPlayPause.Enabled = animation != null;
                });
            }
            else
            {
                SetAvailableAnimations(Enumerable.Empty <string>());
            }

            if (mesh != null)
            {
                meshSceneNode = new MeshSceneNode(Scene, mesh);
                Scene.Add(meshSceneNode, false);
            }

            if (phys != null)
            {
                physSceneNode = new PhysSceneNode(Scene, phys);
                Scene.Add(physSceneNode, false);

                //disabled by default. Enable if viewing only phys or model without meshes
                physSceneNode.Enabled = (modelSceneNode == null || !modelSceneNode.RenderableMeshes.Any());

                ViewerControl.AddCheckBox("Show Physics", physSceneNode.Enabled, (v) => { physSceneNode.Enabled = v; });
            }
        }
示例#13
0
        private void htmlElementToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            HtmlNode nd = ctl.node;

            Control[] control = ctl.Controls.Find("checkedListBox1", true);
            document.Load(Application.StartupPath + "/tempHtml.txt");
            CheckedListBox checkedListBox1 = (CheckedListBox)control[0];

            lock (checkedListBox1.CheckedItems)
            {
                foreach (var item in checkedListBox1.CheckedItems)
                {
                    string        displayname = item.ToString();
                    int           index       = checkedListBox1.FindStringExact(displayname);
                    string        name        = "textBox" + (index + 1).ToString();
                    Control[]     c           = checkedListBox1.Controls.Find(name, true);
                    TextBox       tb          = (TextBox)c[0];
                    HtmlAttribute attr        = document.CreateAttribute(displayname, tb.Text);
                    nd.Attributes.Add(attr);
                }
            }
            Control[] ctl1 = ctl.Controls.Find("innerHtmlTextBox", true);
            TextBox   tb1  = (TextBox)ctl1[0];

            Control[] ctl2 = ctl.Controls.Find("pathTextBox", true);
            TextBox   tb2  = (TextBox)ctl2[0];

            nd.InnerHtml = tb1.Text;
            XPathNavigator nav = document.DocumentNode.CreateRootNavigator();

            if (tb2.Text != string.Empty)
            {
                try
                {
                    var ob = (XPathNodeIterator)nav.Evaluate(tb2.Text);
                    if (ob.Count == 0)
                    {
                        MessageBox.Show("The path is not correct"); return;
                    }
                }

                catch (XPathException) { MessageBox.Show("The Path is Not Correct"); return; }
                HtmlNode node = document.DocumentNode.SelectSingleNode(tb2.Text);
                node.AppendChild(nd);
                document.Save(Application.StartupPath + "/tempHtml.txt");
            }
            else if (MessageBox.Show("Please Enter A Path") == DialogResult.OK)
            {
                tb2.Select();
            }
            richTextBox1.LoadFile(Application.StartupPath + "/tempHtml.txt", RichTextBoxStreamType.PlainText);
            toolStripStatusLabel1.Text = "Html Element <" + nd.Name + "> added";
            string filePath = Application.StartupPath;

            using (Document d = Document.FromString(richTextBox1.Text))
            {
                d.IndentBlockElements = AutoBool.Yes;
                d.IndentSpaces        = 2;
                d.AddTidyMetaElement  = false;
                d.CleanAndRepair();
                d.Save(filePath + "/tempHtml.txt");
            }
            document.LoadHtml(richTextBox1.Text);
            richTextBox1.Clear();
            richTextBox1.LoadFile(filePath + "/tempHtml.txt", RichTextBoxStreamType.PlainText);
        }