private void StartButton_TouchUpInside(object sender, EventArgs e)
 {
     ExceptionUtility.Try(() =>
     {
         string title = _startPivot ? StringLiterals.StartStationConfirmationTitle : StringLiterals.StopProgramConfirmationTitle;
         AlertUtility.ShowConfirmationAlert(title, StringLiterals.FormatStartStopProgramConfirmationMessage(_startPivot, _programStart.Name, _programStart.Id), (b) =>
         {
             if (b)
             {
                 StopStartProgramConfirmed(_programStart, _startPivot);
             }
             else
             {
                 var cell = this.GetCell(_programStart) as ProgramListTableViewCell;
                 if (cell != null)
                 {
                     _programStart.Starting = false;
                     cell.LoadCellValues(_programStart);
                 }
             }
         }, okButtonText: _startPivot?StringLiterals.Start: StringLiterals.Stop);
     });
 }
Esempio n. 2
0
        //edited
        private void DismissAlertsConfirmed()
        {
            ExceptionUtility.Try(() =>
            {
                if (this.HasAccessLevelToDelete())
                {
                    if (String.IsNullOrEmpty(_searchBoxView.Text))
                    {
                        //var activeAlertIds = this.GetActiveAlertIds();
                        var activeAlerts = GetActiveAlert();
                        //check all the active alers have correct access with device
                        var deletingAlertsIds = CheckAlertDeletePermission(activeAlerts);

                        if (deletingAlertsIds.Count < activeAlerts.Count())
                        {
                            AlertUtility.ShowConfirmationAlert(StringLiterals.Alert, StringLiterals.ActiveAlertsNotAccessForDissmiss(), (b) =>
                            {
                                if (b)
                                {
                                    ServiceContainer.AlertService.DismissGlobalAlerts(deletingAlertsIds, onReconnect: () => { DismissAlertsConfirmed(); }).ContinueWith((r) =>
                                    {
                                        MainThreadUtility.InvokeOnMain(() =>
                                        {
                                            ProgressUtility.Dismiss();
                                        });
                                    });
                                }
                            }, StringLiterals.Dismiss);
                        }
                        else
                        {
                            ServiceContainer.AlertService.DismissGlobalAlerts(deletingAlertsIds, onReconnect: () => { DismissAlertsConfirmed(); }).ContinueWith((r) =>
                            {
                                MainThreadUtility.InvokeOnMain(() =>
                                {
                                    ProgressUtility.Dismiss();
                                });
                            });
                        }
                    }
                    else
                    {
                        //var activeAlertIds = this.GetActiveAlertIds();
                        var activeAlerts = GetActiveAlertsFromSearchList();
                        //check all the active alers have correct access with device
                        var deletingAlertsIds = CheckAlertDeletePermission(activeAlerts);

                        if (deletingAlertsIds.Count < activeAlerts.Count())
                        {
                            AlertUtility.ShowConfirmationAlert(StringLiterals.Alert, StringLiterals.ActiveAlertsNotAccessForDissmiss(), (b) =>
                            {
                                if (b)
                                {
                                    ServiceContainer.AlertService.DismissGlobalAlerts(deletingAlertsIds, onReconnect: () => { DismissAlertsConfirmed(); }).ContinueWith((r) =>
                                    {
                                        MainThreadUtility.InvokeOnMain(() =>
                                        {
                                            ProgressUtility.Dismiss();
                                        });
                                    });
                                }
                            }, StringLiterals.Dismiss);
                        }
                        else
                        {
                            ServiceContainer.AlertService.DismissGlobalAlerts(deletingAlertsIds, onReconnect: () => { DismissAlertsConfirmed(); }).ContinueWith((r) =>
                            {
                                MainThreadUtility.InvokeOnMain(() =>
                                {
                                    ProgressUtility.Dismiss();
                                });
                            });
                        }
                    }
                }
            });
        }
 static public int GetItemCount(string itemName)
 {
     return(PlayerPrefs.GetInt(StringLiterals.GetItemCountString(itemName)));
 }
