UI Freeze in SWT - swt

I am new to SWT. I am trying to create a small application. Basically it has two screens. In the first screen I have to take user credentials. It has to be validated. If its successful I have to query a table and build a tree structure. Both validation and building the tree freezes my UI. I searched stackoverflow and google. I got the below options.
Display.getDefault().asyncExec() and starting long running process as separate thread from UI thread.
But still my UI freezes.
When the user clicks on Logon button. I created a thread. As a first step I tried to show a indefinite progress bar using asyncExec. Since I have to access the Uname and Password I have to trigger another asyncexec and perform the login. If its successful populated the tree.
I triggered another asyncExec to close the progress bar.
My UI freezes from Logon click till Tree population completion. Where am I going wrong.
new Thread(new Runnable()
{
private int progress = 0;
private static final int INCREMENT = 10;
#Override
public void run()
{
while (!progressBar.isDisposed())
{
Display.getDefault().asyncExec(new Runnable()
{
#Override
public void run()
{
if (!progressBar.isDisposed())
progressBar.setVisible(true);
}
});
Display.getDefault().asyncExec(new Runnable()
{
#Override
public void run()
{
String sAuth = null;
switch(tAuth.getText()){
case "Enterprise": sAuth = "secEnterprise"; break;
case "LDAP": sAuth = "secLDAP"; break;
case "Windows AD": sAuth = "secWinAD"; break;
case "SAP": sAuth = "secSAPR3"; break;
}
try {
log.info("Attempting to create enterprise session");
CoreLogic.logonEnterprise(tUSR.getText().trim(),tPWD.getText().trim(),sAuth,tCMS.getText());
if(CommonVariables.entsession){
log.info("Enterprise session created.");
CoreLogic.getUniverse();
log.info("Populating universe tree");
String[] temp;
for (Entry<Integer, UnvObj> entry : CommonVariables.unvlst.entrySet()) {
UnvObj t = entry.getValue();
temp = t.getPath().split("/");
if (temp[0].equals("Universes")){
int max = temp.length;
int i =0 ;
boolean flag = false;
TreeItem trItem = null;
do{
if(i == 0) {
if(tree.getItemCount() == 0){
flag = false;
}
else
{
for(int k = 0; k < tree.getItemCount(); k++){
if(temp[i].equals(tree.getItem(k).getText())){
i++;
trItem = tree.getItem(k);
flag =true;
break;
}
else
{
flag = false;
}
}
}
}
else{
if(trItem.getItemCount() == 0){
flag = false;
}
else
{
for(int k = 0; k < trItem.getItemCount(); k++){
if(temp[i].equals(trItem.getItem(k).getText())){
i++;
trItem = trItem.getItem(k);
flag =true;
break;
}
else
{
flag = false;
}
}
}
}
}while (flag == true && i < max);
TreeItem Item = null;
if (i == 0){
for (int k = 0; k < max; k++){
if(k == 0) {
Item = new TreeItem(tree,SWT.NONE);
Item.setText(temp[k]);
Item.setData("Type","Folder");
Image image = new Image(display,ResourceLoader.load("/images/Fld.png"));
Item.setImage(image);
}else
{
Item = new TreeItem(Item,SWT.NONE);
Item.setText(temp[k]);
Item.setData("Type","Folder");
Image image = new Image(display,ResourceLoader.load("/images/Fld.png"));
Item.setImage(image);
}
}
} else if( i < max){
for (int k = i; k < max; k++){
trItem = new TreeItem(trItem,SWT.NONE);
trItem.setText(temp[k]);
trItem.setData("Type","Folder");
Image image = new Image(display,ResourceLoader.load("/images/Fld.png"));
trItem.setImage(image);
}
}
if (i == 0){
Item = new TreeItem(Item,SWT.NONE);
Item.setText(t.getName());
Item.setData("Type",t.getKind());
Item.setData("Mapkey",entry.getKey());
if(t.getKind().equals("Universe")){
Image image = new Image(display,ResourceLoader.load("/images/Unv.ico"));
Item.setImage(image);
}
else{
Image image = new Image(display,ResourceLoader.load("/images/Unx.ico"));
Item.setImage(image);
}
} else
{
trItem = new TreeItem(trItem,SWT.NONE);
trItem.setText(t.getName());
trItem.setData("Type",t.getKind());
trItem.setData("Mapkey",entry.getKey());
if(t.getKind().equals("Universe")){
Image image = new Image(display,ResourceLoader.load("/images/Unv.ico"));
trItem.setImage(image);
}
else{
Image image = new Image(display,ResourceLoader.load("/images/Unx.ico"));
trItem.setImage(image);
}
}
}
}
log.info("Universe Tree Populated.");
sl.topControl =Universe;
Main.layout();
}else
{
log.info("Unable to create enterprise session");
MessageBox messageBox = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK);
messageBox.setText("Report Extractor");
messageBox.setMessage("Unable to create the enterprise session with the provided credentials. Please verify it.");
messageBox.open();
}
}
catch(Exception exp)
{
log.error("Fail to create enterprise session",exp);
}
}
});
Display.getDefault().asyncExec(new Runnable()
{
#Override
public void run()
{
if (!progressBar.isDisposed())
progressBar.setVisible(false);
}
});
}
}
}).start();

