private void AddPlanetButton_Click(object sender, EventArgs e) { try { string _namePlanet = FormsUtils.Enter("Укажите название планеты", "Информация планеты"); int _massPlanet = Convert.ToInt32(FormsUtils.Enter("Укажите массу планеты", "Информация планеты")); int _period = Convert.ToInt32(FormsUtils.Enter("Укажите период вращения планеты", "Информация планеты")); int _count = Convert.ToInt32(FormsUtils.Enter("Укажите кол-во спутников планеты", "Информация планеты")); string SatelliteInf = null; if (_count > 0) { for (int i = 0; i < _count; i++) { string _nameSatellite = FormsUtils.Enter("Укажите название спутника", "Информация спутника"); string _massSatellite = FormsUtils.Enter("Укажите массу спутника", "Информация спутника"); string _People = FormsUtils.Enter("Укажите открываателя", "Информация спутника"); string _Year = FormsUtils.Enter("Укажите год открытия", "Информация спутника"); SatelliteInf += " " + _nameSatellite + " " + _massSatellite + " " + _People + " " + _Year; } } SpaceObjects.AddPlanet(_massPlanet, _namePlanet, _count, _period, SatelliteInf); } catch { FormsUtils.ErrorMessageBox("Error"); } }
private void glTFImportButton_Click(object sender, EventArgs e) { var dialog = new OpenFileDialog(); dialog.Title = "Select a glTF/glb file."; FormsUtils.StaExecute(() => { dialog.ShowDialog(); }); if (dialog.FileName == null) { return; } var importer = new GLTFImporter(); importer.Process(dialog.FileName); var anims = importer.Animations; var animC = Content.Content.Get().AvatarAnimations as AvatarAnimationProvider; foreach (var anim in anims) { animC.Runtime.Add(anim.Name + "-runtime.anim", ulong.MaxValue - (ulong)(RuntimeID++), anim); } RefreshAllList(); }
/// <summary> /// Initializes a new instance of the <see cref="SelectionImageLabelButtonBase" /> class. /// </summary> protected SelectionImageLabelButtonBase() { ImageResourceClassType = GetType(); SelectionStyle = ImageLabelButtonSelectionStyles.ToggleSelectionThroughAllStyles; ButtonLabel = FormsUtils.GetSimpleLabel(); UpdateButtonTextFromStyle = true; }
private void PasteButton_Click(object sender, EventArgs e) { try { var oldLevels = ActiveUpgrades.Upgrades; string text = null; FormsUtils.StaExecute(() => { text = Clipboard.GetText(); }); var levels = JsonConvert.DeserializeObject <List <UpgradeLevel> >(text); if (oldLevels.Count > 0) { var result = MessageBox.Show("This operation will overwrite existing upgrade levels. Continue?", "Warning", MessageBoxButtons.YesNo); if (result == DialogResult.No) { return; } } ActiveUpgrades.Upgrades = levels; UpdateFile(); Render(); } catch { MessageBox.Show("The clipboard did not contain valid upgrade data. Try paste it somewhere else and make sure it's at least valid JSON.", "Hey!"); } }
public override void Terminate() { if (this.pluginMenuItem != null) { this.pluginHost.MainWindow.ToolsMenu.DropDownItems.Remove(pluginMenuItem); } if (this.pluginMenuItemAbout != null) { this.pluginMenuItemAbout.Click -= this.pluginMenuItemAboutOnClickEventHandler; } if (this.pluginMenuItemOptions != null) { this.pluginMenuItemOptions.Click -= this.pluginMenuItemOptionsOnClickEventHandler; } if (this.pluginMenuItemBatchPasswordChanger != null) { this.pluginMenuItemBatchPasswordChanger.Click -= this.pluginMenuItemBatchPasswordChangerOnClickEventHandler; } if (this.resourcesEventHandler != null) { AppDomain.CurrentDomain.ResourceResolve -= this.resourcesEventHandler; } var control = FormsUtils.FindControlRecursive(pluginHost.MainWindow, KeePassListViewControl); var listViewControl = control as CustomListViewEx; if (listViewControl != null) { listViewControl.KeyUp -= listViewControl_KeyUp; } }
/// <summary> /// Initializes a new instance of the <see cref="SimpleImageLabelButton" /> class. /// </summary> public SimpleImageLabelButton(double labelWidth, double labelHeight, string fontFamilyOverride = "") { CanSelect = false; ButtonToggleSelection = false; ButtonLabel = FormsUtils.GetSimpleLabel("", width: labelWidth, height: labelHeight, fontFamilyOverride: fontFamilyOverride); SetAllStyles(); }
private void CopyButton_Click(object sender, EventArgs e) { var levels = ActiveUpgrades.Upgrades; var text = JsonConvert.SerializeObject(levels, Formatting.Indented); FormsUtils.StaExecute(() => { Clipboard.SetText(text); }); }
/// <summary> /// MUST GO FIRST /// </summary> public static double AdjustForOsAndDevice(this double startingSize) { var factor = Math.Min(MAX_OS_AND_DEVICE_ADJUSTMENT, CURRENT_DEVICE_WIDTH_RATIO * (FormsUtils.IsIos() ? IOS_MULTIPLIER : ANDROID_MULTIPLIER)); var retSize = startingSize * factor; return(retSize); }
private void CountPlanetButton_Click(object sender, EventArgs e) { try { string count = Convert.ToString(SpaceObjects.CountPlanets()); FormsUtils.ShowMessage(count); } catch { FormsUtils.ErrorMessageBox("Error"); } }
private void Go_Click(object sender, EventArgs e) { try { int[,] arr2 = DataGridViewUtils.GridToArray2 <int>(arr2FromDataGridView); Nine logic = new Nine(arr2); DataGridViewUtils.ArrayToGrid(arr2ToDataGridView, logic.Process()); } catch (Exception except) { FormsUtils.ErrorMessageBox(except); } }
private void AddStarButton_Click(object sender, EventArgs e) { try { string _nameStar = FormsUtils.Enter("Укажите название звезды", "Информация звезды"); int _massStar = Convert.ToInt32(FormsUtils.Enter("Укажите массу звезды", "Информация звезды")); SpaceObjects.AddStar(_massStar, _nameStar); } catch { FormsUtils.ErrorMessageBox("Error"); } }
public void StartWithOBJM() { var dialog = new OpenFileDialog(); dialog.Filter = "OBJM Data|*.bin"; dialog.Title = "Select Object Module File."; FormsUtils.StaExecute(() => { dialog.ShowDialog(); }); if (dialog.FileName == "") { return; } var stream = dialog.OpenFile(); var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN); io.ReadUInt32(); //pad var version = io.ReadUInt32(); var MjbO = io.ReadUInt32(); var compressionCode = io.ReadByte(); if (compressionCode != 1) { throw new Exception("hey what!!"); } var iop = new IffFieldEncode(io); var table = new List <ushort>(); while (io.HasMore) { var value = iop.ReadUInt16(); if (value == 0) { break; } table.Add(value); } Io = iop; BasePosition = Io.MarkStream(); RenderFields(); }
private void FileChooseButton_Click(object sender, EventArgs e) { if (openFileDialog.ShowDialog() == DialogResult.OK) { try { Logic.ReadFile(openFileDialog.FileName, stack); } catch (Exception except) { FormsUtils.ErrorMessageBox(except); } } }
private void ReadButton_Click(object sender, EventArgs e) { if (inputOpenFileDialog.ShowDialog() == DialogResult.OK) { try { io.Text = io.ReadFromFile(inputOpenFileDialog.FileName); DataGridViewUtils.ArrayToGrid(InDGV, io.Text); } catch (Exception except) { FormsUtils.ErrorMessageBox(except); } } }
private void SerializeButton_Click(object sender, EventArgs e) { if (inputOpenFileDialog.ShowDialog() == DialogResult.OK) { try { inputOpenFileDialog.InitialDirectory = Path.GetDirectoryName(inputOpenFileDialog.FileName); io.WriteForSerialization(inputOpenFileDialog.FileName); } catch (Exception except) { FormsUtils.ErrorMessageBox(except); } } }
private void inputButton_Click(object sender, EventArgs e) { if (openFileDialog.ShowDialog() == DialogResult.OK) { try { Logic.ReadFile(openFileDialog.FileName, list); } catch (Exception except) { FormsUtils.ErrorMessageBox(except); } } PrintListToListTextBox(); }
private void RunButton_Click(object sender, EventArgs e) { if (saveFileDialog.ShowDialog() == DialogResult.OK) { try { saveFileDialog.InitialDirectory = Path.GetDirectoryName(saveFileDialog.FileName); Logic.WriteFile(saveFileDialog.FileName, stack); } catch (Exception except) { FormsUtils.ErrorMessageBox(except); } } }
private void Info_btn_Click(object sender, EventArgs e) { try { InfoTextBox.Text = ""; string[] phonesInfo = phones.PrintInfo(); for (int i = 0; i < phonesInfo.Length; i++) { InfoTextBox.AppendText(phonesInfo[i]); } } catch { FormsUtils.ErrorMessageBox("Error"); } }
private void RandomButton_Click(object sender, EventArgs e) { if (outputSaveFileDialog.ShowDialog() == DialogResult.OK) { try { outputSaveFileDialog.InitialDirectory = Path.GetDirectoryName(outputSaveFileDialog.FileName); int size = Convert.ToInt32(SizeBox.Text); io.WriteToFile(outputSaveFileDialog.FileName, size); } catch (Exception except) { FormsUtils.ErrorMessageBox(except); } } }
private void NameStarButton_Click(object sender, EventArgs e) { try { InfoTextBox.Text = ""; string[] name = SpaceObjects.PrintNameStars(); for (int i = 0; i < name.Length; i++) { InfoTextBox.AppendText(name[i]); } } catch { FormsUtils.ErrorMessageBox("Error"); } }
private void FileButton_Click(object sender, EventArgs e) { if (inputOpenFileDialog.ShowDialog() == DialogResult.OK) { try { inputOpenFileDialog.InitialDirectory = Path.GetDirectoryName(inputOpenFileDialog.FileName); mv.numbers = io.ReadFromFile(inputOpenFileDialog.FileName, mv.numbers); } catch (Exception except) { FormsUtils.ErrorMessageBox(except); } } FileBox.Text = io.Text; }
private void Go_Click(object sender, EventArgs e) { try { int[,] arr2 = DataGridViewUtils.GridToArray2 <int>(arr2FromDataGridView); Nine logic = new Nine(arr2); logic.Process2(out int[,] res, out int resmin); DataGridViewUtils.ArrayToGrid(arr2ToDataGridView, res); labelres.Text = resmin.ToString(); label3.Show(); } catch (Exception except) { FormsUtils.ErrorMessageBox(except); } }
private void PlanetsInfoButton_Click(object sender, EventArgs e) { try { InfoTextBox.Text = ""; string[] planetsInfo = SpaceObjects.PrintInfoPlanets(); for (int i = 0; i < planetsInfo.Length; i++) { InfoTextBox.AppendText(planetsInfo[i]); } } catch { FormsUtils.ErrorMessageBox("Error"); } }
private void inputToFileButton_Click(object sender, EventArgs e) { if (inputSaveFileDialog.ShowDialog() == DialogResult.OK) { try { inputSaveFileDialog.InitialDirectory = Path.GetDirectoryName(inputSaveFileDialog.FileName); int[,] input = DataGridViewUtils.GridToArray2 <int>(arr2FromDataGridView); UtilsW.WriteInputIntoFile(inputSaveFileDialog.FileName, input); } catch (Exception except) { FormsUtils.ErrorMessageBox(except); } } }
private void ImportGLTFButton_Click(object sender, EventArgs e) { var dialog = new OpenFileDialog(); dialog.Filter = "glTF Binary Package|*.glb|glTF Separate/Embedded|*.gltf"; dialog.Title = "Select a glTF/glb file."; FormsUtils.StaExecute(() => { dialog.ShowDialog(); }); if (dialog.FileName == "") { return; } var importer = new GLTFImporter(); importer.Process(dialog.FileName); var anims = importer.Animations; // add to runtime ClearScene(); var animC = Content.Content.Get().AvatarAnimations as AvatarAnimationProvider; foreach (var anim in anims) { animC.Runtime.Add(anim.Name + "-runtime.anim", ulong.MaxValue - (RuntimeID++), anim); SceneAnimations.Add(new AvatarToolAnimation(anim, anim.Name + "-runtime")); } var generator = new AppearanceGenerator(); foreach (var mesh in importer.Meshes) { generator.GenerateAppearanceTSO(new List <ImportMeshGroup>() { mesh }, mesh.Name + "-runtime", true); SceneMeshes.Add(new AvatarToolRuntimeMesh(false, mesh.Name + "-runtime", mesh)); } SetImportMode(true, Path.GetFileName(dialog.FileName)); RefreshSceneAnims(); RefreshSceneMeshes(); }
private void checkControls() { Debug.WriteLine("checkControls"); if (this.pwChangerWorker != null && this.pwChangerWorker.IsRunning) { return; } if (this.maskedTextBoxNewPassword.UseSystemPasswordChar && this.passwordsMatch() || !this.maskedTextBoxNewPassword.UseSystemPasswordChar && FormsUtils.HasText(this.maskedTextBoxNewPassword)) { this.buttonChangePassword.Enabled = true; } else { this.buttonChangePassword.Enabled = false; } this.maskedTextBoxRepeatNewPassword.Enabled = this.maskedTextBoxNewPassword.UseSystemPasswordChar; }
private void inputFromFileButton_Click(object sender, EventArgs e) { if (inputOpenFileDialog.ShowDialog() == DialogResult.OK) { try { inputOpenFileDialog.InitialDirectory = Path.GetDirectoryName(inputOpenFileDialog.FileName); int[,] input; UtilsW.ReadInputFromFile(inputOpenFileDialog.FileName, ' ', out input); DataGridViewUtils.ArrayToGrid(arr2FromDataGridView, input); } catch (Exception except) { FormsUtils.ErrorMessageBox(except); } } }
protected FlexView(bool useScrollView = true) { IsClippedToBounds = true; BackgroundColor = Color.Transparent; if (useScrollView) { var scroller = FormsUtils.GetExpandingScrollView(); scroller.BindingContext = BindingContext; scroller.Content = MasterLayoutAsView; Content = scroller; } else { Content = MasterLayoutAsView; } MasterLayoutAsView.BindingContext = BindingContext; }
private void ExportGLTFButton_Click(object sender, EventArgs e) { var dialog = new SaveFileDialog(); dialog.Title = "Save the scene as a glTF/glb file."; dialog.Filter = "glTF Binary Package|*.glb|glTF Separate|*.gltf"; dialog.DefaultExt = "glb"; dialog.AddExtension = true; FormsUtils.StaExecute(() => { dialog.ShowDialog(); }); Content.Content.Get().Changes.BlockingResMod(new ResAction(() => { var interactive = Animator.Renderer; var ava = (VMAvatar)interactive.TargetOBJ.BaseObject; var exp = new GLTFExporter(); ava.Avatar.Skeleton = ava.Avatar.BaseSkeleton.Clone(); ava.Avatar.ReloadSkeleton(); var scn = exp.SceneGroup(ava.Avatar.Bindings.Select(x => x.Mesh).ToList(), SceneAnimations.Select(x => x.Anim).ToList(), ava.Avatar.Bindings.Select(x => x.Texture?.Get(GameFacade.GraphicsDevice)).ToList(), ava.Avatar.BaseSkeleton); if (dialog.FileName == "") { return; } if (dialog.FileName.EndsWith(".gltf")) { scn.SaveGLTF(dialog.FileName); } else { scn.SaveGLB(dialog.FileName); } })); SetImportMode(false, Path.GetFileName(dialog.FileName)); }
private void outputToFileButton_Click(object sender, EventArgs e) { if (outputSaveFileDialog.ShowDialog() == DialogResult.OK) { try { outputSaveFileDialog.InitialDirectory = Path.GetDirectoryName(outputSaveFileDialog.FileName); int[,] output = DataGridViewUtils.GridToArray2 <int>(arr2ToDataGridView); UtilsW.WriteInputIntoFile(outputSaveFileDialog.FileName, output); /*IList<int> output = DataGridViewUtils.GridToList<int>(arr2ToDataGridView); * Nine.WriteOutputIntoFile(outputSaveFileDialog.FileName, output); */ } catch (Exception except) { FormsUtils.ErrorMessageBox(except); } } }