Esempio n. 4
0
    /// <summary>
    /// Creates the bullet protos.
    /// </summary>
    void CreateBulletProtos()
    {
        //Magnum
        string name = StringLiterals.GetBulletNameForGun(StringLiterals.Magnum);

        itemProtoTypes.Add(name,
                           new Bullet(
                               name,  // name
                               1,     // cost
                               0,     // count
                               10,    // purchaseAmount
                               true,  // isStackable
                               false, // equipped
                               15f,   // damage
                               20f    // velocity
                               )
                           );


        //Mp5
        name = StringLiterals.GetBulletNameForGun(StringLiterals.Mp5);

        itemProtoTypes.Add(name,
                           new Bullet(
                               name,  // name
                               1,     // cost
                               0,     // count
                               50,    // purchaseAmount
                               true,  // isStackable
                               false, // equipped
                               22f,   // damage
                               25f    // velocity
                               )
                           );

        //Shotgun
        name = StringLiterals.GetBulletNameForGun(StringLiterals.Shotgun);

        itemProtoTypes.Add(name,
                           new Bullet(
                               name,  // name
                               1,     // cost
                               0,     // count
                               5,     // purchaseAmount
                               true,  // isStackable
                               false, // equipped
                               50f,   // damage
                               25f    // velocity
                               )
                           );

        //Uzi
        name = StringLiterals.GetBulletNameForGun(StringLiterals.Uzi);

        itemProtoTypes.Add(name,
                           new Bullet(
                               name,  // name
                               1,     // cost
                               0,     // count
                               20,    // purchaseAmount
                               true,  // isStackable
                               false, // equipped
                               10f,   // damage
                               25f    // velocity
                               )
                           );

        //Sniper
        name = StringLiterals.GetBulletNameForGun(StringLiterals.Sniper);

        itemProtoTypes.Add(name,
                           new Bullet(
                               name,  // name
                               1,     // cost
                               0,     // count
                               7,     // purchaseAmount
                               true,  // isStackable
                               false, // equipped
                               100f,  // damage
                               80f    // velocity
                               )
                           );

        //UziLong
        name = StringLiterals.GetBulletNameForGun(StringLiterals.UziLong);


        itemProtoTypes.Add(name,
                           new Bullet(
                               name,    // name
                               1,       // cost
                               0,       // count
                               30,      // purchaseAmount
                               true,    // isStackable
                               false,   // equipped
                               10f,     // damage
                               25f      // velocity
                               )
                           );

        //Machinegun
        name = StringLiterals.GetBulletNameForGun(StringLiterals.Machinegun);

        itemProtoTypes.Add(name,
                           new Bullet(
                               name,    // name
                               1,       // cost
                               0,       // count
                               100,     // purchaseAmount
                               true,    // isStackable
                               false,   // equipped
                               35f,     // damage
                               25f      // velocity
                               )
                           );

        //RocketLauncher
        name = StringLiterals.GetBulletNameForGun(StringLiterals.RocketLauncher);

        itemProtoTypes.Add(name,
                           new Bullet(
                               name,        // name
                               1,           // cost
                               0,           // count
                               3,           // purchaseAmount
                               true,        // isStackable
                               false,       // equipped
                               100f,        // damage
                               20f          // velocity
                               )
                           );

        //RocketLauncherModern
        name = StringLiterals.GetBulletNameForGun(StringLiterals.RocketLauncherModern);

        itemProtoTypes.Add(name,
                           new Bullet(
                               name,                // name
                               1,                   // cost
                               0,                   // count
                               3,                   // purchaseAmount
                               true,                // isStackable
                               false,               // equipped
                               100f,                // damage
                               20f                  // velocity
                               )
                           );

        //RocketLauncherSide
        name = StringLiterals.GetBulletNameForGun(StringLiterals.RocketLauncherSide);

        itemProtoTypes.Add(name,
                           new Bullet(
                               name,            // name
                               1,               // cost
                               0,               // count
                               3,               // purchaseAmount
                               true,            // isStackable
                               false,           // equipped
                               100f,            // damage
                               20f              // velocity
                               )
                           );
    }