Related

IndexOutOfRangeException: Can't figure out why index out of bound

So, I have a list of Upgrade systems for my game but it has a bug on it when I press upgrade for a second time the index out of range then pressed for the third times the index out of range gone. this whole script.
void Start()
{
newSelectedIndex = previousSelectedIndex = PlayerPrefs.GetInt("currentPlayer");
btn = Select_Player[newSelectedIndex].GetComponent<Button>();
btn.interactable = false;
Coins = M_CoinManager.instance.Coins;
for (int i = 0; i < Select_Player.Length; i++)
{
priceText[i].text = Cost_Player[i].ToString();
value_player[i] = "" + i;
Select_Player[i].SetActive(false);
buyPlayer[i] = PlayerPrefs.GetInt(value_player[i]);
}
//if(PlayerPrefs.HasKey("currentPlayer")){
selectedVehicleIndex = PlayerPrefs.GetInt("currentPlayer");
theVehicles[selectedVehicleIndex].SetActive(true);
VehicleInfo();
UpgradeButtonStatus();
}
// Update is called once per frame
void Update()
{
for (int i = 0; i < Select_Player.Length; i++)
{
buyPlayer[i] = PlayerPrefs.GetInt(value_player[i]);
if (i == buyPlayer[i])
{
Select_Player[i].SetActive(true);
upgradeBtn[i].interactable = true;
UpgradeButtonStatus();
}
else
{
upgradeBtn[i].interactable = false;
}
}
}
public void BuyCharact(int id)
{
M_SoundManager.instance.playUIsfx();
if (Cost_Player[id] <= Coins)
{
M_CoinManager.instance.AddCoins(-Cost_Player[id]);
PlayerPrefs.SetInt(value_player[id], id);
}
else
{
_CoinShake.DoShake();
Debug.Log("Does have enough coin");
}
}
public void Reset()
{
for (int i = 0; i < Select_Player.Length; i++)
{
PlayerPrefs.SetInt(value_player[i], 0);
}
}
public void Select(int id)
{
previousSelectedIndex = newSelectedIndex;
newSelectedIndex = id;
newSelectedIndex = selectedVehicleIndex;
PlayerPrefs.SetInt("currentPlayer", newSelectedIndex);
Button newbtn = Select_Player[previousSelectedIndex].GetComponent<Button>();
btn = Select_Player[newSelectedIndex].GetComponent<Button>();
btn.interactable = false;
newbtn.interactable = true;
M_SoundManager.instance.playUIsfx();
Debug.Log("Selected TypeCar" + newSelectedIndex);
}
public void nextVehicle()
{
M_SoundManager.instance.playUIsfx();
theVehicles[selectedVehicleIndex].SetActive(false);
selectedVehicleIndex = (selectedVehicleIndex + 1) % theVehicles.Length;
theVehicles[selectedVehicleIndex].SetActive(true);
VehicleInfo();
UpgradeButtonStatus();
}
public void PreviousVehicle()
{
M_SoundManager.instance.playUIsfx();
theVehicles[selectedVehicleIndex].SetActive(false);
selectedVehicleIndex--;
if (selectedVehicleIndex < 0)
{
selectedVehicleIndex += theVehicles.Length;
}
theVehicles[selectedVehicleIndex].SetActive(true);
VehicleInfo();
UpgradeButtonStatus();
}
public void VehicleInfo()
{
currLevel = _VehicleStats[0].carItem[selectedVehicleIndex].unlockedLevel;
levelText[selectedVehicleIndex].text = "Level: " + (currLevel + 1);
powerText[selectedVehicleIndex].text = "Power: " + _VehicleStats[0].carItem[selectedVehicleIndex].vehicleLevel[currLevel].motorPower;
brakeText[selectedVehicleIndex].text = "Brake: " + _VehicleStats[0].carItem[selectedVehicleIndex].vehicleLevel[currLevel].brakePower;
Debug.Log(selectedVehicleIndex);
}
public void upgradeMethod()
{
nextLevelIndex = _VehicleStats[0].carItem[selectedVehicleIndex].unlockedLevel + 1;
if (Coins >= _VehicleStats[0].carItem[selectedVehicleIndex].vehicleLevel[nextLevelIndex].unlockCost)
{
Coins -= _VehicleStats[0].carItem[selectedVehicleIndex].vehicleLevel[nextLevelIndex].unlockCost;
_VehicleStats[0].carItem[selectedVehicleIndex].unlockedLevel++;
if (_VehicleStats[0].carItem[selectedVehicleIndex].unlockedLevel < _VehicleStats[0].carItem[selectedVehicleIndex].vehicleLevel.Length - 1)
{
upgradeBtnText[selectedVehicleIndex].text = "Upgrade Cost :" + _VehicleStats[0].carItem[selectedVehicleIndex].vehicleLevel[nextLevelIndex + 1].unlockCost;
}
else
{
upgradeBtn[selectedVehicleIndex].interactable = false;
upgradeBtnText[selectedVehicleIndex].text = "Max Level";
}
VehicleInfo();
}
}
private void UpgradeButtonStatus()
{
if (_VehicleStats[0].carItem[selectedVehicleIndex].unlockedLevel < _VehicleStats[0].carItem[selectedVehicleIndex].vehicleLevel.Length - 1)
{
upgradeBtn[selectedVehicleIndex].interactable = true;
nextLevelIndex = _VehicleStats[0].carItem[selectedVehicleIndex].unlockedLevel + 1;
upgradeBtnText[selectedVehicleIndex].text = "Upgrade Cost :" + _VehicleStats[0].carItem[selectedVehicleIndex].vehicleLevel[nextLevelIndex + 1].unlockCost;
}
else
{
upgradeBtn[selectedVehicleIndex].interactable = false;
upgradeBtnText[selectedVehicleIndex].text = "Max Level";
}
}
and the error reference to this method :
private void UpgradeButtonStatus()
{
if (_VehicleStats[0].carItem[selectedVehicleIndex].unlockedLevel < _VehicleStats[0].carItem[selectedVehicleIndex].vehicleLevel.Length - 1)
{
upgradeBtn[selectedVehicleIndex].interactable = true;
nextLevelIndex = _VehicleStats[0].carItem[selectedVehicleIndex].unlockedLevel + 1;
upgradeBtnText[selectedVehicleIndex].text = "Upgrade Cost :" + _VehicleStats[0].carItem[selectedVehicleIndex].vehicleLevel[nextLevelIndex + 1].unlockCost;
}
else
{
upgradeBtn[selectedVehicleIndex].interactable = false;
upgradeBtnText[selectedVehicleIndex].text = "Max Level";
}
}
as you can see on the update that's what I mean. after i press upgrade for third times the error stopped.
and this for the inpector
Arrays length is one higher than their highest index, but last iteration of "for" loops goes to array.length.
You need to make "for" loops to array.length-1.
I see you do "for" loops of up to array.length.
I haven't truly read thru your whole script so there might be more, but it's a typical error in my "for" loops so I think that is causing your error.

