I am setting a CustomRoomProperties when a new game is started. Here:
public void startGame()
{
RoomOptions options = new RoomOptions();
options.CleanupCacheOnLeave = true;
options.MaxPlayers = 8;
options.IsOpen = true;
options.IsVisible = true;
Hashtable RoomCustomProps = new Hashtable();
RoomCustomProps.Add("availablePods", gameLenghtsIs);
options.CustomRoomProperties = RoomCustomProps;
PhotonNetwork.JoinOrCreateRoom(createInput.text, options, TypedLobby.Default);
}
And this is the RoomInfo displayed in the Lobby once a game is created:
public void SetRoomInfo(RoomInfo roomInfo)
{
RoomInfo = roomInfo;
maxPlayetTxt.text = roomInfo.MaxPlayers + ",";
nameRoomText.text = roomInfo.Name + ",";
payerNumberText.text = roomInfo.PlayerCount+ "/8";
}
To this RoomInfo i would want to add the created Custom Property but not really sure how. I tried:
podsTxt.text = roomInfo.CustomProperties["availablePods"] + ",";
This resulted in nothingness.
And i tried this:
podsTxt.text = roomInfo.CustomProperties["availablePods"].GetHashCode() + ",";
Resulted in a error.
Tried a few other things but can't get it to work.
P.S. I am using the Hashtable and the hastable does what it's sopposto to do. I would just want this value that i set at startGame()
"availablePods"
to bi displayed when getting the room list in the lobby.
Anyone can help?
If this help anybody, this is what wroked for me:
public void startGame()
{
RoomOptions options = new RoomOptions();
options.CleanupCacheOnLeave = true;
options.MaxPlayers = 8;
options.IsOpen = true;
options.IsVisible = true;
Hashtable RoomCustomProps = new Hashtable();
RoomCustomProps.Add("availablePods", gameLenghtsIs);
options.CustomRoomProperties = RoomCustomProps;
options.CustomRoomProperties.Add("availablePods", allPods);
options.CustomRoomPropertiesForLobby = new string[1] { "availablePods" };
PhotonNetwork.JoinOrCreateRoom(createInput.text, options, TypedLobby.Default);
}
Room Info:
public void SetRoomInfo(RoomInfo roomInfo)
{
RoomInfo = roomInfo;
maxPlayetTxt.text = roomInfo.MaxPlayers + ",";
nameRoomText.text = roomInfo.Name + ",";
payerNumberText.text = roomInfo.PlayerCount+ "/8";
podsTxt.text = roomInfo.CustomProperties["availablePods"].ToString();
}
Thanks to hijinxbassist, i got this working.
Related
I made a language switch (English, Polski) and I wanted to if tabpage contains word "New " then change it to "Nowy " and vice-versa, but I have one problem. This tabPage is made programmatically and I don't know, how to change it's header's text. I made this:
private void englishToolStripMenuItem_Click(object sender, EventArgs e)
{
Class1.LangNumber = 2;
Class1.ChangeLanguage(2);
polskiToolStripMenuItem.Checked = false;
englishToolStripMenuItem.Checked = true;
fileToolStripMenuItem.Text = Class1.file;
openToolStripMenuItem.Text = Class1.open;
saveToolStripMenuItem.Text = Class1.save;
saveAsToolStripMenuItem.Text = Class1.saveas;
edjtToolStripMenuItem.Text = Class1.edit;
cutToolStripMenuItem.Text = Class1.cut;
copyToolStripMenuItem.Text = Class1.copy;
pasteToolStripMenuItem.Text = Class1.paste;
selectAllToolStripMenuItem.Text = Class1.selectall;
deselectAllToolStripMenuItem.Text = Class1.deselectall;
dateAndTimeToolStripMenuItem.Text = Class1.dateandtime;
nicknameToolStripMenuItem.Text = Class1.nickname;
autoWordSelectionToolStripMenuItem.Text = Class1.awsel;
tabManagementToolStripMenuItem.Text = Class1.tabmgmt;
newTabToolStripMenuItem.Text = Class1.ntab;
deleteSelectedTabToolStripMenuItem.Text = Class1.dtab;
infoToolStripMenuItem.Text = Class1.iands;
electryNotepadInfoToolStripMenuItem.Text = Class1.info;
setNicknameToolStripMenuItem.Text = Class1.setnickname;
languagesToolStripMenuItem.Text = Class1.lang;
nicknamerror = Class1.nicknameloaderror;
savedialog = Class1.saved;
savedialogcap = Class1.savecap;
nicknameerrorcap = Class1.nlecap;
ncreate = Class1.ncreation;
ncreatecap = Class1.ncreationcap;
setnicknamedialog = Class1.setnicknamedialog;
newtab = Class1.nev;
for (int i = 0; i <= tabControl1.TabCount - 1; i++)
{
TabPage t = tabControl1.TabPages[i];
if (t.Text.Contains("Nowy"))
{
t.Text.Replace("Nowy", "New");
}
Application.DoEvents();
}
}
private void polskiToolStripMenuItem_Click(object sender, EventArgs
e)
{
Class1.LangNumber = 1;
Class1.ChangeLanguage(1);
polskiToolStripMenuItem.Checked = true;
englishToolStripMenuItem.Checked = false;
fileToolStripMenuItem.Text = Class1.file;
openToolStripMenuItem.Text = Class1.open;
saveToolStripMenuItem.Text = Class1.save;
saveAsToolStripMenuItem.Text = Class1.saveas;
edjtToolStripMenuItem.Text = Class1.edit;
cutToolStripMenuItem.Text = Class1.cut;
copyToolStripMenuItem.Text = Class1.copy;
pasteToolStripMenuItem.Text = Class1.paste;
selectAllToolStripMenuItem.Text = Class1.selectall;
deselectAllToolStripMenuItem.Text = Class1.deselectall;
dateAndTimeToolStripMenuItem.Text = Class1.dateandtime;
nicknameToolStripMenuItem.Text = Class1.nickname;
autoWordSelectionToolStripMenuItem.Text = Class1.awsel;
tabManagementToolStripMenuItem.Text = Class1.tabmgmt;
newTabToolStripMenuItem.Text = Class1.ntab;
deleteSelectedTabToolStripMenuItem.Text = Class1.dtab;
infoToolStripMenuItem.Text = Class1.iands;
electryNotepadInfoToolStripMenuItem.Text = Class1.info;
setNicknameToolStripMenuItem.Text = Class1.setnickname;
languagesToolStripMenuItem.Text = Class1.lang;
nicknamerror = Class1.nicknameloaderror;
savedialog = Class1.saved;
savedialogcap = Class1.savecap;
nicknameerrorcap = Class1.nlecap;
ncreate = Class1.ncreation;
ncreatecap = Class1.ncreationcap;
setnicknamedialog = Class1.setnicknamedialog;
newtab = Class1.nev;
for(int i = 0; i <= tabControl1.TabCount - 1; i++)
{
TabPage t = tabControl1.TabPages[i];
if(t.Text.Contains("New"))
{
t.Text.Replace("New", "Nowy");
}
Application.DoEvents();
}
}
The Class1 file:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ElectryNotepad
{
public static class Class1
{
public static string file = "Plik";
public static string open = "Otwórz";
public static string save = "Zapisz";
public static string saveas = "Zapisz jako";
public static string edit = "Edycja";
public static string cut = "Wytnij";
public static string copy = "Kopiuj";
public static string paste = "Wklej";
public static string selectall = "Zaznacz wszystko";
public static string deselectall = "Odznacz wszystko";
public static string dateandtime = "Data i Godzina";
public static string nickname = "Nazwa";
public static string awsel = "Automatyczne zaznaczanie słów";
public static string tabmgmt = "Zarządzanie zakładkami";
public static string ntab = "Nowa zakładka";
public static string dtab = "Usuń zaznaczoną zakładkę";
public static string iands = "Informacje i ustawienia";
public static string info = "ElectryNotepad - Informacje";
public static string setnickname = "Ustaw nazwę";
public static string nicknameloaderror = "Nie ustawiłeś swojej nazwy.
Proszę kliknąć opcję \"Ustaw nazwę\" w \"Informacje i Ustawienia\".";
public static string nlecap = "Błąd nazwy";
public static string setnicknamedialog = "Proszę wpisz swoją nazwę w
pole tekstowe poniżej (max 32 znaki) \n \n UWAGA! POPRZEDNIA NAZWA
ZOSTANIE USUNIĘTA!";
public static string ncreation = "\n \n Czy na chcesz ustawić tą
nazwę?";
public static string ncreationcap = "Asystent ustawiania nazwy";
public static string nev = "Nowy ";
public static string saved = "Czy chcesz zapisać swoją pracę?";
public static string savecap = "Zapisywanie";
public static string lang = "Język";
public static bool Polish = true;
public static int LangNumber = 1;
public static void ChangeLanguage(int l)
{
switch(l)
{
case 1:
Polish = true;
lang = "Język";
file = "Plik";
open = "Otwórz";
save = "Zapisz";
saveas = "Zapisz jako";
edit = "Edycja";
cut = "Wytnij";
copy = "Kopiuj";
paste = "Wklej";
selectall = "Zaznacz wszystko";
deselectall = "Odznacz wszystko";
dateandtime = "Data i Godzina";
awsel = "Automatyczne zaznaczanie słów";
tabmgmt = "Zarządzanie zakładkami";
nickname = "Nazwa";
ntab = "Nowa zakładka";
dtab = "Usuń zaznaczoną zakładkę";
iands = "Informacje i ustawienia";
info = "ElectryNotepad - Informacje";
setnickname = "Ustaw nazwę";
nicknameloaderror = "Nie ustawiłeś swojej nazwy. Proszę
kliknąć opcję \"Ustaw nazwę\" w \"Informacje i
Ustawienia\".";
nlecap = "Błąd nazwy";
setnicknamedialog = "Proszę wpisz swoją nazwę w pole
tekstowe poniżej (max 32 znaki) \n \n UWAGA! POPRZEDNIA
NAZWA ZOSTANIE USUNIĘTA!";
ncreation = "\n \n Czy na chcesz ustawić tą nazwę?";
ncreationcap = "Asystent ustawiania nazwy";
nev = "Nowy ";
saved = "Czy chcesz zapisać swoją pracę?";
savecap = "Zapisywanie";
break;
case 2:
Polish = false;
lang = "Language";
file = "File";
open = "Open";
save = "Save";
saveas = "Save as";
edit = "Edit";
cut = "Cut";
copy = "Copy";
paste = "Paste";
dateandtime = "Date and time";
selectall = "Select All";
deselectall = "Deselect All";
awsel = "Auto Word Selection";
tabmgmt = "Tab Management";
nickname = "Nickname";
ntab = "New Tab";
dtab = "Delete Selected Tab";
iands = "Info and Settings";
info = "ElectryNotepad - Info";
setnickname = "Set Nickname";
nicknameloaderror = "You didn't set nickname. Please, press
\"Set Nickname\" in \"Info and Settings\".";
nlecap = "Nickname error";
setnicknamedialog = "Please type your nickname in text field
below (max 32 characters) \n \n CAUTION! PREVIOUS NICKNAME
WILL BE DELETED!";
ncreation = "\n \n Are you sure you want to set this
nickname?";
ncreationcap = "Nickname creation assistant";
nev = "New ";
saved = "Do you want to save this?";
savecap = "Saving";
break;
}
}
}
}
But it doesn't work. When I click button for Polski, or for English it doesn't change anything. Help me, please.
Your all concept is wrong. You should use translation mechanism for such work.
Externalizing the translation of a WinForms application?
OK, ok. I realized I cam make another way to translate my program. I can make reading from file in search for text and applying it to these strings. Thread closed
I'm trying to build several gridpanels with the result of a search in the DB.
But they never appears...
Here is my code, what's wrong with it ?
http://pastebin.com/WuTZwZrP
EDIT
Ok, got it. For those who have the same problem, I solved it by adding this to the GridPanel :
RenderTo = this.ExtPanel.ClientID
And this after the build :
ext.GridPanel grid = this.BuildGridPanel(forwarder.Key, forwarder.Value);
grid.Render();
//this.ExtPanel.Controls.Add(grid);
public void AddGridPanel()
{
Ext.Net.GridPanel g=new Ext.Net.GridPanel();
Ext.Net.Store store1=new Ext.Net.Store();
Model model = new Model();
for (int i = 1; i < tas.getTaskDE().Count / 2; i++)
{
fields = fields + "," + tas.getTaskDE()[i].FieldName;
ModelField modelField = new ModelField();
modelField.Name = tas.getTaskDE()[i].FieldName;
model.Fields.Add(modelField);
if (tas.getTaskDE()[i].Visibility == "true")
{
g.ColumnModel.Columns.Add(new ColumnBase[] {
new Column
{
Text = tas.getTaskDE()[i].FieldADName,
DataIndex = tas.getTaskDE()[i].FieldName,
Flex = 1
},
});
}
}
SqlDataSource s = new SqlDataSource();
s.ConnectionString =ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
s.SelectCommand = query;
store1.Model.Add(model);
store1.DataSource = s;
store1.DataBind();
g.Store.Add(store1);
g.Render(this.Form);
}
this an example of dynamic gridpanel hope it helps
I have a default geocoordinate. Another geocoorinate which the user will provide. I want to change the change the map view such such that the source and destination can be clearly seen on the phone window with max zoom possible. Please help on how to approach this problem. I tried using setview() but i coudn't find an overload which could do the task.
public async void ShowMyLocationOnTheMap(string mapvariable)
{
JObject o = JObject.Parse(mapvariable);
string successcallback = o["successCallback"].ToString();
string failutecallback = o["failureCallback"].ToString();
var markerifo = o["markerInfo"];
int count = markerifo.Count();
try
{
for (int i = 0; i < count; i++)
{
drawmap(markerifo[i],"red");
}
Geolocator myGeolocator = new Geolocator();
Geoposition myGeoposition = await myGeolocator.GetGeopositionAsync();
JObject current = new JObject();
current["locationLatitude"] = myGeoposition.Coordinate.Latitude.ToString();
current["locationLongitude"] = myGeoposition.Coordinate.Longitude.ToString();
current["locationDescription"] = "Your Current Location";
current["locationName"] = "";
drawmap(current,"blue");
GeoCoordinate myGeoCoordinate = new GeoCoordinate(myGeoposition.Coordinate.Latitude, myGeoposition.Coordinate.Longitude);
MapAppzillon.SetView(myGeoCoordinate1,6);
gobject.ContentPanel.Children.Add(MapAppzillon);
var jsonstring = "{\"successMessage\":\" Map Displayed \"}";
string[] param = { successcallback, jsonstring };
gobject.invokeScript("StringToJsonObject", param);
}
catch (Exception ex)
{
var jsonstring = "{\"errorCode\":\"APZ-CNT-107\"}";
string[] param = { failutecallback, jsonstring };
gobject.invokeScript("StringToJsonObject", param);
}
}
public void drawmap(JToken markerifo,string color)
{
double latitude = Convert.ToDouble(markerifo["locationLatitude"].ToString());
double longitude = Convert.ToDouble(markerifo["locationLongitude"].ToString());
myGeoCoordinate1 = new GeoCoordinate(latitude, longitude);
Ellipse myCircle = new Ellipse();
if (color == "red")
{
myCircle.Fill = new SolidColorBrush(Colors.Red);
}
else
myCircle.Fill = new SolidColorBrush(Colors.Blue);
myCircle.Height = 20;
myCircle.Width = 20;
myCircle.Opacity = 50;
myCircle.Tap += (sender, e) => myCircle_Tap(sender, markerifo["locationDescription"].ToString(), markerifo["locationName"].ToString());
// myCircle.Tap += myCircle_Tap;
MapOverlay myLocationOverlay = new MapOverlay();
myLocationOverlay.Content = myCircle;
myLocationOverlay.PositionOrigin = new System.Windows.Point(0.5, 0.5);
myLocationOverlay.GeoCoordinate = myGeoCoordinate1;
MapLayer myLocationLayer = new MapLayer();
myLocationLayer.Add(myLocationOverlay);
MapAppzillon.Layers.Add(myLocationLayer);
}
Edit: I tried using dispatcher.Invoke and it finally worked. but now its loading only once . when i press the back button and specify another geocoordinate setview dosent work. Is there any solution to this.
List<GeoCoordinate> the2Points = new List<GeoCoordinate>();
the2Points.Add(myGeoCoordinate1);
the2Points.Add(myGeoCoordinate);
rect = LocationRectangle.CreateBoundingRectangle(the2Points);
gobject.ContentPanel.Children.Add(MapAppzillon);
MapAppzillon.Dispatcher.BeginInvoke(() =>
{
MapAppzillon.SetView(rect);
});
await Task.Delay(150);
You do need to use the SetView method on the Map control. But it needs a BoundingRectangle to work!
So a quick code snippet:
List<GeoCoordinate> the2Points = new List<GeoCoordinate>();
the2Points.Add(point1);
the2Points.Add(point2);
LocationRectangle rect = LocationRectangle.CreateBoundingRectangle(the2Points);
TheMapControl.SetView(rect);
I am able to create invoice on quickbook online, but when i check quickbook invoice online, it create the item lists but the price and description is missing. What i am doing wrong.
invoice.AlternateId = new NameValue[] { new NameValue() { Name = "InvoiceID", Value = service.InvoiceId } };
InvoiceHeader Header = new InvoiceHeader();
Header.DocNumber = service.InvoiceId;
Header.TxnDate = service.ServiceDate;
Header.TxnDateSpecified = true;
Header.Msg = service.Note.ToString();
Header.Note = service.Note.ToString();
Header.CustomerId = new IdType() { idDomain = idDomainEnum.QBO, Value = service.CustomerNumberOnline };
Header.Currency = currencyCode.USD;
Header.ShipDate = service.ServiceDate;
Header.ShipDateSpecified = true;
//Print and Email Option fields
if (EmailPrintOption == "Both")
{
Header.ToBeEmailed = true;
Header.ToBeEmailedSpecified = true;
Header.ToBePrinted = true;
Header.ToBePrintedSpecified = true;
}
else if (EmailPrintOption == "print")
{
Header.ToBePrinted = true;
Header.ToBePrintedSpecified = true;
}
else if (EmailPrintOption == "email")
{
Header.ToBeEmailed = true;
Header.ToBeEmailedSpecified = true;
}
else
{
Header.ToBeEmailed = false;
Header.ToBeEmailedSpecified = false;
Header.ToBePrinted = false;
Header.ToBePrintedSpecified = false;
}
PhysicalAddress BillAddress = new PhysicalAddress();
BillAddress.Line1 = service.SoldToAddress;
BillAddress.City = service.SoldToCity;
BillAddress.CountrySubDivisionCode = service.SoldToState;
BillAddress.PostalCode = service.SoldToZip;
BillAddress.Tag = new string[] { "Billing" };
Header.BillAddr = BillAddress;
PhysicalAddress ShipAddress = new PhysicalAddress();
ShipAddress.Line1 = service.JobJocationAddress;
ShipAddress.City = service.JobLocationCity;
ShipAddress.CountrySubDivisionCode = service.JobLocationState;
ShipAddress.PostalCode = service.JobLocationZip;
BillAddress.Tag = new string[] { "Shipping" };
Header.ShipAddr = ShipAddress;
decimal discount;
if (decimal.TryParse(service.Discount, out discount))
{
Header.ItemElementName = ItemChoiceType2.DiscountAmt;
Header.Item = -1 * discount; //discount must be negative
}
InvoiceLine[] InvoiceLines = new InvoiceLine[TaskOnlineIDs.Count];
object[] intuitItems = new object[TaskOnlineIDs.Count];
for (int i = 0; i < InvoiceLines.Length; i++)
{
InvoiceLines[i] = new InvoiceLine();
InvoiceLines[i].ItemsElementName = new Intuit.Ipp.Data.Qbo.ItemsChoiceType2[]
{
Intuit.Ipp.Data.Qbo.ItemsChoiceType2.ItemId
};
InvoiceLines[i].Items = new object[] {
new IdType(){idDomain=idDomainEnum.QBO, Value=TaskOnlineIDs[i]}
};
}
invoice.Line = InvoiceLines;
Header.SalesTermName = service.PaymentType;
Header.SalesRepName = service.TechName;
Header.PONumber = service.PurchaseOrder;
invoice.Header = Header;
What i miss here ??
Here what happen is, when i add invoice lines to invoice it set amount of each item to "0" by default, so when i try to add discount pragmatically it give's me error of discount greater than subtotal which is correct. But my question is why do i need to add cost for each item explicitly when i have already defined them earlier. We should add only itemId and rest QB should calculate.
I run the code and it will not store the values it stops immediately at the loadingfromscreen. What its supposed to do is a multi-page application form that will reinput the values to the texbox's on the back button from the next form.
The ASP.net code is too long to post, but basically its just texbox's and dropboxes. If needed i can post it, but the main issue im 90% sure is the C# code.
UPDATE: When i say stop it continues the code but will not run the dictionary method...i have put a arrow where the method stops in DICTIONARY ONLY
C#:
public partial class employment_driversapplication_personalinfo : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Dictionary<string, string> DriversApplicationData = (Dictionary<string, string>) Session["DriversApp"];
try
{
if (Page.IsPostBack)
{
LoadMemoryFromScreen(DriversApplicationData);
}
else
{
LoadScreenFromMemory(DriversApplicationData);
}
}
catch //(Exception ex)
{
// throw new Exception("Exception occured in employment_driversapplication_personalinfo.aspx - Page_Load" + ex.Message);
}
finally
{
}
}
private void LoadMemoryFromScreen(Dictionary<string, string> DicDriversApp)
{
DicDriversApp["position"] = position.Text; <---Stops here (won't even store this)
DicDriversApp["fname"] = fname.Text;
DicDriversApp["middleinitial"] = middleinitial.Text;
DicDriversApp["lname"] = lname.Text;
DicDriversApp["birthday"] = birthday.Text;
DicDriversApp["proofofage"] = proofofage.SelectedValue;
DicDriversApp["address"] = address.Text;
DicDriversApp["city"] = city.Text;
DicDriversApp["state"] = state.Text;
DicDriversApp["email"] = email.Text;
DicDriversApp["phone"] = phone.Text;
DicDriversApp["altphone"] = altphone.Text;
DicDriversApp["citizen"] = citizen.SelectedValue;
DicDriversApp["whoreferred"] = whoreferred.Text;
DicDriversApp["famfriend"] = famfriend.Text;
DicDriversApp["relationship"] = relationship.Text;
DicDriversApp["rateofpayexpected"] = rateofpayexpected.Text;
DicDriversApp["rateofpaytype"] = RadioButtonList1.SelectedValue;
DicDriversApp["employedNow"] = employednow.SelectedValue;
DicDriversApp["curremployment"] = curremployment.Text;
DicDriversApp["pastAddress"] = pastaddress.SelectedValue;
DicDriversApp["previousAddress"] = previousaddress.Text;
DicDriversApp["previousCity"] = previouscity.Text;
DicDriversApp["previousZip"] = previouszip.Text;
DicDriversApp["previousState"] = previousstate.Text;
DicDriversApp["previousDuration"] = previousduration.Text;
DicDriversApp["previousAddress1"] = previousaddress1.Text;
DicDriversApp["previousCity1"] = previouscity1.Text;
DicDriversApp["previousZip1"] = previouszip1.Text;
DicDriversApp["previousState1"] = previousstate1.Text;
DicDriversApp["previousDuration1"] = previousduration1.Text;
Session["DriversApp"] = DicDriversApp;
}
private void LoadScreenFromMemory(Dictionary<string, string> DicDriversApp)
{
position.Text = DicDriversApp["position"];
fname.Text = DicDriversApp["fname"] ;
middleinitial.Text = DicDriversApp["middleinitial"];
lname.Text = DicDriversApp["lname"];
birthday.Text = DicDriversApp["birthday"];
proofofage.SelectedValue = DicDriversApp["proofofage"];
address.Text = DicDriversApp["address"];
city.Text = DicDriversApp["city"];
state.Text = DicDriversApp["state"];
email.Text = DicDriversApp["email"];
phone.Text = DicDriversApp["phone"];
altphone.Text = DicDriversApp["altphone"];
citizen.SelectedValue = DicDriversApp["citizen"];
whoreferred.Text = DicDriversApp["whoreferred"];
famfriend.Text = DicDriversApp["famfriend"];
relationship.Text = DicDriversApp["relationship"];
rateofpayexpected.Text = DicDriversApp["rateofpayexpected"];
RadioButtonList1.SelectedValue = DicDriversApp["rateofpaytype"];
employednow.SelectedValue = DicDriversApp["employedNow"];
curremployment.Text = DicDriversApp["curremployment"];
pastaddress.SelectedValue = DicDriversApp["pastAddress"];
previousaddress.Text = DicDriversApp["previousAddress"];
previouscity.Text = DicDriversApp["previousCity"];
previouszip.Text = DicDriversApp["previousZip"];
previousstate.Text = DicDriversApp["previousState"];
previousduration.Text = DicDriversApp["previousDuration"];
previousaddress1.Text = DicDriversApp["previousAddress1"];
previouscity1.Text = DicDriversApp["previousCity1"];
previouszip1.Text = DicDriversApp["previousZip1"];
previousstate1.Text = DicDriversApp["previousState1"];
previousduration1.Text = DicDriversApp["previousDuration1"];
}
try something like this:
private void LoadMemoryFromScreen()
{
Dictionary<string, string> driver = new Dictionary<string, string>();
driver.Add("position", position.Text);
driver.Add("othervalue",value.Text); ///etc..
Session["dict"] = driver;
}
then, later on if you want to access the values in your dictionary, use something like this:
var dict = (Dictionary<string, string>)Session["dict"];
problem with this is that you're going to have to use dict.GetElementAt(index) in order to retrieve values, and i don't think that's a very good approach.
This will work, but i kinda dont understand why you are using a dictionary to do this. I assume you are only loading data from 1 person on your page? Then you might as well just make a class with all the properties in it, and then you can just pass that around instead of using this dictionary/session hack.
public class DriversApplicationData
{
public string position {get;set;}
public string firstname {get;set;}
//etc
}
then, you can just do something like
DriversApplicationData data = new DriversApplicationData();
data.position = position.Text;
data.firstname = fname.Text;
this is gonna be alot easier to maintain and to retrieve/insert values.