Esempio n. 5
0
        private TwoxTwoAndMxNResultsSet SetupMxN(GadgetParameters gadgetOptions, TwoxTwoAndMxNResultsSet resultSet)
        {
            DashboardHelper dashboardHelper = new DashboardHelper();
            DataTable       table           = resultSet.FreqResultsDataTable;

            StringLiterals thisStringLiterals = new StringLiterals();

            int MaxRows = 100;

            string strataValue = gadgetOptions.TableName;
            string freqVar     = gadgetOptions.MainVariableName;

            //  this.Dispatcher.BeginInvoke(addGrid, string.Empty, table.TableName, table.Columns.Count);
            this.addGrid(string.Empty, table.TableName, table.Columns.Count);

            int rowCount;
            //double count = 0;
            //foreach (DescriptiveStatistics ds in resultSet.FreqResultsDescriptiveStatistics)
            //{
            //    count = count + ds.Observations;
            //}

            //if (count == 0)
            //{
            //    //  this.Dispatcher.BeginInvoke(new RenderFinishWithErrorDelegate(RenderFinishWithError), SharedStrings.NO_RECORDS_SELECTED);

            //    //   RenderFinishWithError(SharedStrings.NO_RECORDS_SELECTED);

            //    //  this.Dispatcher.BeginInvoke(new SimpleCallback(SetGadgetToFinishedState));

            //    // SetGadgetToFinishedState();

            //    return resultSet;
            //}

            //if (table.Rows.Count == 0)
            //{
            //    //  this.Dispatcher.BeginInvoke(new RenderFinishWithErrorDelegate(RenderFinishWithError), SharedStrings.NO_RECORDS_SELECTED);
            //    RenderFinishWithError(SharedStrings.NO_RECORDS_SELECTED);

            //    //  this.Dispatcher.BeginInvoke(new SimpleCallback(SetGadgetToFinishedState));
            //    SetGadgetToFinishedState();

            //    return;
            //}

            string tableHeading = strataValue;

            //  this.Dispatcher.BeginInvoke(renderHeader, strataValue, tableHeading, table.Columns);
            //      renderHeader(strataValue, tableHeading, table.Columns);

            rowCount = 1;

            int[] totals      = new int[table.Columns.Count - 1];
            int   columnCount = 1;

            foreach (System.Data.DataRow row in table.Rows)
            {
                if (!row[freqVar].Equals(DBNull.Value) || (row[freqVar].Equals(DBNull.Value) && gadgetOptions.ShouldIncludeMissing == true))
                {
                    Field field = null;
                    foreach (DataRow fieldRow in dashboardHelper.FieldTable.Rows)
                    {
                        if (fieldRow["columnname"].Equals(freqVar))
                        {
                            if (fieldRow["epifieldtype"] is Field)
                            {
                                field = fieldRow["epifieldtype"] as Field;
                            }
                            break;
                        }
                    }

                    //  this.Dispatcher.Invoke(addRow, strataValue, 30);
                    this.addRow(strataValue, 30);

                    string displayValue = row[freqVar].ToString();

                    if (dashboardHelper.IsUserDefinedColumn(freqVar))
                    {
                        displayValue = dashboardHelper.GetFormattedOutput(freqVar, row[freqVar]);
                    }
                    else
                    {
                        if (field != null && field is YesNoField)
                        {
                            if (row[freqVar].ToString().Equals("1"))
                            {
                                displayValue = Ewav.Web.Config.ConfigDataSet.RepresentationOfYes;//"Yes";
                            }
                            else if (row[freqVar].ToString().Equals("0"))
                            {
                                displayValue = Ewav.Web.Config.ConfigDataSet.RepresentationOfNo;// "No";
                            }
                        }
                        else if (field != null && field is DateField)
                        {
                            displayValue = string.Format(System.Globalization.CultureInfo.CurrentCulture, "{0:d}", row[freqVar]);
                        }
                        else if (field != null && field is TimeField)
                        {
                            displayValue = string.Format(System.Globalization.CultureInfo.CurrentCulture, "{0:T}", row[freqVar]);
                        }
                        else
                        {
                            displayValue = dashboardHelper.GetFormattedOutput(freqVar, row[freqVar]);
                        }
                    }

                    if (string.IsNullOrEmpty(displayValue))
                    {
                        //Configuration config = dashboardHelper.Config;
                        displayValue = "Missing";//config.Settings.RepresentationOfMissing;
                    }

                    //  this.Dispatcher.BeginInvoke(setText, strataValue/new TextBlockConfig(thisStringLiterals.SPACE + displayValue + thisStringLiterals.SPACE, new Thickness(2, 0, 2, 0), VerticalAlignment.Center, HorizontalAlignment.Left, rowCount, 0), FontWeights.Normal);
                    this.setText(strataValue, new Ewav.Web.Services.TwoByTwoDomainService.TextBlockConfig(string.Format("{0}{1}{2}", thisStringLiterals.SPACE, displayValue, thisStringLiterals.SPACE),
                                                                                                          rowCount, 0), "Normal");

                    int rowTotal = 0;
                    columnCount = 1;

                    foreach (DataColumn column in table.Columns)
                    {
                        if (columnCount > this.MaxColumns)
                        {
                            //this.Dispatcher.BeginInvoke(new ShowWarningDelegate(ShowWarning), (frequencies.Columns.Count - maxColumns).ToString() + " additional allColumns were not displayed due to gadget settings.");
                            resultSet.exceededMaxColumns = true;
                            break;
                        }

                        if (column.ColumnName.Equals(freqVar))
                        {
                            continue;
                        }

                        //  this.Dispatcher.BeginInvoke(setText, strataValue, new TextBlockConfig(thisStringLiterals.SPACE + row[column.ColumnName].ToString() + thisStringLiterals.SPACE, new Thickness(2, 0, 2, 0), VerticalAlignment.Center, HorizontalAlignment.Right, rowCount, columnCount), FontWeights.Normal);
                        this.setText(strataValue, new Ewav.Web.Services.TwoByTwoDomainService.TextBlockConfig(string.Format("{0}{1}{2}", thisStringLiterals.SPACE, row[column.ColumnName].ToString(), thisStringLiterals.SPACE), rowCount, columnCount), "normal");

                        columnCount++;

                        int  rowValue = 0;
                        bool success  = int.TryParse(row[column.ColumnName].ToString(), out rowValue);
                        if (success)
                        {
                            totals[columnCount - 2] = totals[columnCount - 2] + rowValue;
                            rowTotal = rowTotal + rowValue;
                        }
                    }

                    //  this.Dispatcher.BeginInvoke(setText, strataValue, new TextBlockConfig(thisStringLiterals.SPACE + rowTotal.ToString() + thisStringLiterals.SPACE, new Thickness(2, 0, 2, 0), VerticalAlignment.Center, HorizontalAlignment.Right, rowCount, columnCount), FontWeights.Bold);
                    this.setText(strataValue, new Ewav.Web.Services.TwoByTwoDomainService.TextBlockConfig(string.Format("{0}{1}{2}", thisStringLiterals.SPACE, rowTotal.ToString(), thisStringLiterals.SPACE),
                                                                                                          rowCount, columnCount), "bo");

                    rowCount++;
                }

                if (rowCount > MaxRows)
                {
                    foreach (DataColumn column in table.Columns)
                    {
                        if (columnCount > this.MaxColumns)
                        {
                            resultSet.exceededMaxColumns = true;
                            break;
                        }

                        if (column.ColumnName.Equals(freqVar))
                        {
                            continue;
                        }

                        //  this.Dispatcher.BeginInvoke(setText, strataValue, new TextBlockConfig(thisStringLiterals.SPACE + thisStringLiterals.ELLIPSIS + thisStringLiterals.SPACE, new Thickness(2, 0, 2, 0), VerticalAlignment.Center, HorizontalAlignment.Right, rowCount, columnCount), FontWeights.Normal);
                        this.setText(strataValue, new Ewav.Web.Services.TwoByTwoDomainService.TextBlockConfig(string.Format("{0}{1}{2}", thisStringLiterals.SPACE, thisStringLiterals.ELLIPSIS, thisStringLiterals.SPACE),
                                                                                                              rowCount, columnCount), "normal");
                        columnCount++;
                    }

                    //  this.Dispatcher.BeginInvoke(setText, strataValue, new TextBlockConfig(thisStringLiterals.SPACE + thisStringLiterals.ELLIPSIS + thisStringLiterals.SPACE, new Thickness(2, 0, 2, 0), VerticalAlignment.Center, HorizontalAlignment.Right, rowCount, columnCount), FontWeights.Bold);
                    this.setText(strataValue, new Ewav.Web.Services.TwoByTwoDomainService.TextBlockConfig(string.Format("{0}{1}{2}", thisStringLiterals.SPACE, thisStringLiterals.ELLIPSIS, thisStringLiterals.SPACE),
                                                                                                          rowCount, columnCount), "bo");

                    rowCount++;
                    resultSet.exceededMaxRows = true;

                    break;
                }
            }

            //  this.Dispatcher.BeginInvoke(new AddGridFooterDelegate(RenderFrequencyFooter), strataValue, rowCount, totals);
            this.RenderFrequencyFooter(strataValue, rowCount, totals);

            //  this.Dispatcher.BeginInvoke(drawBorders, strataValue);
            //      drawBorders(strataValue);

            //if (exceededMaxRows && exceededMaxColumns)
            //{
            //    //  this.Dispatcher.BeginInvoke(new RenderFinishWithWarningDelegate(RenderFinishWithWarning), "Warning: Some rows and allColumns were not displayed due to gadget settings. Showing top " + MaxRows.ToString() + " rows and top " + MaxColumns.ToString() + " allColumns only.");
            //    RenderFinishWithWarning("Warning: Some rows and allColumns were not displayed due to gadget settings. Showing top " + MaxRows.ToString() + " rows and top " + MaxColumns.ToString() + " allColumns only.");

            //}
            //else if (exceededMaxColumns)
            //{
            //    //  this.Dispatcher.BeginInvoke(new RenderFinishWithWarningDelegate(RenderFinishWithWarning), "Warning: Some allColumns were not displayed due to gadget settings. Showing top " + MaxColumns.ToString() + " allColumns only.");
            //    RenderFinishWithWarning("Warning: Some allColumns were not displayed due to gadget settings. Showing top " + MaxColumns.ToString() + " allColumns only.");
            //}
            //else if (exceededMaxRows)
            //{
            //    //  this.Dispatcher.BeginInvoke(new RenderFinishWithWarningDelegate(RenderFinishWithWarning), string.Format(SharedStrings.DASHBOARD_GADGET_STATUS_ROW_LIMIT, MaxRows.ToString()));
            //    RenderFinishWithWarning(string.Format(SharedStrings.DASHBOARD_GADGET_STATUS_ROW_LIMIT, MaxRows.ToString()));
            //}
            //else if (rowCount > 2)
            //{
            //    //  this.Dispatcher.BeginInvoke(new RenderFinishWithWarningDelegate(RenderFinishWithWarning), "Warning: More than two values exist in the exposure fields. Displaying an MxN table.");
            //    RenderFinishWithWarning("Warning: More than two values exist in the exposure fields. Displaying an MxN table.");
            //}
            //else if (columnCount > 3)
            //{
            //    //  this.Dispatcher.BeginInvoke(new RenderFinishWithWarningDelegate(RenderFinishWithWarning), "Warning: More than two values exist in the outcome fields. Displaying an MxN table.");
            //    RenderFinishWithWarning("Warning: More than two values exist in the outcome fields. Displaying an MxN table.");
            //}
            //else if (rowCount < 2)
            //{
            //    //  this.Dispatcher.BeginInvoke(new RenderFinishWithWarningDelegate(RenderFinishWithWarning), "Warning: Less than two values exist in the exposure fields. Displaying an MxN table.");
            //    RenderFinishWithWarning("Warning: Less than two values exist in the exposure fields. Displaying an MxN table.");
            //}
            //else if (columnCount < 3)
            //{
            //    //  this.Dispatcher.BeginInvoke(new RenderFinishWithWarningDelegate(RenderFinishWithWarning), "Warning: Less than two values exist in the outcome fields. Displaying an MxN table.");
            //    RenderFinishWithWarning("Warning: Less than two values exist in the outcome fields. Displaying an MxN table.");
            //}
            //else
            //{
            //    // this.Dispatcher.BeginInvoke(new SimpleCallback(RenderFinish));
            //    RenderFinish();
            //}
            ////  this.Dispatcher.BeginInvoke(new SimpleCallback(SetGadgetToFinishedState));
            //SetGadgetToFinishedState();

            resultSet.MxNGridRows          = this.mxNGridRows;
            resultSet.MxNGridCells         = this.mxNGridSetupParameters;
            resultSet.MxNSetTextParameters = this.mxNSetTextParameters;

            return(resultSet);
        }