Item in ScrollView is not seen in Scene, but it shows in hierarchy

I am trying to display a list, generated dinamically. I created a prefab with the things I need in it (a TextView, 3 TMP_InputFields and 2 Buttons.)
To manage the different list items, I created a script (SkillManager, since the items represents skill the player can choose), which I attached to the prefab.
Then, I add every item (currently I am adding only one for testing purposes) to a List, iterate that list, and add the prefab to the Content of a ScrollView:
for(int i = 0; i < listaSkills.Count; i++)
{
GameObject listItem = Instantiate(SkillPrefab) as GameObject;
listItem.GetComponent<SkillManager>().skill = listaSkills[i];
//listItem.transform.SetParent(SkillsContent.transform, false);
listItem.transform.parent = SkillsContent.transform;
}
When I run this, no item is seen in the ScrollView, but I can see the SkillItem added to the hierarchy:
If I move to Scene tab after playing, I see a square with red lines crossing it:
Why is my item not displaying? Why the red cross? How can I populate my ScrollView?
EDIT:
This is the code of SkillManager, the script added to SkillPrefab:
public class SkillManager : MonoBehaviour
{
public TMP_InputField toSpend;
public TMP_InputField rangos;
public TMP_InputField modificadores;
public TMP_InputField total;
public Button plusButton;
public Button minusButton;
public TMP_Text nombre;
public Skill skill;
private int modificador;
private int pointsToSpend;
private int totalPoints;
// Start is called before the first frame update
void Start()
{
print("Start");
if(total!=null)
total.text = "0";
if(modificadores!=null)
modificadores.text = "0";
if (toSpend != null)
{
toSpend.GetComponent<TMP_InputField>().text = GetSkillPoints();
totalPoints = int.Parse(total.GetComponent<TMP_InputField>().text);
pointsToSpend = int.Parse(toSpend.GetComponent<TMP_InputField>().text);
}
else
{
GameObject GameObjectToSpend = GameObject.FindGameObjectWithTag("tospend");
toSpend = GameObjectToSpend.GetComponent<TMP_InputField>();
if (toSpend == null)
{
print("Sigue siendo nulo");
}
else
{
toSpend.text= GetSkillPoints();
//totalPoints = int.Parse(total.GetComponent<TMP_InputField>().text);
if(total!=null)
totalPoints = int.Parse(total.text);
if(toSpend!=null)
pointsToSpend = int.Parse(toSpend.text);
}
}
if (skill != null)
{
modificador = GetModificador(skill);
string sModificador = modificadores.GetComponent<TMP_InputField>().text;
int iModificador = int.Parse(sModificador);
modificadores.GetComponent<TMP_InputField>().text = iModificador.ToString();
}
if (plusButton != null)
{
plusButton.onClick.AddListener(PlusButtonClicked);
minusButton.onClick.AddListener(MinusButtonClicked);
}
}
private string GetSkillPoints()
{
return "1";
}
public void MinusButtonClicked()
{
string ranks = rangos.GetComponent<TMP_InputField>().text;
int ranksInt = int.Parse(ranks);
if (ranksInt > 0)
{
int newRank = ranksInt - 1;
pointsToSpend += 1;
rangos.GetComponent<TMP_InputField>().text = newRank.ToString();
toSpend.GetComponent<TMP_InputField>().text = pointsToSpend.ToString();
total.GetComponent<TMP_InputField>().text = (newRank + modificador).ToString();
skill.Puntos = newRank;
}
}
public void PlusButtonClicked()
{
string ranks=rangos.GetComponent<TMP_InputField>().text;
int ranksInt = int.Parse(ranks);
Character character = Almacen.instance.Character;
int level = character.CharacterLevel;
if (ranksInt < level && pointsToSpend > 0)
{
int newRank = ranksInt + 1;
rangos.GetComponent<TMP_InputField>().text = newRank.ToString();
pointsToSpend -= 1;
toSpend.GetComponent<TMP_InputField>().text = pointsToSpend.ToString();
total.GetComponent<TMP_InputField>().text = (newRank + modificador).ToString();
skill.Puntos = newRank;
}
}
private int GetModificador(Skill skill)
{
int retorno=0;
if (skill.Clasea)
{
retorno += 3;
}
else
{
retorno += 0;
}
retorno += GetModificadorCaracteristica();
return retorno;
}
private int GetModificadorCaracteristica()
{
Utils utils = new Utils();
int retorno = 0;
int characteristic=0;
switch (skill.Caracteristica)
{
case "Fue":
characteristic = Almacen.instance.Character.EffectiveStr;
break;
case "Des":
characteristic = Almacen.instance.Character.EffectiveDex;
break;
case "Con":
characteristic = Almacen.instance.Character.EffectiveCon;
break;
case "Int":
characteristic = Almacen.instance.Character.EffectiveInt;
break;
case "Sab":
characteristic = Almacen.instance.Character.EffectiveWis;
break;
case "Car":
characteristic = Almacen.instance.Character.EffectiveCha;
break;
}
retorno = utils.GetCharModifier(characteristic);
return retorno;
}
}
it looks like you instantiate the object as a GameObject. but this will not be seen in the canvas because it isn't a UI component. you may want to add a sprite or image to the component and instantiate that into the Canvas. it will look something like this:
public class SkillPrefab
{
//put all your variables here!!!
public Sprite skillSprite;
}
public class YourClassName : MonoBehaviour
{
[SerializeField]
public List<SkillPrefab> skills = new List<SkillPrefab>();
private void Update()
{
Sprite listItem = Instantiate(skills[0].skillSprite); //the index is the skill you want to spawn in the list.
}
}
this does take into account that you have made your skills into a list of skills that you can acces.

