Properly sum stats for multiple stratum proxy devices

--- MultiMiner.Win/MainForm.cs
+++ MultiMiner.Win/MainForm.cs
@@ -1045,12 +1045,25 @@

         private void PopulateMinerStatsForRow(MultiMiner.Xgminer.Api.DeviceInformation deviceInformation, DataGridViewRow row)
         {
+            //stratum devices get lumped together, so we sum those
+            if (deviceInformation.Name.Equals("SGW", StringComparison.OrdinalIgnoreCase))
+            {
+                row.Cells[hashRateColumn.Index].Value = (double)(row.Cells[hashRateColumn.Index].Value ?? 0.00) + deviceInformation.AverageHashrate;
+                row.Cells[acceptedColumn.Index].Value = (int)(row.Cells[acceptedColumn.Index].Value ?? 0) + deviceInformation.AcceptedShares;
+                row.Cells[rejectedColumn.Index].Value = (int)(row.Cells[rejectedColumn.Index].Value ?? 0) + deviceInformation.RejectedShares;
+                row.Cells[errorsColumn.Index].Value = (int)(row.Cells[errorsColumn.Index].Value ?? 0) + deviceInformation.HardwareErrors;
+                row.Cells[utilityColumn.Index].Value = (double)(row.Cells[utilityColumn.Index].Value ?? 0.00) + deviceInformation.Utility;
+            }
+            else
+            {
+                row.Cells[hashRateColumn.Index].Value = deviceInformation.AverageHashrate;
+                row.Cells[acceptedColumn.Index].Value = deviceInformation.AcceptedShares;
+                row.Cells[rejectedColumn.Index].Value = deviceInformation.RejectedShares;
+                row.Cells[errorsColumn.Index].Value = deviceInformation.HardwareErrors;
+                row.Cells[utilityColumn.Index].Value = deviceInformation.Utility;
+            }
+
             row.Cells[temperatureColumn.Index].Value = deviceInformation.Temperature;
-            row.Cells[hashRateColumn.Index].Value = deviceInformation.AverageHashrate;
-            row.Cells[acceptedColumn.Index].Value = deviceInformation.AcceptedShares;
-            row.Cells[rejectedColumn.Index].Value = deviceInformation.RejectedShares;
-            row.Cells[errorsColumn.Index].Value = deviceInformation.HardwareErrors;
-            row.Cells[utilityColumn.Index].Value = deviceInformation.Utility;
             row.Cells[intensityColumn.Index].Value = deviceInformation.Intensity;
             PopulatePoolForRow(deviceInformation.PoolIndex, row);
         }
@@ -1190,6 +1203,14 @@
                 {
                     minerProcess.MinerIsFrozen = true;
                     continue;
+                }
+
+                //first clear stats for each row
+                //this is because the SWG row stats get summed
+                foreach (MultiMiner.Xgminer.Api.DeviceInformation deviceInformation in deviceInformationList)
+                {
+                    int rowIndex = GetRowIndexForDeviceInformation(deviceInformation);
+                    ClearMinerStatsForRow(deviceGridView.Rows[rowIndex]);
                 }

                 foreach (MultiMiner.Xgminer.Api.DeviceInformation deviceInformation in deviceInformationList)


Only apply a mining strategory if mining and setup to ming profitable coins

--- MultiMiner.Win/MainForm.cs
+++ MultiMiner.Win/MainForm.cs
@@ -762,12 +762,14 @@
         {
             RefreshCoinStats();

-            miningEngine.ApplyMiningStrategy(devices, coinInformation);
-
-            engineConfiguration.SaveDeviceConfigurations(); //save any changes made by the engine
-
-            //to get changes from strategy config
-            LoadGridValuesFromConfiguration();
+            if (miningEngine.Mining && engineConfiguration.StrategyConfiguration.MineProfitableCoins)
+            {
+                miningEngine.ApplyMiningStrategy(devices, coinInformation);
+                //save any changes made by the engine
+                engineConfiguration.SaveDeviceConfigurations();
+                //to get changes from strategy config
+                LoadGridValuesFromConfiguration();
+            }

             coinStatsCountdownMinutes = coinStatsTimer.Interval / 1000 / 60;
         }


Refresh status bar stats based on View Models rather than Models

--- MultiMiner.Win/MainForm.cs
+++ MultiMiner.Win/MainForm.cs
@@ -2484,6 +2484,7 @@

             AutoSizeListViewColumns();
             UpdateMiningButtons();
+            RefreshStatusBarFromViewModel();
         }
         #endregion

@@ -2877,6 +2878,7 @@
             UpdateMiningButtons();
             RefreshCoinPopupMenu();
             UpdateChangesButtons(GetViewModelToView().HasChanges);
+            RefreshStatusBarFromViewModel();
         }

         private static IRemotingService GetServiceChannelForInstance(Instance instance)
@@ -3702,14 +3704,7 @@
             }

             RefreshListViewFromViewModel();
-
-            //Mh not mh, mh is milli
-            scryptRateLabel.Text = totalScryptRate == 0 ? String.Empty : String.Format("Scrypt: {0}", totalScryptRate.ToHashrateString());
-            //spacing used to pad out the status bar item
-            sha256RateLabel.Text = totalSha256Rate == 0 ? String.Empty : String.Format("SHA-2: {0}", totalSha256Rate.ToHashrateString());
-
-            scryptRateLabel.AutoSize = true;
-            sha256RateLabel.AutoSize = true;
+            RefreshStatusBarFromViewModel();

             notifyIcon1.Text = string.Format("MultiMiner - {0} {1}", scryptRateLabel.Text, sha256RateLabel.Text);

@@ -5194,8 +5189,7 @@

                 //auto-size columns
                 AutoSizeListViewColumns();
-
-                deviceTotalLabel.Text = String.Format("{0} device(s)", devices.Count);
+                RefreshStatusBarFromViewModel();

                 //it may not be possible to mine after discovering devices
                 UpdateMiningButtons();
@@ -5204,6 +5198,23 @@
             {
                 updatingListView = false;
             }
+        }
+
+        private void RefreshStatusBarFromViewModel()
+        {
+            MainFormViewModel viewModel = GetViewModelToView();
+            deviceTotalLabel.Text = String.Format("{0} device(s)", viewModel.Devices.Count);
+
+            double scryptHashRate = viewModel.Devices.Where(d => (d.Coin != null) && (d.Coin.Algorithm == CoinAlgorithm.Scrypt)).Sum(d => d.AverageHashrate);
+            double sha256HashRate = viewModel.Devices.Where(d => (d.Coin != null) && (d.Coin.Algorithm == CoinAlgorithm.SHA256)).Sum(d => d.AverageHashrate);
+
+            //Mh not mh, mh is milli
+            scryptRateLabel.Text = scryptHashRate == 0 ? String.Empty : String.Format("Scrypt: {0}", scryptHashRate.ToHashrateString());
+            //spacing used to pad out the status bar item
+            sha256RateLabel.Text = sha256HashRate == 0 ? String.Empty : String.Format("SHA-2: {0}", sha256HashRate.ToHashrateString());
+
+            scryptRateLabel.AutoSize = true;
+            sha256RateLabel.AutoSize = true;
         }

         private void StartMiningLocally()