Esempio n. 6
0
 public void SetCountSelected(int count)
 {
     this._selectedLabel.Text = StringLiterals.FormatNumberSelected(count);
     this._selectedLabel.SizeToFit();
 }
Esempio n. 7
0
        private void WaterSelectedStations(IEnumerable <PumpViewModel> pumps, int durationMinutes)
        {
            ExceptionUtility.Try(() =>
            {
                IEnumerable <string> stationNames, stationNumbers;
                this.GetSelectedStationsList(out stationNames, out stationNumbers);

                AlertUtility.ShowConfirmationAlert(StringLiterals.StartStationConfirmationTitle, StringLiterals.FormatStartStationConfirmationMessage(stationNames, stationNumbers), (b) =>
                {
                    if (b)
                    {
                        this.WaterSelectedStationsConfirmed(pumps, durationMinutes);
                    }
                }, okButtonText: StringLiterals.StartButtonText);
            });
        }
Esempio n. 8
0
        private void TestSelectedStations()
        {
            ExceptionUtility.Try(() =>
            {
                IEnumerable <string> stationNames, stationNumbers;
                this.GetSelectedStationsList(out stationNames, out stationNumbers);
                //var selectedStationIds = this.Device.Stations.Where((s) => s.Selected).Select((s) => s.Id);

                AlertUtility.ShowConfirmationAlert(StringLiterals.TestStationConfirmationTitle, StringLiterals.FormatTestStationConfirmationMessage(stationNames, stationNumbers), (b) =>
                {
                    if (b)
                    {
                        this.TestSelectedStationsConfirmed();
                    }
                }, okButtonText: StringLiterals.TestButtonText);
            });
        }