Unity TCP server freezing

I'm trying to get tcp server working in unity, and it's kinda working. My systems purpose is to read data from another program that sends me bytes and draws me a picture of that data. Main problem is that when I run it, it works for a while (random time) and then whole unity freezes and I need to kill it from the task manager.
void Start()
{
Display1 = gameObject.GetComponent<Renderer>();
mymat = GetComponent<Renderer>().material;
packetReady = false;
tcpListenerThread = new Thread(new ThreadStart(ListenForIncommingRequests));
tcpListenerThread.IsBackground = true;
tcpListenerThread.Start();
bytes = new byte[1024];
tex = new Texture2D(800, 1280, TextureFormat.RGB24, false);
firstTime = true;
ArrayInit(3072060);
packetLength = 3072060;
myThread = new Thread(Draw);
myThread.Start();
}
void Draw()
{
if (Loader == null)
{
return;
}
else if (packetReady)
{
tex.LoadRawTextureData(Loader);
tex.Apply();
mymat.SetTexture("_EmissionMap", tex);
Display1.material.mainTexture = tex;
packetReady = false;
}
}
void Update()
{
Draw();
}
private void ListenForIncommingRequests()
{
try
{
tcpListener = new TcpListener(IPAddress.Parse("127.0.0.1"), 35800);
tcpListener.Start();
while (true)
{
if (!tcpListener.Pending())
{
Thread.Sleep(100);
}
Thread.Sleep(10);
using (connectedTcpClient = tcpListener.AcceptTcpClient())
{
using (NetworkStream stream = connectedTcpClient.GetStream())
{
int length;
while ((length = stream.Read(bytes, 0, bytes.Length)) != 0)
{
if (bytes == null)
{
return;
}
else
{
ParseData(bytes);
}
}
}
}
}
}
catch (SocketException socketException)
{
Debug.Log("SocketException " + socketException.ToString());
}
finally
{
tcpListener.Stop();
}
}
I have no idea what is causing this, I've tried to solve the problem but nothing seems to work. Any suggestions?

