void ClamdFinished(DbFile file) { Application.Invoke(delegate { treeFiles.Sensitive = true; btnToggleCrack.Sensitive = true; btnScanWithClamd.Sensitive = true; btnCheckInVirusTotal.Sensitive = true; Workers.Failed -= ClamdFailed; Workers.ScanFinished -= ClamdFinished; Workers.UpdateProgress -= UpdateVirusProgress; prgProgressFiles1.Text = ""; prgProgressFiles1.Visible = false; if (thdPulseProgress != null) { thdPulseProgress.Abort(); thdPulseProgress = null; } if (thdScanFile != null) { thdScanFile = null; } if (!(bool)fileView.GetValue(outIter, 3) && file.HasVirus.HasValue && file.HasVirus.Value) { infectedFiles++; } fileView.Remove(ref outIter); AddFile(file); lblFileStatus.Text = $"{fileView.IterNChildren()} files ({infectedFiles} infected)"; }); }
protected virtual void OnButtonFlatlandRemoveTeamClicked(object sender, System.EventArgs e) { if (flatlandTeamStore.IterNChildren() < 2) { // Can't remove the last team return; } TreeIter iter; if (treeViewFlatlandTeams.Selection.GetSelected(out iter)) { flatlandTeamStore.Remove(ref iter); // Go back through and re-index all the teams int teamIndex = 0; flatlandTeamStore.GetIterFirst(out iter); do { flatlandTeamStore.SetValue(iter, 0, teamIndex++); } while (flatlandTeamStore.IterNext(ref iter)); } }
//Generate ASCII(DEC) [btn_ran] protected void onClickRandom(object sender, EventArgs e) { Random random_ = new Random(); try { if (hex_save.IterNChildren() == 0) { for (int r = 1; r <= Convert.ToInt32(random_ascii.Text); r++) { int ascii_code = random_.Next(1, 256); lst_box(ascii_code.ToString(), true); } } else { hex_save.Clear(); for (int r = 1; r <= Convert.ToInt32(random_ascii.Text); r++) { int ascii_code = random_.Next(1, 256); lst_box(ascii_code.ToString(), true); } } } catch (Exception c) { msg(1, c.ToString(), MessageType.Error); } }
/// <summary> /// Clear _listStore rows by filling columns with empty strings. /// </summary> private void StoreClear() { TreeIter iter; _listStore.GetIterFirst(out iter); for (int i = 0; i < _listStore.IterNChildren(); i++) { _listStore.SetValues(iter, "", "", "", "", "", "", "", "", "", ""); _listStore.IterNext(ref iter); } }
protected void OnButtonAddClicked(object sender, EventArgs e) { DialogSelectPrc dlSP = new DialogSelectPrc(); ResponseType resp = (ResponseType)dlSP.Run(); if (Gtk.ResponseType.Ok == resp) { if (1 > lsPrcs.IterNChildren()) // empty, add prc directly { currentTsk.processes.Add(Group <Process> .GFindWithName(dlSP.selectedPrcName)); lsPrcs.AppendValues(dlSP.selectedPrcName); } else { TreeIter ti; if (this.treeviewProcesses.Selection.GetSelected(out ti)) // add after the selected prc { TreePath tp = lsPrcs.GetPath(ti); currentTsk.processes.Insert((tp.Indices [0] + 1), Group <Process> .GFindWithName(dlSP.selectedPrcName)); ti = lsPrcs.InsertAfter(ti); lsPrcs.SetValue(ti, 0, dlSP.selectedPrcName); } else // Add at the end { currentTsk.processes.Add(Group <Process> .GFindWithName(dlSP.selectedPrcName)); lsPrcs.AppendValues(dlSP.selectedPrcName); } } } dlSP.Destroy(); }
public void UpdateSelectedNamedPolicy() { if (loading) { return; } T pol = GetPolicy(); PolicySet s = PolicyService.GetMatchingSet(pol); TreeIter iter; int i = 0; if (s != null && store.GetIterFirst(out iter)) { do { PolicySet s2 = store.GetValue(iter, 1) as PolicySet; if (s2 != null && s2.Id == s.Id) { policyCombo.Active = i; return; } i++; } while (store.IterNext(ref iter)); } policyCombo.Active = store.IterNChildren() - 1; }
protected void OnOK(object sender, EventArgs e) { // Clear media player list for (int j = 0; j != mediaPlayerCombo.Model.IterNChildren();) { Console.WriteLine("Removing a line"); mediaPlayerCombo.RemoveText(0); } // Add media players to list for (int i = 0; i < store.IterNChildren(); i++) { TreeIter iter; string playerValue; // Get strings from list store.GetIterFromString(out iter, i.ToString()); playerValue = store.GetValue(iter, 0).ToString(); // Append strings to combo box Console.WriteLine("Adding " + playerValue); mediaPlayerCombo.AppendText(playerValue); // Select first player in combo box TreeIter newSelect; mediaPlayerCombo.Model.GetIterFirst(out newSelect); mediaPlayerCombo.SetActiveIter(newSelect); } this.Destroy(); }
/// <summary> /// Displays the intellisense popup at the specified coordinates. Returns true if the /// popup is successfully generated (e.g. if it finds some auto-completion options). /// Returns false otherwise. /// </summary> /// <param name="x">Horizontal coordinate</param> /// <param name="y">Vertical coordinate</param> private bool ShowAtCoordinates(int x, int y) { // only display the list if there are options to display if (completionModel.IterNChildren() > 0) { completionForm.TransientFor = MainWindow; completionForm.Move(x, y); completionForm.Resize(completionForm.WidthRequest, completionForm.HeightRequest); completionForm.ShowAll(); completionView.SetCursor(new TreePath("0"), null, false); completionView.Columns[2].FixedWidth = completionView.WidthRequest / 10; // OK so sometimes the HTMLView's web browser will steal focus. There is a // hack in the HTMLView code which manually gives focus back to the toplevel // window in this situation, but apparently creating the intellisense popup // is enough to trigger this hack if there is a HTMLView onscreen. This is a // problem because giving the focus back to the main window will take focus // away from the intellisense popup which causes the intellisense popup to // disappear. The workaround is to wait for all Gtk events to process, and // then recreate the intellisense popup if need be. while (GLib.MainContext.Iteration()) { ; } if (!completionForm.Visible) { // For some reason, the coordinates/sizing get reset if we lose focus. completionForm.Move(x, y); completionForm.Resize(completionForm.WidthRequest, completionForm.HeightRequest); completionForm.ShowAll(); } return(true); } return(false); }
protected void OnBtnAnadirServClicked(object sender, EventArgs e) { int cont = 0; TreeIter iter; ListStore otro = cod.GetDetFact(); if (otro.IterNChildren() > 0) { if (otro.GetIterFirst(out iter)) { do { TreeIter iter2; if (otro.GetIterFirst(out iter2)) { if (EntCodServ.Text == otro.GetValue(iter, 0).ToString()) { cont = +1; cod.Mensaje("El servicio ya fue añadido.\nSi desea actualizar la cantidad, haga doble click sobre el servicio\nen el listado de abajo.", ButtonsType.Ok, MessageType.Error); EntCodServ.ChildFocus(DirectionType.Up); } } } while (otro.IterNext(ref iter)); } } AñadirServicios(cont); }
public CompuMethod SaveData(CompuMethod dat = null) { if (null == dat) { dat = currentCM; } dat.name = this.entryName.Text; dat.description = this.entryDescription.Text; if (dat is RationalFunction) { ((RationalFunction)dat).Numerators [0] = Convert.ToDouble(this.entryNumerator.Text); ((RationalFunction)dat).Numerators [1] = Convert.ToDouble(this.entryNumerator1.Text); ((RationalFunction)dat).Denominators [0] = Convert.ToDouble(this.entryDenominator.Text); ((RationalFunction)dat).Denominators [1] = Convert.ToDouble(this.entryDenominator1.Text); } else if (dat is VerbalTable) { TreeIter ti; lsVT.GetIterFirst(out ti); ((VerbalTable)dat).items.Clear(); for (int i = 0; i < lsVT.IterNChildren(); i++) { ((VerbalTable)dat).items.Add((int)lsVT.GetValue(ti, 0), (string)lsVT.GetValue(ti, 1)); lsVT.IterNext(ref ti); } } else { } return(dat); }
protected virtual void ResetLayout() { Model = comboListStore = new ListStore(typeof(string), typeof(object)); if (ItemsList == null) { return; } foreach (var item in ItemsList) { if (item == null) { continue; } var title = RenderTextFunc == null?item.ToString() : RenderTextFunc(item); if (title == null) { continue; } comboListStore.AppendValues( title, WrapValueIfNeed(item) ); } if (DefaultFirst && comboListStore.IterNChildren() > 0) { Active = 0; } }
void LoadOSesFinished() { Application.Invoke(delegate { Workers.Failed -= LoadOSesFailed; Workers.Finished -= LoadOSesFinished; Workers.UpdateProgress -= UpdateProgress; if (thdPulseProgress != null) { thdPulseProgress.Abort(); thdPulseProgress = null; } if (thdPopulateOSes != null) { thdPopulateOSes.Abort(); thdPopulateOSes = null; } lblProgress.Visible = false; prgProgress.Visible = false; treeOSes.Sensitive = true; btnAdd.Visible = true; btnRemove.Visible = true; btnCompress.Visible = true; btnSave.Visible = true; btnHelp.Visible = true; btnSettings.Visible = true; lblOSStatus.Visible = true; lblOSStatus.Text = $"{osView.IterNChildren()} operating systems"; }); }
private void fillAutocomplete() { if (!RepresentationModel.CanEntryFastSelect) { return; } logger.Info("Запрос данных для автодополнения..."); completionListStore = new ListStore(typeof(string), typeof(object)); if (RepresentationModel.ItemsList == null) { RepresentationModel.UpdateNodes(); } foreach (var item in RepresentationModel.ItemsList) { completionListStore.AppendValues( (item as INodeWithEntryFastSelect).EntityTitle, item ); } entryObject.Completion.Model = completionListStore; logger.Debug("Получено {0} строк автодополения...", completionListStore.IterNChildren()); }
/// <summary> /// Calcula los errores del paso del asistente; /// </summary> protected override void ComputeErrors() { if (fileStore.IterNChildren() == 0) { errors.Add("· Tienes que añadir archivos de imagen para ser procesados."); } }
public Process SaveData(Process dat = null) { if (null == dat) { dat = currentPrc; } dat.name = this.entryName.Text; dat.description = this.entryDescription.Text; TreeIter ti; dat.receiveMessages.Clear(); lsRM.GetIterFirst(out ti); for (int i = 0; i < lsRM.IterNChildren(); i++) { dat.receiveMessages.Add(Group <Message> .GFindWithName((string)lsRM.GetValue(ti, 0))); lsRM.IterNext(ref ti); } dat.sendMessages.Clear(); lsSM.GetIterFirst(out ti); for (int i = 0; i < lsSM.IterNChildren(); i++) { dat.sendMessages.Add(Group <Message> .GFindWithName((string)lsSM.GetValue(ti, 0))); lsSM.IterNext(ref ti); } return(dat); }
private void SaveToggle_Activated(object sender, EventArgs args) { List <string> gameDirs = new List <string>(); _gameDirsBoxStore.GetIterFirst(out TreeIter treeIter); for (int i = 0; i < _gameDirsBoxStore.IterNChildren(); i++) { gameDirs.Add((string)_gameDirsBoxStore.GetValue(treeIter, 0)); _gameDirsBoxStore.IterNext(ref treeIter); } float resScaleCustom; if (!float.TryParse(_resScaleText.Buffer.Text, out resScaleCustom) || resScaleCustom <= 0.0f) { resScaleCustom = 1.0f; } if (_validTzRegions.Contains(_systemTimeZoneEntry.Text)) { ConfigurationState.Instance.System.TimeZone.Value = _systemTimeZoneEntry.Text; } ConfigurationState.Instance.Logger.EnableError.Value = _errorLogToggle.Active; ConfigurationState.Instance.Logger.EnableWarn.Value = _warningLogToggle.Active; ConfigurationState.Instance.Logger.EnableInfo.Value = _infoLogToggle.Active; ConfigurationState.Instance.Logger.EnableStub.Value = _stubLogToggle.Active; ConfigurationState.Instance.Logger.EnableDebug.Value = _debugLogToggle.Active; ConfigurationState.Instance.Logger.EnableGuest.Value = _guestLogToggle.Active; ConfigurationState.Instance.Logger.EnableFsAccessLog.Value = _fsAccessLogToggle.Active; ConfigurationState.Instance.Logger.EnableFileLog.Value = _fileLogToggle.Active; ConfigurationState.Instance.Logger.GraphicsDebugLevel.Value = Enum.Parse <GraphicsDebugLevel>(_graphicsDebugLevel.ActiveId); ConfigurationState.Instance.System.EnableDockedMode.Value = _dockedModeToggle.Active; ConfigurationState.Instance.EnableDiscordIntegration.Value = _discordToggle.Active; ConfigurationState.Instance.Graphics.EnableVsync.Value = _vSyncToggle.Active; ConfigurationState.Instance.System.EnableMulticoreScheduling.Value = _multiSchedToggle.Active; ConfigurationState.Instance.System.EnablePtc.Value = _ptcToggle.Active; ConfigurationState.Instance.System.EnableFsIntegrityChecks.Value = _fsicToggle.Active; ConfigurationState.Instance.System.IgnoreMissingServices.Value = _ignoreToggle.Active; ConfigurationState.Instance.Hid.EnableKeyboard.Value = _directKeyboardAccess.Active; ConfigurationState.Instance.Ui.EnableCustomTheme.Value = _custThemeToggle.Active; ConfigurationState.Instance.System.Language.Value = Enum.Parse <Language>(_systemLanguageSelect.ActiveId); ConfigurationState.Instance.System.Region.Value = Enum.Parse <Configuration.System.Region>(_systemRegionSelect.ActiveId); ConfigurationState.Instance.System.AudioBackend.Value = Enum.Parse <AudioBackend>(_audioBackendSelect.ActiveId); ConfigurationState.Instance.System.SystemTimeOffset.Value = _systemTimeOffset; ConfigurationState.Instance.Ui.CustomThemePath.Value = _custThemePath.Buffer.Text; ConfigurationState.Instance.Graphics.ShadersDumpPath.Value = _graphicsShadersDumpPath.Buffer.Text; ConfigurationState.Instance.Ui.GameDirs.Value = gameDirs; ConfigurationState.Instance.System.FsGlobalAccessLogMode.Value = (int)_fsLogSpinAdjustment.Value; ConfigurationState.Instance.Graphics.MaxAnisotropy.Value = float.Parse(_anisotropy.ActiveId); ConfigurationState.Instance.Graphics.ResScale.Value = int.Parse(_resScaleCombo.ActiveId); ConfigurationState.Instance.Graphics.ResScaleCustom.Value = resScaleCustom; MainWindow.SaveConfig(); MainWindow.UpdateGraphicsConfig(); MainWindow.ApplyTheme(); Dispose(); }
private void HandleRemoveAction() { if (fileSystem == null) { return; } List <TreeIter> selectedIters = packTreeView.GetSelected().ToList(); if (selectedIters.Count == 0) { return; } TreePath path = folderStore.GetPath(selectedIters.Last()); for (int i = 0; i < selectedIters.Count - 1; i++) { path.Prev(); } selectedIters.ForEach(selectedInFolder => { if (TreeIter.Zero.Equals(selectedInFolder)) { return; } Packer.Item selectedItem = folderStore.GetValue(selectedInFolder, 2) as Packer.Item; if (selectedItem.IsRoot) { return; } TreeIter selectedInPack = FindInPack(selectedItem); if (!TreeIter.Zero.Equals(selectedInPack)) { List <TreeIter> iterInPack = packStore.GetTree(selectedInPack).ToList(); iterInPack.Select(iter => packStore.GetValue(iter, 0) as Packer.Item).ToList() .ForEach(item => { if (!item.IsFolder) { fileSystem.Remove(item); } }); packStore.Remove(ref selectedInPack); } folderStore.Remove(ref selectedInFolder); }); while (path.Indices.Last() >= folderStore.IterNChildren() && path.Prev()) { ; } packTreeView.SelectAndFocus(path); }
public void LoadDevices(ApplicationDataModel dataModel) { this.DataModel = dataModel; int previousDeviceIndex = comboboxDevices.Active; ignoreComboboxChange = true; store.Clear(); foreach (BlinkStickDeviceSettings entity in dataModel.Devices) { store.AppendValues(entity); } comboboxDevices.Model = store; ignoreComboboxChange = false; if (store.IterNChildren() >= 1) { if (previousDeviceIndex == -1) { if (AutoSelectDevice) { comboboxDevices.Active = 0; } } else { while (store.IterNChildren() <= previousDeviceIndex) { previousDeviceIndex--; } comboboxDevices.Active = previousDeviceIndex; } } else { comboboxDevices.Active = -1; } }
private void fillAutocomplete() { logger.Info("Запрос данных для автодополнения..."); completionListStore = new ListStore(typeof(string)); IUnitOfWork localUoW; var dlg = DialogHelper.FindParentUowDialog(this); if (dlg != null) { localUoW = dlg.UoW; } else { localUoW = UnitOfWorkFactory.CreateWithoutRoot(); } var bindSource = Binding.BindedSources.FirstOrDefault(); if (bindSource == null) { throw new InvalidOperationException($"У виджета {this.Name} не добавлен ни один источник для биндинга через {this.Name}.Binding"); } var bridge = bindSource.BindedBridges.OfType <IPropertyBindingBridge>().FirstOrDefault(); if (bridge == null) { throw new InvalidOperationException($"В виджете {this.Name} не добавлено ни одного биндинга на свойство."); } var clazz = NHibernate.Proxy.NHibernateProxyHelper.GuessClass(bindSource.DataSourceObject); var r = localUoW.Session .CreateCriteria(clazz) .SetProjection(Projections.Distinct(Projections.Property(bridge.SourcePropertyName))) .List <string>(); foreach (var item in r) { if (String.IsNullOrWhiteSpace(item)) { continue; } completionListStore.AppendValues(item); } Completion.Model = completionListStore; logger.Debug("Получено {0} строк автодополения...", completionListStore.IterNChildren()); if (this.HasFocus) { this.Completion.Complete(); } }
/// <summary> /// Show the context list. Return true if popup box shown /// </summary> /// <param name="characterPressed">Character pressed</param> /// <returns>Completion form showing</returns> private bool ShowCompletionWindow(char characterPressed) { // Get a list of items to show and put into completion window. string TextBeforePeriod = GetWordBeforePosition(textEditor.Caret.Offset); List <string> Items = new List <string>(); List <NeedContextItemsArgs.ContextItem> allitems = new List <NeedContextItemsArgs.ContextItem>(); ContextItemsNeeded(this, new NeedContextItemsArgs() { ObjectName = TextBeforePeriod, Items = Items, AllItems = allitems }); completionModel.Clear(); foreach (NeedContextItemsArgs.ContextItem item in allitems) { completionModel.AppendValues(item.IsEvent ? functionPixbuf : propertyPixbuf, item.Name, item.Units, item.TypeName, item.Descr, item.ParamString); } if (completionModel.IterNChildren() > 0) { initingCompletion = true; textEditor.TextArea.InsertAtCaret(characterPressed.ToString()); // Turn readonly on so that the editing window doesn't process keystrokes. textEditor.Document.ReadOnly = true; // Work out where to put the completion window. // This should probably be done a bit more intelligently to detect when we are too near the bottom or right // of the screen, and move accordingly. Left as an exercise for the student. Cairo.Point p = textEditor.TextArea.LocationToPoint(textEditor.Caret.Location); p.Y += (int)textEditor.LineHeight; // Need to convert to screen coordinates.... int x, y; int frameX, frameY; mainWindow.GetOrigin(out frameX, out frameY); textEditor.TextArea.TranslateCoordinates(_mainWidget.Toplevel, p.X, p.Y, out x, out y); CompletionForm.TransientFor = MainWidget.Toplevel as Window; CompletionForm.Move(frameX + x, frameY + y); CompletionForm.ShowAll(); CompletionForm.Resize(CompletionView.Requisition.Width, 300); if (CompletionForm.GdkWindow != null) { CompletionForm.GdkWindow.Focus(0); } while (Gtk.Application.EventsPending()) { Gtk.Application.RunIteration(); } CompletionView.SetCursor(new TreePath("0"), null, false); initingCompletion = false; return(true); } return(false); }
void SetupModel(Interface referer) { foreach (IElement elem in referer.Symbols) { model.AppendValues(true, elem.Name, elem); } selectedCount = model.IterNChildren(); countLabel.Text = selectedCount.ToString(); codeTextView.Buffer.Text = renderer(elements); }
private void updateButtonOk() { if (trackerListStore.IterNChildren() > 0) { buttonOk.Sensitive = true; } else { buttonOk.Sensitive = false; } }
public void UpdateSelectedNamedPolicy() { if (selectingPolicy) { return; } synchingPoliciesCombo = true; try { // Find a policy set which is common to all policy types if (!isRoot && panelData.UseParentPolicy) { policyCombo.Active = 0; return; } int active = -1; PolicySet matchedSet = panelData.GetMatchingSet(setsInCombo); TreeIter iter; int i = 0; if (matchedSet != null && store.GetIterFirst(out iter)) { do { PolicySet s2 = store.GetValue(iter, 1) as PolicySet; if (s2 != null && s2.Id == matchedSet.Id) { active = i; break; } i++; }while (store.IterNext(ref iter)); } if (active != -1) { policyCombo.Active = active; } else { policyCombo.Active = store.IterNChildren() - 1; } warningMessage.Visible = isGlobalPolicy && panelData.Modified; } finally { synchingPoliciesCombo = false; } }
void OnRemoveWorkItem(object sender, EventArgs e) { TreeSelection selection = workItemsView.Selection; TreeIter iter; if (!selection.GetSelected(out iter)) { return; } workItemStore.Remove(ref iter); removeButton.Sensitive = workItemStore.IterNChildren() > 0; }
private void SetActive() { if (store.IterNChildren() == 0) { store.AppendValues("No iPod Found", null); this.Active = 0; } else { this.Active = 0; } }
private void PopulateAddressCombo() { store.Clear(); TreeIter iter; if (networksComboBox.GetActiveIter(out iter)) { Network selectedNetwork = networksListStore.GetValue(iter, 0) as Network; /* * if (Core.ZeroconfManager != null) { * foreach (NearbyNode node in Core.NearbyNodes) { * if (node.NetworkId == selectedNetwork.NetworkID) { * if (node.Port != TcpTransport.DefaultPort) { * store.AppendValues(node, node.Address.ToString() + ":" + node.Port.ToString()); * } else { * store.AppendValues(node, node.Address.ToString()); * } * } * } * } */ foreach (TrustedNodeInfo node in selectedNetwork.TrustedNodes.Values) { if (node.AllowConnect) { if (!IsNearby(node)) { IDestination destination = node.GetFirstConnectableDestination(Runtime.Core); if (destination != null) { store.AppendValues(node, destination.ToString()); } } } } if (store.IterNChildren() == 0) { store.AppendValues(new object(), string.Empty); } ipCombo.Sensitive = true; } else { ipCombo.Sensitive = false; ipCombo.Entry.Text = string.Empty; } }
void UpdateArches() { var active = archCombo.Active; archStore.Clear(); var osVersion = IPhoneSdkVersion.V3_1; try { osVersion = IPhoneSdkVersion.Parse(minOSComboEntry.Entry.Text); } catch {} archStore.AppendValues("ARMv6"); archStore.AppendValues("ARMv6 + ARMv7"); if (osVersion >= IPhoneSdkVersion.V3_1) { archStore.AppendValues("ARMv7"); } archCombo.Active = Math.Min(active, archStore.IterNChildren() - 1); }
public bool Remove(ref TreeIter iter) { // Try to change the active value to the default TreeIter active_iter; if (GetActiveIter(out active_iter)) { if (active_iter.Equals(iter)) { if (Default != null) { ActiveValue = Default; } else if (store.IterNChildren() > 0) { Active = 0; } } } return(store.Remove(ref iter)); }
private bool GetIterForEqualizerSetting(EqualizerSetting eq, out TreeIter iter) { for (int i = 0, n = store.IterNChildren(); i < n; i++) { if (store.IterNthChild(out iter, i) && store.GetValue(iter, 1) == eq) { return(true); } } iter = TreeIter.Zero; return(false); }
public void ValidarRadioBUnaVez(ListStore list, RadioButton rb1, RadioButton rb2) { if (list.IterNChildren() > 0) { rb1.Sensitive = false; rb2.Sensitive = false; } else { rb1.Sensitive = true; rb2.Sensitive = true; } }