private void SaveButton_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(NameBox.Text)) { MessageBox.Show("You must enter a server name."); return; } if (string.IsNullOrEmpty(IPBox.Text) || !IPAddress.TryParse(IPBox.Text, out IPAddress ipAddress)) { MessageBox.Show("You must enter a (valid) IP address."); return; } if (string.IsNullOrEmpty(PasswordBox.Text)) { MessageBox.Show("You must enter a password."); return; } ServerItem serverItem = new ServerItem(NameBox.Text, ipAddress.ToString(), (int)ServerPort.Value, (int)RCONPort.Value, PasswordBox.Text, ConnectOnStartupCheck.Checked); var search = DataFileSystem.Data.AllServers.Where(x => x.Name == serverItem.Name); if (search.Any()) { DataFileSystem.Data.AllServers.Remove(search.First()); } DataFileSystem.Data.AllServers.Add(serverItem); DataFileSystem.SaveData(); RefreshServerList(); }
public PDBConnection GetConnection(string serverName) { string tmpName = serverName.ToLower(); if (!connPoolDic_.ContainsKey(tmpName)) { ServerItem serItem = TableSet.GetImpl().GetServerInfo(tmpName); if (serItem == null) { throw new Exception("server not found"); } string connStr = string.Format("server={0};port={1};username={2};password={3}", serItem.IP, serItem.Port, serItem.User, serItem.Pwd); lock (this) { if (!connPoolDic_.ContainsKey(tmpName)) { connPoolDic_.Add(tmpName, new ConnectionPool(connStr, serItem.MaxConn)); } } } return(connPoolDic_[tmpName].GetConnection()); }
/// <summary> /// Updates the count. /// </summary> /// <param name="child">The child.</param> /// <param name="childNames">The child names.</param> private static void UpdateCount(ServerItem child, IDictionary<string, int> childNames) { int nameCount; var childName = child.Name ?? string.Empty; childNames.TryGetValue(childName, out nameCount); childNames[childName] = ++nameCount; }
public ConsumeItemPopupViewModel(ServerItem item, Service service) { Service = service; Item = item; YesCommand = new RelayCommand(args => taskCompletionSource.SetResult(true)); NoCommand = new RelayCommand(args => taskCompletionSource.SetResult(false)); }
public async Task <List <HumidityLog> > GetHumidityAsync(ServerItem server) { var client = new HttpClient { BaseAddress = new Uri("http://" + server.IpAddress + "/"), Timeout = TimeSpan.FromSeconds(ListenTimeout) }; try { var response = await client.GetAsync("PlantHumidity", HttpCompletionOption.ResponseContentRead); if (response.IsSuccessStatusCode) { string jsonResponse = await response.Content.ReadAsStringAsync(); var result = JsonConvert.DeserializeObject <List <HumidityLog> >(jsonResponse); return(result); } else { throw new InvalidOperationException("Could not connect to device"); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); return(new List <HumidityLog>()); } }
private async void ServerListView_ItemTapped(object sender, ItemTappedEventArgs e) { if (viewModel.isBusy) { return; } ServerItem serverSelected = e.Item as ServerItem; if (serverSelected != null) { if (Base.Global.serverSiteConnectingManager.IsServerConnected(serverSelected.Id) == false) { Toast.Show(StringResources.Find("NOT_CONNECT_SERVER")); await Task.Delay(100); var listView = sender as ListView; listView.SelectedItem = null; return; } viewModel.isBusy = true; var serverChannelPage = new NavigationPage(new ServerChannelPage(serverSelected)); await Navigation.PushModalAsync(serverChannelPage); viewModel.isBusy = false; } }
internal Service FilterServicesForItem(List <Service> services, ServerItem item) { var alreadyBought = services.FirstOrDefault(s => AlreadyBoughtItem(s, item)); if (alreadyBought != null) { return(alreadyBought); } var itemInCategory = services.FirstOrDefault(s => ItemInCategory(s, item)); if (itemInCategory != null) { return(itemInCategory); } var unlimitedService = services.FirstOrDefault(HasUnlimitedService); if (unlimitedService != null) { return(unlimitedService); } var limitedPerDay = services.FirstOrDefault(HasLimitedPerDayService); if (limitedPerDay != null) { return(limitedPerDay); } var limited = services.FirstOrDefault(HasLimitedService); if (limited != null) { return(limited); } return(null); }
public async Task <Service> GetServiceForItemAsync(string pluginName, ServerItem item) { if (_core.UserService.User.Id == null) { return(null); } await GetActiveUserServicesAsync(); var pluginServices = GetPluginActiveServices(pluginName); if (pluginServices != null) { pluginServices = pluginServices.OrderBy(s => s.Duration).ThenBy(x => x.RestDuration).ToList(); if (pluginServices.Any(s => s.Duration != -1)) { var limitedServices = pluginServices.Where(s => s.Duration != -1).ToList(); var service = FilterServicesForItem(limitedServices, item); if (service != null) { return(service); } } pluginServices = pluginServices.Where(s => s.Duration == -1).ToList(); var serv = FilterServicesForItem(pluginServices, item); if (serv != null) { return(serv); } } return(null); }
public async Task <bool> ConsumeItemAsync(string pluginName, ServerItem item) { return(await DoWhileBusy(async() => { try { var s = await GetServiceForItemAsync(pluginName, item); if (s == null) { return false; } var response = await _core.HttpClient.GetObjectAsync <object>( "billing/update_user_service/", postData: new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("quantity", "1"), new KeyValuePair <string, string>("serviceID", s.Id), new KeyValuePair <string, string>("itemID", item.Id) } ); return response.Success; } catch { } return false; })); }
public int hasSpace(ServerItem item) { if (ItemWeight.getWeight(item.id) == -1000) { return(1); } if (this.weight + ItemWeight.getWeight(item.id) > this.capacity) { return(2); } if (!ItemStackable.getStackable(item.id)) { if (this.search(-1).x != -1) { return(0); } return(1); } Point2 point2 = this.search(item.id); if (point2.x != -1 && this.items[point2.x, point2.y].amount < Inventory.MAX_STACK) { return(0); } point2 = this.search(-1); if (point2.x != -1) { return(0); } return(1); }
private void AddServers() { foreach (var item in servers) { DServers.Add(item.name, item); GameObject newButton = buttonObjectPool.GetObject(); newButton.transform.SetParent(contentPanel); newButton.transform.localScale = Vector3.one; newButton.transform.localPosition = Vector3.zero; newButton.transform.localRotation = Quaternion.AngleAxis(0f, new Vector3(0f, 15f, 0f)); ServerItem sampleButton = newButton.GetComponent <ServerItem>(); sampleButton.Setup(item, this); if (currentServer.name == "") { currentServer = item; showServer.text = item.name; } var st = sampleButton.transform.Find("Status").gameObject; if (st != null) { st.GetComponent <Image>().color = ConvertHexToColor((uint)item.status); } } }
public void tryAddItem(int id, int amount) { if (ItemWeight.getWeight(id) != -1000) { ServerItem serverItem = new ServerItem(id, ItemAmount.getAmount(id), ItemState.getState(id), Vector3.zero); Vector3 position = base.transform.position; if (base.GetComponent <Player>().vehicle != null) { position = base.GetComponent <Player>().vehicle.getPosition(); } for (int i = 0; i < amount; i++) { if (this.hasSpace(serverItem) != 0) { SpawnItems.dropItem(id, position); } else { this.addItem(serverItem); } } } }
/// <summary> /// Updates the count. /// </summary> /// <param name="child">The child.</param> /// <param name="childNames">The child names.</param> private static void UpdateCount(ServerItem child, IDictionary <string, int> childNames) { int nameCount; var childName = child.Name ?? string.Empty; childNames.TryGetValue(childName, out nameCount); childNames[childName] = ++nameCount; }
private void button_RemoveServer_Click(object sender, EventArgs e) { if (listBox_ServerList.SelectedItems.Count > 0) { ServerItem item = (listBox_ServerList.SelectedItems[0] as ServerItem); provider.ServerList.Remove(item); } }
private void listBox_ServerList_SelectedIndexChanged(object sender, EventArgs e) { if (listBox_ServerList.SelectedItems.Count > 0) { ServerItem item = (listBox_ServerList.SelectedItems[0] as ServerItem); propertyGrid.SelectedObject = item; } }
public void CloneData(ServerItem targetItem) { serverAdress = targetItem.ServerAdress; serverName = targetItem.ServerName; serverID = targetItem.ServerID; isCrowed = targetItem.IsCrowed; this.UpdateServerItem(); }
/// <summary> /// Gets the priority. /// </summary> /// <param name="item">The item.</param> /// <returns> /// The priority if the item has one; <c>null</c> otherwise. /// </returns> public static int?GetPriority(ServerItem item) { int?priority; return(AttachablePropertyServices.TryGetProperty( item, new AttachableMemberIdentifier(typeof(Queue), "Priority"), out priority) ? priority : null); }
private void DrawItemHandler(object sender, DrawItemEventArgs ev) { if (this.plugin == null || ev.Index == -1) { return; } Rectangle bounds = ev.Bounds; // draw background ev.DrawBackground(); // draw border ev.Graphics.DrawRectangle(Pens.Gray, bounds); ServerItem serverItem = (ServerItem)this.Items[ev.Index]; // Find the area in which to put the text and draw. this.layoutRect.X = bounds.Left + 32 + (3 * ItemMargin); this.layoutRect.Y = bounds.Top + (ItemMargin * 2); this.layoutRect.Width = bounds.Right - ItemMargin - this.layoutRect.X; this.layoutRect.Height = bounds.Bottom - ItemMargin - this.layoutRect.Y; // draw server item id and name if ((ev.State & DrawItemState.Selected) == DrawItemState.Selected) { this.pen.Brush = WhiteBrush; ev.Graphics.DrawString(serverItem.ToString(), this.Font, WhiteBrush, this.layoutRect); } else { this.pen.Brush = BlackBrush; ev.Graphics.DrawString(serverItem.ToString(), this.Font, BlackBrush, this.layoutRect); } this.destRect.Y = bounds.Top + ItemMargin; ClientItem clientItem = this.plugin.GetClientItem(serverItem.ClientId); if (clientItem != null) { Bitmap bitmap = clientItem.GetBitmap(); if (bitmap != null) { this.sourceRect.Width = bitmap.Width; this.sourceRect.Height = bitmap.Height; ev.Graphics.DrawImage(bitmap, this.destRect, this.sourceRect, GraphicsUnit.Pixel); } } // draw item border ev.Graphics.DrawRectangle(this.pen, this.destRect); // draw focus rect ev.DrawFocusRectangle(); }
public async Task <bool> AddOrRemoveFavoriteAsync(string pluginName, ServerItem item) { if (_core.UserService.User.Id == null) { if (_core.TryGetUserAccountManager(out IUserAccountManager _userAccount)) { var logged = await _userAccount.RequestLoginAsync(_translator.Translate("You need an account to add favorites")); if (!logged) { return(false); } } } if (cachedFavorites.Any(p => p.Name == pluginName)) { var pluginFavs = cachedFavorites.First(p => p.Name == pluginName); if (pluginFavs.Items.Any(f => f.Id == item.Id)) { if (await FavoriteRemoveAsync(pluginName, item.Id)) { RemoveFromCache(pluginName, item.Id); if (_core.TryGetUiManager(out IUiManager _uiManager)) { _uiManager.Toast(_translator.Translate("This item has been removed from your favorites")); } return(true); } else { if (_core.TryGetUiManager(out IUiManager _ui)) { _ui.Toast(_translator.Translate("Something went wrong when trying to remove from your favorites")); } return(false); } } } if (await FavoriteAddAsync(pluginName, item.Id)) { AddToCache(pluginName, item); if (_core.TryGetUiManager(out IUiManager _ui)) { _ui.Toast(_translator.Translate("This item has been added to your favorites")); } return(true); } else { if (_core.TryGetUiManager(out IUiManager _ui)) { _ui.Toast(_translator.Translate("Something went wrong when trying to add to your favorites")); } return(false); } }
public void ClearServers() { ServerItem[] componentsInChildren = this.serverContainer.GetComponentsInChildren <ServerItem>(); for (int i = 0; i < (int)componentsInChildren.Length; i++) { ServerItem serverItem = componentsInChildren[i]; serverItem.gameObject.GetComponent <dfControl>().Hide(); this.pooledServerItems.Enqueue(serverItem.gameObject); } }
void CreateServer(string name, int count) { GameObject go = Instantiate(Resources.Load <GameObject>("Prefabs/Btn_server_red")); go.transform.SetParent(m_parent, false); ServerItem item = go.GetComponent <ServerItem>(); item.serverPanel = this; item.SetProperty(name, count); }
void Awake() { serverListRequest = GetComponent <ServerListRequest>(); for (int i = 0; i < GridContent.transform.childCount; i++) { ServerItem server = GridContent.transform.GetChild(i).GetComponent <ServerItem>(); server.ServerId = i; } facade.PlayMusic("Menu"); }
private void button_CopyServer_Click(object sender, EventArgs e) { if (listBox_ServerList.SelectedItems.Count > 0) { ServerItem item = (listBox_ServerList.SelectedItems[0] as ServerItem); ServerItem _item = (ServerItem)item.Clone(); provider.ServerList.Add(_item); } }
public void SetData(ServerItem item, int price, int amount) { Item = item; Price = price; Amount = amount; imgIcon.sprite = item.Icon; lblName.text = item.Name; lblPrice.text = price.ToString(); lblAmount.text = amount.ToString(); }
public async Task OpenItemAsync(ServerItem item) { var link = item as Models.Link; if (_core.TryGetUiManager(out IUiManager ui) && await GetWebViewManager()) { var vm = new WebBrowserPageViewModel(_webViewManager, new LinkItemProvider(_core), this, _core); ui.Navigate(vm); vm.NavigateCommand.Execute(link.DataUrl); } }
private void SpawnServerItems(List <ServerProperty> serverList) { foreach (ServerProperty sp in serverList) { GameObject item = Instantiate(m_serverItemPrefab, m_content); ServerItem serverItem = item.GetComponent <ServerItem>(); if (serverItem != null) { serverItem.SetContent(sp.Name, sp.Count.ToString()); } } }
public static bool Send(ServerItem item, string title, string body) { var email = Mail.Html(@"Html with an image: <img src=""cid:lena"" />") .AddVisual(@"c:\lena.jpeg").SetContentId("lena") .AddAttachment(@"c:\tmp.doc").SetFileName("document.doc") .To("*****@*****.**") .From("*****@*****.**") .Subject(title) .Create(); return(Send(item, email)); }
// Creates a Dictionary of DGS Servers, using the server name as the key private static ServerCollection CreateServerItemList() { ServerCollection itemDic = new ServerCollection(); // Get the Server Inventory as a ListItemCollection ListItemCollection list = GetServerListItems(); // Itterate through each item in the list foreach (ListItem lItem in list) { try { ServerItem serv = new ServerItem(lItem["Title"].ToString().ToLower()); // Get each user in the "Support Staff" field var str = (FieldUserValue[])lItem.FieldValues[_supportStaffField]; // Add support staff if it exists if (str != null) { foreach (FieldUserValue user in str) { serv.AddStaff(user.LookupValue); } } // Set the simple text fields serv.BusinessUnit = lItem[_businessUnitField] != null ? (string)lItem[_businessUnitField] : ""; serv.ServerType = lItem[_serverTypeField] != null ? (string)lItem[_serverTypeField] : ""; serv.Environment = lItem[_environmentField] != null ? (string)lItem[_environmentField] : ""; // Set the FieldNote value for Server Description string description = lItem[_serverDescriptionField] != null ? lItem.FieldValuesAsText[_serverDescriptionField] : ""; // Remove non-ASCII characters from the string description = description.Replace("\n", ""); description = Regex.Replace(description, @"[^\u0000-\u007F]", string.Empty); serv.ServerDescription = description; // Add server to the Dictionary if (!itemDic.ContainsKey(serv.ServerName)) { itemDic.Add(serv); } } catch (Exception ex) { Console.WriteLine(ex.Message); } } return(itemDic); }
private void Shuffle(ServerItem[] list) { Random rng = new Random(); int n = list.Length; while (n > 1) { n--; int k = rng.Next(n + 1); ServerItem value = list[k]; list[k] = list[n]; list[n] = value; } }
public void Add(ServerItem item) { if (Items.Contains(item)) { return; } Items.Add(item); if (MaxId < item.ID) { MaxId = item.ID; } }
private void SyncServers() { for (int Iterator = 0; Iterator < Cluster.Servers.Length; Iterator++) { Server Server = Cluster.Servers[Iterator]; ServerItem Item = (ServerItem)ServersList.Children[Iterator]; Item.Status.Foreground = Server.IsLoaded ? Server.IsOnline ? DarkGreen : DarkRed : Yellow; Item.Status.Text = Server.IsLoaded ? Server.IsOnline ? "Online" : "Offline" : LocString(LocCode.Loading); int MaxPlayers = Cluster.Discord is null ? Server.MaxPlayers : Cluster.PlayersLimit; Item.Players.Text = $"{Server.PlayersOnline}/{MaxPlayers}"; Item.RefreshWarning(); Item.JoinButton.IsEnabled = Server.IsLoaded && Server.IsOnline && Item.DLCInstalled; } }
/// <summary> /// Sets the priority on an item. /// </summary> /// <param name="item">The item.</param> /// <param name="priority">The priority.</param> public static void SetPriority(ServerItem item, int? priority) { var memberIdentifier = new AttachableMemberIdentifier(typeof(Queue), "Priority"); if (priority.HasValue) { AttachablePropertyServices.SetProperty( item, memberIdentifier, priority); } else { AttachablePropertyServices.RemoveProperty( item, memberIdentifier); } }
private void ReloadItem(ServerItem item) { if (!Loaded || item == null) { return; } //to avoid problems with events ServerItem tmpItem = currentItem; currentItem = null; ClientItem clientItem; if (currentPlugin.Instance.Items.TryGetValue(item.spriteId, out clientItem)) { Trace.WriteLine(String.Format("Reloading item id: {0}.", item.id)); UInt16 tmpId = item.id; item.itemImpl = (ItemImpl)clientItem.itemImpl.Clone(); item.id = tmpId; Buffer.BlockCopy(clientItem.SpriteHash, 0, item.SpriteHash, 0, clientItem.SpriteHash.Length); currentItem = tmpItem; } }
public bool DuplicateItem(ServerItem item) { if (!this.Loaded || item == null) { return false; } ServerItem copyItem = this.CopyItem(item); copyItem.id = (UInt16)(items.maxId + 1); items.Add(copyItem); itemsListBox.Items.Add(copyItem); SelectItem(copyItem); this.itemsCountLabel.Text = itemsListBox.Items.Count + " Items"; Trace.WriteLine(String.Format("Duplicate item id {0} to new item id {1}", item.id, copyItem.id)); return true; }
public bool SelectItem(ServerItem item) { if (!this.Loaded) { return false; } if (currentItem == item) { return true; } int index; if (item == null || (index = itemsListBox.Items.IndexOf(item)) == -1) { this.ResetControls(); return false; } EditItem(item); editDuplicateItemMenuItem.Enabled = true; editReloadItemMenuItem.Enabled = true; optionsGroupBox.Enabled = true; appearanceGroupBox.Enabled = true; itemsListBox.SelectedIndex = index; return true; }
public void Clear() { this.SelectItem(null); this.currentItem = null; this.currentPlugin = null; this.previousPlugin = null; this.currentOtbVersion = 0; this.currentOtbFullPath = ""; this.items.Clear(); this.itemsListBox.Items.Clear(); this.itemsListBox.Enabled = false; this.fileSaveMenuItem.Enabled = false; this.fileSaveAsMenuItem.Enabled = false; this.editCreateItemMenuItem.Enabled = false; this.editDuplicateItemMenuItem.Enabled = false; this.editReloadItemMenuItem.Enabled = false; this.editFindItemMenuItem.Enabled = false; this.viewShowOnlyMismatchedMenuItem.Enabled = false; this.viewShowDecaptedItemsMenuItem.Enabled = false; this.viewUpdateItemsListMenuItem.Enabled = false; this.toolsUpdateVersionMenuItem.Enabled = false; this.toolsReloadItemAttributesMenuItem.Enabled = false; this.toolStripSaveButton.Enabled = false; this.toolStripSaveAsButton.Enabled = false; this.toolStripFindItemButton.Enabled = false; this.loaded = false; this.textBoxListener.Clear(); }
public void CreateEmptyOTB(string filePath, SupportedClient client, bool isTemp = true) { ServerItem item = new ServerItem(); item.SpriteHash = new byte[16]; item.spriteId = 100; item.id = 100; ServerItemList items = new ServerItemList(); items.dwMajorVersion = 3; items.dwMinorVersion = client.OtbVersion; items.dwBuildNumber = 1; items.clientVersion = client.Version; items.Add(item); if (!File.Exists(filePath)) { using (File.Create(filePath)) { } } if (Otb.Save(filePath, ref items)) { this.Open(filePath); this.isTemp = isTemp; this.saved = !isTemp; } }
private ServerItem CreateItem(Item item = null) { //create a new otb item ServerItem newItem = new ServerItem(item); newItem.id = (UInt16)(items.maxId + 1); newItem.SpriteHash = new byte[16]; if (item != null) { newItem.spriteId = item.id; Buffer.BlockCopy(item.SpriteHash, 0, newItem.SpriteHash, 0, newItem.SpriteHash.Length); } else { newItem.spriteId = items.minId; newItem.isCustomCreated = true; } return newItem; }
private ServerItem CopyItem(ServerItem item) { if (item == null) { return null; } ServerItem copy = new ServerItem(item); copy.SpriteHash = new byte[16]; copy.spriteId = item.spriteId; Buffer.BlockCopy(item.SpriteHash, 0, copy.SpriteHash, 0, copy.SpriteHash.Length); return copy; }
private bool CompareItem(ServerItem item, bool compareHash) { if (item.type == ItemType.Deprecated) { return true; } ClientItem clientItem; if (currentPlugin.Instance.Items.TryGetValue(item.spriteId, out clientItem)) { if (compareHash && !Utils.ByteArrayCompare(item.SpriteHash, clientItem.SpriteHash)) { return false; } return item.IsEqual(clientItem); } return false; }
/// <summary> /// Gets the priority. /// </summary> /// <param name="item">The item.</param> /// <returns> /// The priority if the item has one; <c>null</c> otherwise. /// </returns> public static int? GetPriority(ServerItem item) { int? priority; return AttachablePropertyServices.TryGetProperty( item, new AttachableMemberIdentifier(typeof(Queue), "Priority"), out priority) ? priority : null; }
private bool EditItem(ServerItem item) { currentItem = null; ResetDataBindings(this); ResetToolTips(); if (item == null) { return false; } ClientItem clientItem; if (!currentPlugin.Instance.Items.TryGetValue(item.spriteId, out clientItem)) { return false; } DrawSprite(pictureBox, clientItem); if (!item.isCustomCreated && item.SpriteHash != null && clientItem.SpriteHash != null) { pictureBox.BackColor = ((Utils.ByteArrayCompare(item.SpriteHash, clientItem.SpriteHash) ? Color.White : Color.Red)); } typeCombo.Text = item.type.ToString(); typeCombo.ForeColor = (item.type == clientItem.type ? Color.Black : Color.Red); // serverIdLbl.DataBindings.Add("Text", item, "id"); clientIdUpDown.Minimum = items.minId; clientIdUpDown.Maximum = (currentPlugin.Instance.Items.Count + items.minId) - 1; clientIdUpDown.DataBindings.Add("Value", clientItem, "id"); // Attributes AddBinding(unpassableCheck, "Checked", item, "isUnpassable", item.isUnpassable, clientItem.isUnpassable); AddBinding(blockMissilesCheck, "Checked", item, "blockMissiles", item.blockMissiles, clientItem.blockMissiles); AddBinding(blockPathfinderCheck, "Checked", item, "blockPathfinder", item.blockPathfinder, clientItem.blockPathfinder); AddBinding(moveableCheck, "Checked", item, "isMoveable", item.isMoveable, clientItem.isMoveable); AddBinding(hasElevationCheck, "Checked", item, "hasElevation", item.hasElevation, clientItem.hasElevation); AddBinding(pickupableCheck, "Checked", item, "isPickupable", item.isPickupable, clientItem.isPickupable); AddBinding(hangableCheck, "Checked", item, "isHangable", item.isHangable, clientItem.isHangable); AddBinding(useableCheck, "Checked", item, "multiUse", item.multiUse, clientItem.multiUse); AddBinding(rotatableCheck, "Checked", item, "isRotatable", item.isRotatable, clientItem.isRotatable); AddBinding(stackableCheck, "Checked", item, "isStackable", item.isStackable, clientItem.isStackable); AddBinding(verticalCheck, "Checked", item, "isVertical", item.isVertical, clientItem.isVertical); AddBinding(fullGroundCheck, "Checked", item, "fullGround", item.fullGround, clientItem.fullGround); AddBinding(horizontalCheck, "Checked", item, "isHorizontal", item.isHorizontal, clientItem.isHorizontal); AddBinding(alwaysOnTopCheck, "Checked", item, "alwaysOnTop", item.alwaysOnTop, clientItem.alwaysOnTop); AddBinding(readableCheck, "Checked", item, "isReadable", item.isReadable, clientItem.isReadable); AddBinding(ignoreLookCheck, "Checked", item, "ignoreLook", item.ignoreLook, clientItem.ignoreLook); AddBinding(groundSpeedText, "Text", item, "groundSpeed", item.groundSpeed, clientItem.groundSpeed, true); AddBinding(topOrderText, "Text", item, "alwaysOnTopOrder", item.alwaysOnTopOrder, clientItem.alwaysOnTopOrder, true); AddBinding(lightLevelText, "Text", item, "lightLevel", item.lightLevel, clientItem.lightLevel, true); AddBinding(lightColorText, "Text", item, "lightColor", item.lightColor, clientItem.lightColor, true); AddBinding(maxReadCharsText, "Text", item, "maxReadChars", item.maxReadChars, clientItem.maxReadChars, true); AddBinding(maxReadWriteCharsText, "Text", item, "maxReadWriteChars", item.maxReadWriteChars, clientItem.maxReadWriteChars, true); AddBinding(minimapColorText, "Text", item, "minimapColor", item.minimapColor, clientItem.minimapColor, true); AddBinding(wareIdText, "Text", item, "tradeAs", item.tradeAs, clientItem.tradeAs, true); AddBinding(nameText, "Text", item, "name", item.name, clientItem.name, true); candidatesButton.Enabled = false; for (int i = 0; i < candidatesTableLayoutPanel.ColumnCount; ++i) { PictureBox box = (PictureBox)candidatesTableLayoutPanel.GetControlFromPosition(i, 0); box.Image = null; } if (previousPlugin != null) { ClientItem prevClientItem; if (previousPlugin.Instance.Items.TryGetValue(item.prevSpriteId, out prevClientItem)) { DrawSprite(previousPictureBox, prevClientItem); if (prevClientItem.SpriteSignature != null) { //Sprite does not match, use the sprite signature to find possible candidates ShowSpriteCandidates(prevClientItem); } } else { previousPictureBox.Image = null; } } currentItem = item; return true; }
public void Refresh() { Data.Clear(); for (int i = 0; i < PageSize; i++) { //Data.Add(new ServerItem(){ No = CurrentIndex + i} ); cache.Get((CurrentIndex + i).ToString(),si => { Data.Add(si); },sia => { var si = new ServerItem() { ID=Guid.NewGuid() , No=i+CurrentIndex }; sia(si); },false); } }
private void ResetControls() { currentItem = null; editDuplicateItemMenuItem.Enabled = false; optionsGroupBox.Enabled = false; appearanceGroupBox.Enabled = false; pictureBox.Image = null; pictureBox.BackColor = Color.White; previousPictureBox.Image = null; previousPictureBox.BackColor = Color.White; clientIdUpDown.Value = clientIdUpDown.Minimum; serverIdLbl.Text = "0"; typeCombo.Text = ""; typeCombo.ForeColor = Color.Black; editDuplicateItemMenuItem.Enabled = false; candidatesButton.Enabled = false; foreach (Control control in optionsGroupBox.Controls) { if (control is CheckBox) { ((CheckBox)control).Checked = false; control.ForeColor = Color.Black; } else if (control is TextBox) { ((TextBox)control).Text = ""; control.ForeColor = Color.Black; } } }