to upload two(photo and signature) image only in database from one page using c#

There is a page where I've to upload and view photo and signature (the snapshot of the page is attached )but whenever i click the view button the path to the image gets clear and the binary format of the image is saved something like 0x(only this much is saved in database nothing else) format in the database .And the 2nd thing is that both photo and signature are to be seen individually without saving in database.please suggest me a solution for this please.
code
protected void pichck()
{
string picextension = System.IO.Path.GetExtension(imgflup.PostedFile.FileName.ToString()).ToLower();
fs = imgflup.PostedFile.InputStream;
BinaryReader br = new BinaryReader(fs);
picbyte = br.ReadBytes((Int32)fs.Length);
byte[] picarray=new byte[]{255,216,255};
//Boolean match = true;
//int i;
//for (i = 0; i <= picarray.Length - 1;i=i+1 )
//{
// if(picarray[i]!=picbyte[i])
// {
// match = false;
// break;
// }
//}
//if (match == true)
//{
if (picextension == ".jpg" || picextension == ".jpeg")
{
if (imgflup.HasFile == true)
{
if (imgflup.PostedFile.ContentLength < 20000 & imgflup.PostedFile.ContentLength > 50000)
{
Response.Write("<script>alert('the file should be of size 20 mb to 50mb ')</script>");
check();
return;
}
else
{
string base64String = Convert.ToBase64String(picbyte, 0, picbyte.Length);
picimg.ImageUrl = "data:image/png;base64," + base64String;
Label1.Visible = true;
Label1.Visible = true;
Label1.Text = imgflup.PostedFile.FileName;
}
}
//}
else
{
Response.Write("<script>alert('the file should be of jpg or jpeg format')</script>");
check();
return;
}
}
else
{
Response.Write("<script>alert('Please Upload a file')</script>");
check();
return;
}
}
protected void signchckt()
{
string signextension = System.IO.Path.GetExtension(signflup.PostedFile.FileName.ToString()).ToLower();
fs1 = signflup.PostedFile.InputStream;
BinaryReader br1 = new BinaryReader(fs1);
signbyte = br1.ReadBytes((Int32)fs1.Length);
//Boolean match = true;
//int i;
//byte[] signarray=new byte[]{255,216,255};
//for (i = 0; i <= signarray.Length - 1;i=i+1 )
//{
// if(signarray[i]!=signbyte[i])
// {
// match = false;
// break;
// }
//}
//if (match == true)
//{
if (signflup.HasFile == true)
{
if (signextension == ".jpg" || signextension == ".jpeg")
{
if (signflup.PostedFile.ContentLength < 20000 & signflup.PostedFile.ContentLength > 50000)
{
Response.Write("<script>alert('the file should be of size 20 mb to 50mb ')</script>");
check1();
return;
}
else
{
string base64String = Convert.ToBase64String(signbyte, 0, signbyte.Length);
signimg.ImageUrl = "data:image/png;base64," + base64String;
Label2.Visible = true;
Label2.Visible = true;
Label2.Text =signflup.PostedFile.FileName;
}
}
else
{
Response.Write("<script>alert('The signature should be of jpg or jpeg type')</script>");
check1();
return;
}
}
//}
else
{
Response.Write("<script>alert('Please Upload a file')</script>");
check1();
return;
}
}
protected void imgviewbtn_Click(object sender, EventArgs e)
{
pichck();
}
protected void signviewbtn_Click(object sender, EventArgs e)
{
signchckt();
}
protected void updtbtn_Click(object sender, EventArgs e)
{
Int64 aplicationid = Convert.ToInt64(Session["ID"].ToString());
if (Session["ID"].ToString()=="")
{
Response.Write("<script>alert('There is no Application Id')</script>");
Response.Redirect("~/home.aspx");
}
else
{
using (obj.con)
{
pichck();
signchckt();
obj.con.Open();
obj.cmd = new SqlCommand("spPhotoandsignature",obj.con);
obj.cmd.CommandType = System.Data.CommandType.StoredProcedure;
obj.cmd.Parameters.AddWithValue("#Application_Id", aplicationid);
obj.cmd.Parameters.AddWithValue("#Pic_Scan",SqlDbType.Binary).Value =picbyte;
obj.cmd.Parameters.AddWithValue("#Pic_Size", fs);
obj.cmd.Parameters.AddWithValue("#Sign_Scan",SqlDbType.Binary).Value =signbyte;
obj.cmd.Parameters.AddWithValue("#Sign_Size", fs1);
obj.cmd.Parameters.AddWithValue("#Type", System.IO.Path.GetExtension(imgflup.PostedFile.FileName.ToString()).ToLower());
int a= obj.cmd.ExecuteNonQuery();
if (a == 1)
{
Response.Write("<script>alert('your data Submitted successfully')</script>");
Response.Redirect("~/Report.aspx");
}
}
}
}
problempage.png

