Changing the constraints in a Container object - layout

In Java 8, the Container class has an void add(Component comp, Object constraints) method that adds the component with a constraints information. I want to build a GUI with three panels, where pressing a button would result in switching the constraint information of the components that do not include the button object. How is it possible to switch the constraint information?
EDIT:
I tried the following:
private Map<SpecUITitlePanel, GridBagConstraints> constraints = new Hashtable<SpecUITitlePanel, GridBagConstraints>();
[…]
switchPanelsButton.setText( "Switch panels");
switchPanelsButton.addActionListener( new java.awt.event.ActionListener() {
public void actionPerformed( final java.awt.event.ActionEvent event) {
switchPanelsActionPerformed( event);
}
[…]
private void switchPanelsActionPerformed( final java.awt.event.ActionEvent event) {
boolean swapped = false;
final GridBagLayout layout = (GridBagLayout) getLayout();
final Iterator<SpecUITitlePanel> keysIter = constraints.keySet().iterator();
// summaryPanel, testPanel
while (keysIter.hasNext() && layout != null) {
final SpecUITitlePanel key = keysIter.next();
final String title = key.getTitle();
final Iterator<SpecUITitlePanel> keysIter2 = constraints.keySet().iterator();
while (keysIter2.hasNext()) {
final SpecUITitlePanel key2 = keysIter2.next();
final String title2 = key2.getTitle();
if (!title.equals( title2)) {
if (!title.contains( BUTTON_PANEL_TITLE) && !title2.contains( BUTTON_PANEL_TITLE)) {
// swap components
String message = "component = " + title + ", "
+ constraints.get( key) + "; component2 = " + title2
+ ", " + constraints.get( key2);
System.out.println( message);
final GridBagConstraints value = constraints.get( key);
final GridBagConstraints value2 = constraints.get( key2);
constraints.put(key, value2);
layout.setConstraints( key, value2);
constraints.put(key2, value);
layout.setConstraints( key2, value);
swapped = true;
message = "component = " + title + ", "
+ constraints.get( key) + "; component2 = " + title2
+ ", " + constraints.get( key2);
System.out.println( message);
}
}
}
}
if (swapped) {
repaint();
}
}
The relevant part of the output is
component = Test, java.awt.GridBagConstraints#5179288b; component2 = tna.rads.main_panel.violation_summary_panel, java.awt.GridBagConstraints#f1a7ed2
component = Test, java.awt.GridBagConstraints#f1a7ed2; component2 = tna.rads.main_panel.violation_summary_panel, java.awt.GridBagConstraints#5179288b

Related

Issue with splitting a string

For some reason, I can't get the split function to work.
I'm trying to compare the second word in the action string to the target string. What am I doing wrong?
String action = "Test Hello";
String target = "Hello";
void setup() {
}
void draw() {
String[] split = split(action, ' ');
String newScene = split[1];
boolean result = (newScene == target);
println("is " + newScene + " == " + target + ": " + result);
}
Here is a Java way of doing this:
String action = "Test Hello";
String target = "Hello";
if (action.split(" ")[1].equals(target)) {
System.out.println("MATCH");
}

I have this array class that is not removing items after re-running my recyclerview

The below class is used in an array.
package com.example.ShivitoMGO;
public class RoomTable {
public String RoomName,UpDown,minmaxint;
}
Main Activity
static ArrayList <RoomTable> CountCheck = new ArrayList<>();
public void playerup(View vvv){
st_spinner = v1.findViewById(R.id.spinner);
st_reportLayout = v1.findViewById(R.id.reportlayout);
st_Leanervidimg = v1.findViewById(R.id.Linearvidcopy);
TextView roomname = v1.findViewById(R.id.action_Players1);
RoomTable roomtb = new RoomTable();
if (CountCheck.size() == 0){
//playerupdown = "up";
Toast.makeText(this, "Will notify when " + mRooms.get(position1) + " players increase #" + mRoomSize.get(position1), Toast.LENGTH_LONG).show();
String[] minmaxval = mRoomSize.get(position1).split("/");
CountCheckint = Integer.parseInt(minmaxval[0].trim());
//CountCheck = (String) mRooms.get(position1);
roomtb.RoomName = (String) mRooms.get(position1);
roomtb.minmaxint = minmaxval[0].trim();
roomtb.UpDown = "up";
Log.d("added: ", "it was added");
CountCheck.add(roomtb);
Log.d("RoomTableadd: ",roomtb.RoomName+ " " + roomtb.minmaxint +" " +roomtb.UpDown);
st_reportLayout.setVisibility(View.GONE);
Log.d("Longclickhere: ", mRoomSize.get(position1));
Log.d("RoomNameCount ", String.valueOf(CountCheck.get(0).RoomName));
}else {
int exist1 = 0;
int poss;
for (int i = 0; i < CountCheck.size(); i++) {
if (roomname.getText() == CountCheck.get(i).RoomName) {
Log.d("RoomNametxt: " , CountCheck.get(i).RoomName);
Log.d("RoomNametxt: ", (String) roomname.getText());
Toast.makeText(this, "Notification " + CountCheck.get(i).RoomName + " OFF!", Toast.LENGTH_LONG).show();
Log.d("Removed item: ", String.valueOf(CountCheck.size()));
CountCheck.remove(i);
Log.d("Removed item: ", String.valueOf(CountCheck.size()));
st_reportLayout.setVisibility(View.GONE);
exist1 = 1;
poss = i;
} else {
exist1 = 0;
}
}
if (exist1 == 0) {
Toast.makeText(this, "Will notify when " + mRooms.get(position1) + " players increase #" + mRoomSize.get(position1), Toast.LENGTH_LONG).show();
String[] minmaxval = mRoomSize.get(position1).split("/");
CountCheckint = Integer.parseInt(minmaxval[0].trim());
//CountCheck = (String) mRooms.get(position1);
roomtb.RoomName = (String) mRooms.get(position1);
roomtb.minmaxint = minmaxval[0].trim();
roomtb.UpDown = "up";
Log.d("added: ", "it was added");
CountCheck.add(roomtb);
Log.d("RoomTableadd: ", roomtb.RoomName + " " + roomtb.minmaxint + " " + roomtb.UpDown);
st_reportLayout.setVisibility(View.GONE);
}
Log.d("CountSize: ", String.valueOf(CountCheck.size()));
for (int xb = 0;xb<CountCheck.size();xb++) {
try {
Log.d("RoomNameCount ", String.valueOf(CountCheck.get(xb).RoomName));
} catch (Exception e) {
Log.d("Out of range ", String.valueOf(e));
}
}
}
}
Recycler-View
#Override
public boolean onLongClick(View v) {
// Launch your web intent
if (CountCheck.size() != 0){
Log.d("Longclickhere: ",mRoomSize.get(position));
Toast.makeText(mContext, mRoomSize.get(position), Toast.LENGTH_SHORT).show();
Toast.makeText(mContext, "Will notify when "+mRooms.get(position)+" players decrease", Toast.LENGTH_SHORT).show();
String[] minmaxval = mRoomSize.get(position).split("/");
MainActivity.CountCheckint = Integer.parseInt(minmaxval[0].trim());
} else{
//MainActivity.CountCheck = "";
Toast.makeText(mContext, "Player Decrease notification OFF", Toast.LENGTH_SHORT).show();
}
return true;
In this app the recycler view creates the "rooms" and if the room is selected the textview and 2 other values are put in to the RoomTable. these are stored and used in a service to check if ether of the other to values change. Everything works as intended unless i use the swip-to-refresh witch runs the recycler-view again. If i do not refresh and i select the same item in the recycler-view it will remove it from CountCheck . However if i run the refresh and select the same recycler-view item that i selected previously it will add it instead of removing it. This Makes no since to me because i use a for loop to Check the CountCheck.get(i).RoomName aka the textview and if the names are the same then my if statement will remove instead of add. is it somehow possible i'm ending up with 2 CountCheck Objects????? with the same name???? Please I'm out of ideas on this one. Thanks.
I dont remember why. Maybe someone can explain but i changed this line
if (roomname.getText() == CountCheck.get(i).RoomName)
To this
if (roomname.getText().equals(CountCheck.get(i).RoomName));
and that fixed the issue. please let me know the difference if you are reading this.

Accessing Current SharedPreferences Data from Background Services

My app uses a countdown timer in the background in a class that extends Services. The background running service is designed to access the Sharedpreferences data of the app. During the countdown, a particular integer in the Sharedpreferences changes value and the updated value is expected to be accessed in the onFinish() call of the countdown timer. The problem now is that the Service don't read the updated valued from the Sharedpreferences but rather returns the initial value at the point the background service started.
I saw somewhere that the solution to the problem is to use
PreferenceManager.getDefaultSharedPreferences()
instead of getSharedPrefences to be able access the current SharedPreferences value. I implemented this recommendation but the problem persist.
Please somebody should help me out because trying to figure out this is taking too much of my time.
My code is here:
public class BroadcastService extends Service {
DatabaseHelperClass myDatabase = new DatabaseHelperClass(this);
private SharedPreferences defaultSharedPreferences, sharedPreferences, staffSignedIn;
private SharedPreferences.Editor staffEditor, defaultSharedPreferencesEditor;
int countSignIn;
private SimpleDateFormat simpleDateFormatII;
Long timeLeftInMiliseconds;
private final static String TAG = "BroadcastService";
public static final String COUNTDOWN_BR = "com.cenitscitech.www.etimebook.countdown_br";
Intent bi = new Intent(COUNTDOWN_BR);
CountDownTimer cdt = null;
#Override
public void onCreate() {
super.onCreate();
defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
defaultSharedPreferencesEditor = defaultSharedPreferences.edit();
sharedPreferences = getSharedPreferences("setTime", MODE_PRIVATE);
//staffSignedIn = getSharedPreferences("present", MODE_PRIVATE);
//countSignIn = staffSignedIn.getInt("max", 0);
//staffEditor = staffSignedIn.edit();
simpleDateFormatII = new SimpleDateFormat("MMM EEE dd, yyyy HH:mm");
Log.i(TAG, "Starting timer in broadcast receiver...");
Log.i(TAG, "max Count Obtained onBroadcastCreate: "+defaultSharedPreferences.getInt("max", 0));
}
#Override
public void onDestroy() {
//cdt.cancel();
Log.i(TAG, "Timer in broadcast receiver cancelled");
super.onDestroy();
}
#Override
public int onStartCommand(Intent intent, int flags, int startId) {
timeLeftInMiliseconds = intent.getLongExtra("timeLeft", 0L);
cdt = new CountDownTimer(timeLeftInMiliseconds, 1000) {
#Override
public void onTick(long millisUntilFinished) {
SharedPreferences defaultShared = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
Log.i(TAG, "Countdown seconds remaining: " + millisUntilFinished / 1000);
/*bi.putExtra("countdown", millisUntilFinished);
sendBroadcast(bi);*/
}
#Override
public void onFinish() {
SharedPreferences defaultSharedPreferences2 = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
countSignIn = defaultSharedPreferences2.getInt("max", 0);
Log.i(TAG, "Timer finished");
bi.putExtra("countdown", "Timer finished");
sendBroadcast(bi);
StringBuilder phoneBuilder = new StringBuilder();
Calendar cStart = Calendar.getInstance();
cStart.set(Calendar.HOUR_OF_DAY, 0);
cStart.set(Calendar.MINUTE, 0);
cStart.set(Calendar.SECOND, 0);
Long cStartLong = cStart.getTimeInMillis();
Calendar cEnd = Calendar.getInstance();
cEnd.set(Calendar.HOUR_OF_DAY, 23);
cEnd.set(Calendar.MINUTE, 59);
cEnd.set(Calendar.SECOND, 59);
Long cEndLong = cEnd.getTimeInMillis();
String[] conditionsElements;
Log.i(TAG + " onFinish", "MAXIMUM COUNT OBTAINED: " + defaultSharedPreferences2.getInt("max", 0));
Log.i(TAG + " onFinish", "MAXIMUM COUNT OBTAINED: " + countSignIn);
if (defaultSharedPreferences2.getInt("max", 0) > 0) {
Log.i(TAG + " onFinish", "CURRENT countSignIn Value: "+countSignIn+"\n"+" max Value: "+defaultSharedPreferences2.getInt("max", 0));
conditionsElements = new String[defaultSharedPreferences2.getInt("max", 0)];
for (int i = 1; i <= defaultSharedPreferences2.getInt("max", 0); i++) {
conditionsElements[i - 1] = defaultSharedPreferences2.getString(Integer.toString(i), "NoElement");
Log.i(TAG + " onFinish", "conditionsElement[" + (i - 1) + "] = " + defaultSharedPreferences2.getString(Integer.toString(i), "NoElement"));
if (i < defaultSharedPreferences2.getInt("max", 0)) {
phoneBuilder.append("MOBILE_NUMBER = ? OR ");
Log.i(TAG + " onFinish", "phoneBuilder[" + (i - 1) + "]: " + phoneBuilder);
//phoneBuilder.append(staffSignedIn.getString(Integer.toString(i), "NoStaff")+"_");
} else if (i == defaultSharedPreferences2.getInt("max", 0)) {
//phoneBuilder.append(staffSignedIn.getString(Integer.toString(i), "NoStaff"));
phoneBuilder.append("MOBILE_NUMBER = ?");
Log.i(TAG + " onFinish", "phoneBuilder[final]: " + phoneBuilder);
}
}
} else {
Log.i(TAG + " onFinishInsideElse", "CURRENT countSignIn Value: "+countSignIn+"\n"+" max Value: "+defaultSharedPreferences2.getInt("max", 0));
conditionsElements = new String[1];
conditionsElements[0] = "NoElement";
phoneBuilder.append("MOBILE_NUMBER = ?");
}
Cursor cursor = myDatabase.queryAbsentStaff(SURNAME_COLUMN + ", " + FIRST_NAME_COLUMN + ", " + MIDDLE_NAME_COLUMN + ", " + MOBILE_NUMBER_COLUMN + ", " + DATE_COLUMN,
SURNAME_COLUMN + ", " + FIRST_NAME_COLUMN + ", " + MIDDLE_NAME_COLUMN + ", " + MOBILE_NUMBER_COLUMN + ", " + DATE_COLUMN,
phoneBuilder.toString(),
conditionsElements);
Log.i(TAG + " onFinish", "\n" + "SET TIMES:" + "\n" + cStartLong + "\n" + cEndLong + "\n" + "RETURNED ROWS:" + "\n" + cursor.getCount());
/*staffEditor.putInt("max", 0);
staffEditor.apply();
for(int i=0; i<staffSignedIn.getInt("totalStaff", 100); i++){
staffEditor.putString(Integer.toString((i+1)), "empty").apply();
}*/
if(cursor.moveToFirst()){
for (int i = 0; i < cursor.getCount(); i++) {
if(myDatabase.insertTimeBookRecord(cursor.getString(cursor.getColumnIndex(SURNAME_COLUMN)), cursor.getString(cursor.getColumnIndex(FIRST_NAME_COLUMN)),
cursor.getString(cursor.getColumnIndex(MIDDLE_NAME_COLUMN)), cursor.getString(cursor.getColumnIndex(MOBILE_NUMBER_COLUMN)),
"ABSENT", Long.toString(System.currentTimeMillis()), 1000000L, "NO", "0000", System.currentTimeMillis(), "notSynced", "notSynced")){
cursor.moveToNext();
if(cursor.isAfterLast()){
cursor.close();
}
}else{
cursor.moveToNext();
if(cursor.isAfterLast()){
cursor.close();
}
}
}
}
Log.i(TAG +" onFinish: ", "max val reset: "+defaultSharedPreferences2.getInt("max", 0));

Spark combineByKey over reduceBykey using Java

I have the below dataset:
key value
---------------------------
key1,CLASS-A,YES,1
key2,CLASS-B,YES,2
key2,CLASS-B,YES,1
key1,CLASS-A,YES,4
key3,CLASS-C,DEFAULT,1
OUTPUT should look like:
key value
---------------------------
key1, CLASS-A,YES,5
key2, CLASS-B,YES,3
key3, CLASS-C,NO,1
While using reduceByKey to obtain the result , i found that whenever there is a key with only one value , in this case key3, the reduceByKey is not called as there is nothing to reduce against.And I get :
key value
---------------------------
key1, CLASS-A,YES,5
key2, CLASS-B,YES,3
key3, CLASS-C,DEAFULT,1
Can I achieve this using combineByKey in Spark (Java) .
What I tried so far :
reduceByKey(
new Function2<String, String, String>() {
#Override
public String call(String s1, String s2) throws Exception {
String[] vals1 = StringUtils.split(s1, ",");
String[] vals2 = StringUtils.split(s2, ",");
String jobStat1 = vals1[0];
String jobStat2 = vals2[0];
String reducedJobStat;
boolean s1 = jobStat1.equals("YES")
boolean s2 = jobStat2.equals("YES");
if (s1 || s2) {
reducedJobStat = "YES";
} else {
reducedJobStat = "NO";
}
return reducedJobStat;
}
}
)
the fundamental difference between reduceByKey and combineByKey in spark is that reduceByKey requires a function that takes a pair of values and returns a single value, whereas combineByKey allows for you to simultaneously transform your data and it requires three functions. The first is to create the new value type from the existing value type, the second adds an existing value type to a new value type, and the third adds to of the new value type.
The best example I have seen of combineByKey is at http://codingjunkie.net/spark-combine-by-key/
For your specific case, I'd recommend keeping it simple and using reduceByKey followed by mapValues to accomplish the desired transformation on key3. This might look something like:
reduced_rdd.mapValues(v => (v._1, if (v._2 == "DEFAULT") "NO" else v._2, v._3))
So , I got an alternate solution using combinerByKey. The code for reduceByKey looks simpler, but I am doing a mapValues after the reduceByKey(please look the question for reason) to get the result .
CombineByKey is fairly simple if we understand how it internally works .
Example using CombineByKey
Input :
key value
key1,CLASS-A,YES,1
key2,CLASS-B,YES,2
key2,CLASS-B,YES,1
key1,CLASS-A,YES,4
key3,CLASS-C,DEFAULT,1
//The CreateCombiner will initialise the 1st Key in the 1st partition . Here Lets divide the input into 2 partitions:
Partition 1: Partition 2:
key value key value
--------------------------- ---------------------------
key1, CLASS-A,YES,1 key1, CLASS-A,YES,4
key2, CLASS-B,YES,2 key3, CLASS-C,DEFAULT,1
key2, CLASS-B,YES,1
public class CreateCombiner implements Function<String, String> {
#Override
public String call(String value) { //value here is "CLASS-A,YES,1"
String jobStatus = value.split(",")[0];
if (jobStatus.equals("YES")
|| jobStatus.equals("DEFAULT") {
return "YES"+ " " + value.split(" ")[1] + " " + value.split(" ")[2];
} else {
return "NO" + " " + value.split(" ")[1] + " " + value.split(" ")[2];
}
}
}
When the Key1 in 1st partition is encounterd, the CreateCombiner will initialise that key's. (key1 here) value,In our case we change the value(2nd string(YES/NO/DEFAULT)).
Becase in my usecase I want to change all "DEFAULT" to "YES" .
It replaces all the YES and DEFAULT strings to YES and otherwise to NO. Now Same for Key2 in the 1st partition .
Again when it finds key2 in the 1st partition , the MergeValue class is called. It will merge the values . So here Key2 has 2 values(CLASS-B,YES,2 and CLASS-B,YES,1). It merges both.
like (key2,CLASS-B,YES,3)
The MergeCombiner takes the combiners (tuples) created on each partition and merges them together. So in my case the logic is same as in MergeValue.
public class MergeValue implements Function2<String, String, String> {
// MergeCombiner will decide the jobStatus and add the outCount and lbdCount.
// This is a Merging function that takes a value and merges it into the previously collecte value(s).
#Override
public String call(String v1, String v2) throws Exception {
String[] vals1 = StringUtils.split(v1, ",");
String[] vals2 = StringUtils.split(v2, ",");
String jobStat1 = vals1[0];
String jobStat2 = vals2[0];
String reducedJobStat;
boolean stat1Process = (jobStat1.equals("YES"))
|| (jobStat1.equals("DEFAULT"));
boolean stat2Process = (jobStat2.equals("YES"))
|| (jobStat2.equals("DEFAULT"));
if (stat1Process || stat2Process) {
reducedJobStat = "YES";
} else {
reducedJobStat = "NO";
}
int outCount = Integer.parseInt(vals1[1]) + Integer.parseInt(vals2[1]);
int lbdCount = Integer.parseInt(vals1[2]) + Integer.parseInt(vals2[2]);
return reducedJobStat + " " + Integer.toString(outCount) + " " + Integer.toString(lbdCount);
}
}
public class MergeCombiner implements Function2<String, String, String> {
// This fucntion combines the merged values together from MergeValue.
// Basically this function takes the new values produced at the partition level and combines them until we end up
// with one singular value.
#Override
public String call(String v1, String v2) throws Exception {
String[] vals1 = StringUtils.split(v1, ",");
String[] vals2 = StringUtils.split(v2, ",");
String jobStat1 = vals1[0];
String jobStat2 = vals2[0];
String reducedJobStat;
//Here we decide the jobStatus from 2 combiners , if both of them are complete ie jobStat1 and jobStat2 is COMP
// LETE, then the Status is marked as complete.
boolean stat1Process = (jobStat1.equals("YES");
boolean stat2Process = (jobStat2.equals("YES");
if (stat1Process || stat2Process) {
reducedJobStat = "YES";
} else {
reducedJobStat = "YES";
}
int outCount = Integer.parseInt(vals1[1]) + Integer.parseInt(vals2[1]);
int lbdCount = Integer.parseInt(vals1[2]) + Integer.parseInt(vals2[2]);
return reducedJobStat + " " + Integer.toString(outCount) + " " + Integer.toString(lbdCount);
}
Call to combineByKey
combineByKey(new CreateCombiner(), new MergeValue(), new MergeCombiner());
The same code Inmplemented using reduceByKey:
reduceByKey(
new Function2<String, String, String>() {
#Override
public String call(String s1, String s2) throws Exception {
String[] vals1 = StringUtils.split(s1, " ");
String[] vals2 = StringUtils.split(s2, " ");
String jobStat1 = vals1[0];
String jobStat2 = vals2[0];
String reducedJobStat;
boolean stat1Process = (jobStat1.equals("YES")) ||
(jobStat1.equals("DEFAULT");
boolean stat2Process = (jobStat2.equals("YES")) ||
(jobStat2.equals("DEFAULT");
if (stat1Process || stat2Process) {
reducedJobStat = "YES";
} else {
reducedJobStat = "NO";
}
int outCount = Integer.parseInt(vals1[1]) + Integer.parseInt(vals2[1]);
int lbdCount = Integer.parseInt(vals1[2]) + Integer.parseInt(vals2[2]);
return reducedJobStat + " " + Integer.toString(outCount) + " " + Integer.toString(lbdCount);
}
} ).mapValues(new Function<String, String>() {
#Override
public String call(String s) throws Exception {
String jobStatus = s.split(" ")[0];
if (jobStatus.equals("YES")
|| jobStatus.equals("DEFAULT") {
return "YES" + " " + s.split(" ")[1] + " " + s.split(" ")[2];
} else {
return "NO" + " " + s.split(" ")[1] + " " + s.split(" ")[2];
}
}
});

Strange behavior of threads

I’m writing an application that communicates with some hardware using the MODBUS protocol.
I'm using this sample from Code Project.
While trying to optimize the code (mainly the PollFunction function), I've encountered with a very strange threads lock.
Instead of sending each line of string to the DoGUIUpdate delagate, I'm constructing a string array and sending it as a whole.
Doing so causes the application to crush with a System.Reflection.targetParametercountException: Parameter count mismatch error.
The original code:
public delegate void GUIUpdate(string paramString);
public void DoGUIUpdate(string paramString)
{
if (InvokeRequired)
BeginInvoke(new GUIUpdate(DoGUIUpdate), paramString);
else
lstRegisterValues.Items.Add(paramString);
}
private void PollFunction()
{
...
string itemString;
for (int i = 0; i < pollLength; i++)
{
itemString = "[" + Convert.ToString(pollStart + i + 40001) + "] , MB[" + Convert.ToString(pollStart + i) + "] = " + values[i];
DoGUIUpdate(itemString);
}
}
My code:
public delegate void GUIUpdate2(string[] paramString);
public void DoGUIUpdate2(string[] paramString)
{
if (InvokeRequired)
BeginInvoke(new GUIUpdate2(DoGUIUpdate2), paramString);
else
{
lstRegisterValues.Items.Clear();
lstRegisterValues.Items.AddRange(paramString);
}
}
string[] valuesStrings;
private void PollFunction()
{
...
valuesStrings = new string[pollLength];
for (int i = 0; i < pollLength; i++)
{
valuesStrings[i] = "[" + Convert.ToString(pollStart + i + 40001) + "] , MB[" + Convert.ToString(pollStart + i) + "] = " + values[i];
}
DoGUIUpdate2(valuesStrings);
}
Any advice will be welcome.
i think BeginInvoke(new GUIUpdate2(DoGUIUpdate2), paramString); is the problem...
the second parameter of "begininvoke" accepts a param object[] params which will result in the call DoGuiUpdate(string1,string2,string3) which is not what you want...
try encapsulate in the following way:
BeginInvoke(new GUIUpdate2(DoGUIUpdate2), new[]{ paramString });

Resources