Using a external Spinner control in Windows Mobile 6.0

I am using slideUI controls in my project . There is a spinner control which is used as wait cursor. I want to display the spinner when I load data in a List.
But when I try to display the spinner it visualize as an image not a rotating image.
Below is my code.
private void uiButton_Click(object sender, EventArgs e)
{
ShowFrame(this.uiPanel1);
Application.DoEvents();
LoadList();
HideFrame(uiPanel1);
}
private void LoadList()
{
try
{
//Call the BeginAddControls before starting manipulations with UIList
uiList1.BeginAddControls();
for (int i = 0; i < 100; i++)
{
UIListItem item = new UIListItem();
item.Text = "Primary Text" + i;
item.SecondaryText = "This is secondary text..";
item.ItemStyle = UIListItemStyle.SingleText;
item.Height = Utils.CalcScaleSize(38);
item.BackColor = System.Drawing.SystemColors.Window;
item.BackEndColorSelected = System.Drawing.SystemColors.Highlight;
item.BackStartColorSelected = System.Drawing.SystemColors.Highlight;
item.BottomBorderColor = System.Drawing.Color.Gainsboro;
item.Buffering = true;
item.ColorScheme = SlideUI.UIColorSchemesCustom.Orange;
item.Dock = System.Windows.Forms.DockStyle.Top;
item.GroupArrowColor = System.Drawing.Color.Gray;
item.GroupArrowColorSelected = System.Drawing.Color.White;
item.IconQVGA = null;
item.IconSize = new System.Drawing.Size(25, 31);
item.IconTransparent = false;
item.IconTransparentColor = System.Drawing.Color.Transparent;
item.IconVGA = null;
item.IconVisible = true;
item.InheritParentSettings = true;
item.IsGroup = false;
item.IsSelected = false;
item.SecondaryTextColor = System.Drawing.SystemColors.GrayText;
item.SecondaryTextColorSelected = System.Drawing.SystemColors.HighlightText;
item.SecondaryTextFont = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Regular);
item.TextColor = System.Drawing.SystemColors.WindowText;
item.TextColorSelected = System.Drawing.SystemColors.HighlightText;
item.TextFont = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Bold);
item.UseGradient = true;
item.VirtualBufferRendered = false;
uiList1.AddControl(item);
}
//Call of EndAddControls method when the UIListItems binding is done
uiList1.EndAddControls();
//HideFrame(uiPanel1);
//ShowFrame(this.panel1, "Panel1");
}
catch (Exception ex)
{
UIMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK,
UIMessageIcons.Done, UIColorSchemesCustom.Orange);
}
}
private void ShowFrame(Panel panel)
{
Panel pnlPanel = new Panel();
pnlPanel = panel;
//pnlPanel.Location = new System.Drawing.Point(0, 0);
pnlPanel.Show();
pnlPanel.BringToFront();
}
private void HideFrame(Panel panel)
{
Panel pnlPanel = new Panel();
pnlPanel = panel;
pnlPanel.Hide();
}
Thanks in advance