private void DeleteButton_Click(object sender, RoutedEventArgs e)
        {
            FrameworkElement elem = sender as FrameworkElement;

            if (elem == null)
            {
                return;
            }

            Extension extension = elem.DataContext as Extension;

            if (extension == null || string.IsNullOrWhiteSpace(extension.Name))
            {
                return;
            }

            MessageBoxDialog.Show(string.Format(ESRI.ArcGIS.Mapping.Builder.Resources.Strings.DeletingExtensionWillMakeItUnavailableForFurtherUse, System.Environment.NewLine), ESRI.ArcGIS.Mapping.Builder.Resources.Strings.ConfirmDelete, MessageBoxButton.OKCancel, (s, args) =>
            {
                if (args.Result == MessageBoxResult.OK)
                {
                    ApplicationBuilder.ApplicationBuilderClient client = WCFProxyFactory.CreateApplicationBuilderProxy();
                    client.DeleteExtensionLibraryCompleted            += new EventHandler <ApplicationBuilder.DeleteExtensionLibraryCompletedEventArgs>(client_DeleteExtensionLibraryCompleted);
                    client.DeleteExtensionLibraryAsync(extension.Name, extension);
                }
            });
        }
        public void AddFormulaData(object sender, EventArgs e)
        {
            string formulaName = m_View.GetFormulaName();

            if (formulaName == "")
            {
                MessageBoxDialog.Show(
                    StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_Msg_EmptyName, LanguageHelper.TrendViewer_Msg_EmptyName_EN),
                    StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_Msg_ErrTitle, LanguageHelper.TrendViewer_Msg_ErrTitle_EN),
                    MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }

            if (!FormulaNameValid(formulaName))  //means has duplicate names
            {
                MessageBoxDialog.Show(
                    StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_Msg_DuplicateName, LanguageHelper.TrendViewer_Msg_DuplicateName_EN),
                    StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_Msg_ErrTitle, LanguageHelper.TrendViewer_Msg_ErrTitle_EN),
                    MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }

            NotifyManager.GetInstance().Send(DataNotificaitonConst.AddFormula, m_View.ViewID, m_View.GetNewFormula());
            m_View.DestroyView();
        }
Exemplo n.º 3
0
        public bool CanAddDataPoint(string dataPoint)
        {
            bool bCanAdd = true;

            if (!m_model.IsOccLocation())
            {
                if (m_model.CheckConfiguredByOcc(dataPoint))
                {
                    //display messgae box
                    string messageTxt = StringHelper.GetInstance().getStringValue(FormCaptionHelper.OPCDATASELECTOR_CANADDDP_MSG, EnglishString.CAN_ADD_DATAPOINT_MSG);

                    if (MessageBoxDialog.Show(string.Format(messageTxt, dataPoint), "", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString() == "No")
                    {
                        bCanAdd = false;
                    }
                }
            }
            else
            {
                if (!m_model.CheckStationGrp(dataPoint, m_localIntervalGrpLocation))
                {
                    //Display message Box
                    string messageTxt = StringHelper.GetInstance().getStringValue(FormCaptionHelper.OPCDATASELECTOR_CANNOTADDDP_MSG, EnglishString.CANNOT_ADD_DATAPOINT_MSG);
                    MessageBoxDialog.Show(string.Format(messageTxt, dataPoint), "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    bCanAdd = false;
                }
            }
            return(bCanAdd);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Saves the selected Datapoint of the specified Sample Grp and Server name in database.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void okCmd_Click(object sender, EventArgs e)
        {
            string Function_Name = "okCmd_Click";

            try
            {
                if (m_localIntervalGrpID == "")
                {
                    return;
                }
                if (m_view.CheckSelectionListModified())
                {
                    EtyDataLogDPTrend SampleGrpEty = new EtyDataLogDPTrend();
                    SampleGrpEty.OPCSampleGrpId = Convert.ToDouble(m_localIntervalGrpID);
                    SampleGrpEty.Disabled       = true;
                    List <string>            selectedItems      = m_view.GetSelectedDataPoints();
                    List <EtyDataLogDPTrend> selectedDataPoints = new List <EtyDataLogDPTrend>();
                    for (int i = 0; i < selectedItems.Count; i++)
                    {
                        EtyDataLogDPTrend etyDataPoint = new EtyDataLogDPTrend();
                        etyDataPoint.Disabled         = false;
                        etyDataPoint.OPCSampleGrpId   = Convert.ToDouble(m_localIntervalGrpID);
                        etyDataPoint.OPCDataPointName = selectedItems[i];
                        selectedDataPoints.Add(etyDataPoint);
                    }
                    m_model.UpdateDataPoints(SampleGrpEty, selectedDataPoints);
                }
                MessageBoxDialog.Show(StringHelper.GetInstance().getStringValue(FormCaptionHelper.OPCDATASELECTOR_SAVE_MSG, EnglishString.SAVE_SUSSCCESSFUL_MSG));
            }
            catch (Exception localException)
            {
                LogHelper.Error(CLASS_NAME, Function_Name, localException.ToString());
            }
            m_view.Close();
        }
Exemplo n.º 5
0
        void ToggleMute()
        {
            try
            {
                if (Application.Current.MainWindow == null ||
                    Application.Current.MainWindow.DataContext == null)
                {
                    return;
                }

                var mainWindowViewModel = Application.Current.MainWindow.DataContext as MainWindowViewModel;
                if (mainWindowViewModel == null)
                {
                    return;
                }
                var mainContentViewModel = mainWindowViewModel.Content as MainContentViewModel;
                if (mainContentViewModel == null || mainContentViewModel.Volume == null)
                {
                    return;
                }

                mainContentViewModel.Volume.ToggleMute();
            }
            catch (Exception ex)
            {
                MessageBoxDialog.Show(ex.Message);
            }
        }
Exemplo n.º 6
0
        void AddPublicModules(ModulesItem modulesItem)
        {
            if ((modulesItem.Type != ModulesType.Pubilc &&
                 modulesItem.Type != ModulesType.Keys) ||
                CurrentPublicModules.Contains(modulesItem))
            {
                return;
            }
            CurrentPublicModules.Add(modulesItem);

            var keyModulesItem = GetKeyModulesItem(modulesItem);

            if (keyModulesItem != null)
            {
                try
                {
                    Generic.HotKeyHelper.Current.Set(keyModulesItem);
                    MainWindowModules.Current.SetKeys(keyModulesItem);
                }
                catch (NotImplementedException ex)
                {
                    MessageBoxDialog.Show(ex.Message);
                }
                catch (Exception)
                {
                }
            }
        }
Exemplo n.º 7
0
 public OpenXMLtoFlowDocument(string openxmlfilename)
 {
     if (Document.Editor.My.Computer.FileSystem.FileExists(openxmlfilename))
     {
         DocumentFormat.OpenXml.Validation.OpenXmlValidator validator = new DocumentFormat.OpenXml.Validation.OpenXmlValidator();
         int count = 0;
         //For Each [error] As Validation.ValidationErrorInfo In validator.Validate(WordprocessingDocument.Open(openxmlfilename, True))
         //    count += 1
         //    MessageBox.Show([error].Description)
         //Next
         if (count == 0)
         {
             OpenXMLFile = WordprocessingDocument.Open(openxmlfilename, true);
         }
         else
         {
             MessageBoxDialog m = new MessageBoxDialog("OpenXML File is invalid!", "Error", null, null);
             m.MessageImage.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Common/error32.png"));
             m.Owner = Document.Editor.My.Windows.MainWindow;
             m.ShowDialog();
         }
     }
     else
     {
         MessageBoxDialog m = new MessageBoxDialog("File Not Found!", "Error", null, null);
         m.MessageImage.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Common/error32.png"));
         m.Owner = Document.Editor.My.Windows.MainWindow;
         m.ShowDialog();
         throw new Exception();
     }
 }
Exemplo n.º 8
0
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Application.Startup"/> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.StartupEventArgs"/> that contains the event data.</param>
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            var mainWindow = new MainWindow();

            var enumerableNewsProvider      = new EnumerableNewsProvider();
            var fileNewsProvider            = new FileNewsProvider();
            var mouseClickEventNewsProvider = new MouseClickEventNewsProvider(mainWindow.ClickMeBorder);
            var newsFeedServiceClient       = new NewsFeedService.NewsFeedServiceClient();
            var timerNewsProvider           = new TimerNewsProvider(newsFeedServiceClient);
            var taskNewsProvider            = new TaskNewsProvider();
            var schedulerProvider           = new SchedulerProvider();
            var messageBoxDialog            = new MessageBoxDialog();
            var mainWindowViewModel         = new MainWindowViewModel(
                schedulerProvider,
                messageBoxDialog,
                enumerableNewsProvider,
                fileNewsProvider,
                mouseClickEventNewsProvider,
                timerNewsProvider,
                taskNewsProvider);

            mainWindow.DataContext = mainWindowViewModel;

            AllocConsole();
            mainWindow.Show();
        }
Exemplo n.º 9
0
        private void ProgressMsgBoxBtn_Click(object sender, RoutedEventArgs e)
        {
            ProgressMessageViewModel viewModel = new ProgressMessageViewModel()
            {
                Caption     = "Caption[Sample]",
                Header      = "Instruction Heading[Sample]",
                HeaderIcon  = MessageBoxWindowIcons.Information,
                Description = "Instruction[Sample]",
                Details     = "Additional Details Text[Sample]",
                FooterText  = "FooterText[Sample]",
                FooterIcon  = MessageBoxWindowIcons.Shield,
                IsDialog    = false
            };

            MessageBoxDialog.Show(viewModel);
            BackgroundWorker worker = new BackgroundWorker();

            worker.DoWork += (obj, evt) =>
            {
                for (int i = 0; i < 100; i++)
                {
                    Thread.Sleep(300);
                    viewModel.Percentage = i;
                }
            };
            worker.RunWorkerAsync();
        }
Exemplo n.º 10
0
 public void KeysConfirm()
 {
     try
     {
         var keySetting = new Models.KeySetting
         {
             ModulesKey   = ModulesList.SelectedItem.KeyModulesItem.ModulesItem.ModulesKey,
             ModifierKeys = temp_ModifierKeys,
             Key          = temp_Key,
             Type         = SelectKeyType,
             IsNotSetKey  = false
         };
         if (temp_ModifierKeys == ModifierKeys.None && temp_Key == Key.None)
         {
             keySetting.Type        = Enums.KeyType.Normal;
             keySetting.IsNotSetKey = true;
         }
         Modules.KeysModules.Current.SetKey(keySetting);
         GoBack();
     }
     catch (NotImplementedException ex)
     {
         MessageBoxDialog.Show(ex.Message);
     }
     catch (Exception)
     {
     }
 }
        public void CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            string Function_Name = "CellDoubleClick";

            if (e.RowIndex < 0)
            {
                return;
            }

            string markerName = m_View.GetMarkNameByRowIndex(e.RowIndex);

            try
            {
                if (e.ColumnIndex == 1)
                {
                    if (MessageBoxDialog.Show(
                            StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_Msg_DelConfirm, LanguageHelper.TrendViewer_Msg_DelConfirm_EN),
                            StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_Msg_SysMsg, LanguageHelper.TrendViewer_Msg_SysMsg_EN),
                            MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        DeleteByMarkerName(markerName);
                    }
                }
                else if (e.ColumnIndex == 0)
                {
                    EditMarker(markerName);
                }
            }
            catch (Exception localException)
            {
                LogHelper.Error(CLASS_NAME, Function_Name, localException.ToString());
            }
        }
Exemplo n.º 12
0
        private void dataPointListDataGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }

            string Function_Name             = "dataPointListDataGridView_CellDoubleClick";
            FormulaListController controller = (FormulaListController)getController();
            string formulaLblName            = formulaListDataGridView.Rows[e.RowIndex].Cells[2].Value.ToString();

            try
            {
                if (e.ColumnIndex == 7)
                {
                    if (
                        MessageBoxDialog.Show(
                            StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_Msg_DelConfirm, LanguageHelper.TrendViewer_Msg_DelConfirm_EN),
                            StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_Msg_SysMsg, LanguageHelper.TrendViewer_Msg_SysMsg_EN),
                            MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)

                    {
                        controller.DeleteByFormulaLblName(formulaLblName);
                    }
                }
                else if (e.ColumnIndex == 6)
                {
                    controller.EditFormula(formulaLblName);
                }
            }
            catch (Exception localException)
            {
                LogHelper.Error(CLASS_NAME, Function_Name, localException.ToString());
            }
        }
        /// <summary>
        /// This method saves edited or new sample Group into the database.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void SaveCommand(object sender, EventArgs e)
        {
            string Function_Name = "SaveCommand";

            try
            {
                EtyDataLogDPGroupTrend etyDPGrpTrend = m_view.GetEditFields();
                if (etyDPGrpTrend == null)
                {
                    return;
                }
                if (etyDPGrpTrend.NewData && IsOPCSampleGrpExist(etyDPGrpTrend.SampleGrpName, etyDPGrpTrend.LocationKey))
                {
                    MessageBoxDialog.Show(StringHelper.GetInstance().getStringValue(FormCaptionHelper.OPCSAMPLECONFIG_GRPEXISTS_MSG, EnglishString.MSG_NAME_EXIST));
                    return;
                }
                if (!etyDPGrpTrend.NewData)
                {
                    m_model.UpdateOPCSampleGrp(etyDPGrpTrend);
                }
                else
                {
                    m_model.InsertOPCSampleGrp(etyDPGrpTrend);
                }
                MessageBoxDialog.Show(StringHelper.GetInstance().getStringValue(FormCaptionHelper.OPCDATASELECTOR_SAVE_MSG, EnglishString.SAVE_SUSSCCESSFUL_MSG));
                //load all sample group from database
                m_loadFromDB = true;
                m_view.PopulateIntervalConfigDataGridView(2);
                m_view.Clear();
            }
            catch (Exception localException)
            {
                LogHelper.Error(CLASS_NAME, Function_Name, localException.ToString());
            }
        }
Exemplo n.º 14
0
        /// <summary>
        /// Method through which Form commuicates with its controller.
        /// </summary>
        /// <param name="ctl">Form controller</param>
        public override void  AttachListener(IController ctl)
        {
            string Function_Name = "AttachListener";

            LogHelper.Trace(CLASS_NAME, Function_Name, "Function_Entered");
            OPCSampleGrpConfigStartController controller = (OPCSampleGrpConfigStartController)ctl;
            //check the Database Connection
            bool bConnectionOpened = controller.GetDatabaseConnection();

            if (!bConnectionOpened)
            {
                LogHelper.Error("No Connection to Database. Closing the Form.");
                MessageBoxDialog.Show(StringHelper.GetInstance().getStringValue(FormCaptionHelper.OPCSAMPLECONFIG_NODATABASECONN_MSG, EnglishString.OPC_MSG_NODB));
                this.Close();
            }

            //set Current location
            LocationKeyHelper.GetInstance().init();
            this.LocationKeyTextBox.Text = LocationKeyHelper.GetInstance().LocationKey.ToString();
            this.saveMsgCmd.Click       += controller.SaveCommand;
            this.intervalConfigDataGridView.CellDoubleClick += controller.IntervalConfigDataGridView_CellDoubleClick;
            this.RefreshGridData   += controller.RetriveAllOPCGrp;
            this.RefreshPageNumber += controller.RetriveTotalCount;
            this.Paint             += controller.AddLoggerInterval_Paint_1;
            LogHelper.Trace(CLASS_NAME, Function_Name, "Function_Exited");
        }
        private void UploadButton_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.Filter      = "XAP Files|*.xap";
            dialog.Multiselect = false;

            if (dialog.ShowDialog() == true && dialog.File != null)
            {
                FileStream fileStream       = dialog.File.OpenRead();
                string     selectedFileName = dialog.File.Name;
                if (selectedFileName.EndsWith(".xap", StringComparison.OrdinalIgnoreCase))
                {
                    selectedFileName = selectedFileName.Substring(0, selectedFileName.Length - 4);
                }
                if (BuilderApplication.Instance.AllExtensions.FirstOrDefault <Extension>(ex => string.Compare(ex.Name, selectedFileName, StringComparison.InvariantCultureIgnoreCase) == 0) != null)
                {
                    MessageBoxDialog.Show(ESRI.ArcGIS.Mapping.Builder.Resources.Strings.ExtensionWithSameNameAlreadyExist, ESRI.ArcGIS.Mapping.Builder.Resources.Strings.ExtensionAlreadyExists, MessageBoxButton.OKCancel, (o, args) =>
                    {
                        if (args.Result == MessageBoxResult.OK)
                        {
                            validateXap(fileStream, onValidationComplete, dialog);
                        }
                        else
                        {
                            fileStream.Close();
                        }
                    });
                }
                else
                {
                    validateXap(fileStream, onValidationComplete, dialog);
                }
            }
        }
Exemplo n.º 16
0
        private static MessageBoxResult ShowDefault(Window owner, string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon)
        {
            var dlg = new MessageBoxDialog(caption, messageBoxText, button, icon);

            dlg.Owner = owner;
            dlg.ShowDialog();
            return(dlg.MessageBoxResult);
        }
        private void AddContentDialog_LayerAddFailed(object sender, ExceptionEventArgs e)
        {
            string paragraph    = ESRI.ArcGIS.Mapping.Builder.Resources.Strings.AddLayerFailedExplanation;
            string errorMessage = String.IsNullOrEmpty(e.Exception.Message) ? ESRI.ArcGIS.Mapping.Builder.Resources.Strings.AddLayerFailedNoDetails : e.Exception.Message;
            string fullMessage  = String.Format(paragraph, errorMessage);

            MessageBoxDialog.Show(fullMessage, ESRI.ArcGIS.Mapping.Builder.Resources.Strings.AddLayerFailed, MessageType.Error, MessageBoxButton.OK);
        }
Exemplo n.º 18
0
 public static bool StandardAskMsgBox(this Form aform, string aTitle, string aDescription = null)
 {
     using (var lMsgBox = MessageBoxDialog.GetAskBoxDialog(aTitle, aDescription, aform))
     {
         Log.Write(LogLevel.Info, "Question Dialog displayed.\r\nMsg: {0}", aTitle);
         return(lMsgBox.Execute());
     }
 }
    public static void Show(string title, string message, Action onDoneCallback)
    {
        MessageBoxDialog go = (UnityEngine.Object.Instantiate(Resources.Load(prefabePath)) as GameObject).GetComponent <MessageBoxDialog>();

        go.titleText.text   = title;
        go.messageText.text = message;
        go.OnDone          += onDoneCallback;
    }
Exemplo n.º 20
0
 public static bool StandardWarningMsgBoxAsk(this Form aform, string aTitle, string aDescription = null)
 {
     using (var lMsgBox = MessageBoxDialog.GetWarningBoxDialog(aTitle, aDescription, aform))
     {
         Log.Write(LogLevel.Warning, "Warning Dialog displayed.\r\nMsg: {0}", aTitle);
         return(lMsgBox.Execute());
     }
 }
Exemplo n.º 21
0
 public static void StandardErrorMsgBox(this Form aform, string aTitle, string aDescription = null)
 {
     using (var lMsgBox = MessageBoxDialog.GetErrorBoxDialog(aTitle, aDescription, aform))
     {
         lMsgBox.Execute();
         Log.Write(LogLevel.Error, "Error Dialog displayed.\r\nCaption: {0}\r\nMsg: {1}", aTitle, aDescription);
     }
 }
Exemplo n.º 22
0
 public static void StandardInfoMsgBox(this Form aform, string aTitle, string aDescription = null)
 {
     using (var lMsgBox = MessageBoxDialog.GetInfoBoxDialog(aTitle, aDescription, aform))
     {
         lMsgBox.Execute();
         Log.Write(LogLevel.Info, "Info Dialog displayed.\r\nMsg: {0}", aTitle);
     }
 }
Exemplo n.º 23
0
        private static void UIThreadExceptionHandler(object sender, ThreadExceptionEventArgs t)
        {
            MessageBoxDialog.Show(
                StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_Msg_UnhandledError, LanguageHelper.TrendViewer_Msg_UnhandledError_EN),
                StringHelper.GetInstance().getStringValue(LanguageHelper.TrendViewer_Msg_ErrTitle, LanguageHelper.TrendViewer_Msg_ErrTitle_EN),
                MessageBoxButtons.OK, MessageBoxIcon.Error);

            LogHelper.Error("TrendViewer.Program", "UIThreadExceptionHandler", t.Exception.ToString());
        }
Exemplo n.º 24
0
        /// <summary>
        /// Shows a message box dialog.
        /// </summary>
        /// <param name="message"></param>
        /// <param name="title"></param>
        public static async Task <ContentDialogResult> MsgBox(string message, string title)
        {
            var dialog = new MessageBoxDialog()
            {
                Title   = title,
                Content = message,
            };

            return(await dialog.ShowAsync());
        }
Exemplo n.º 25
0
 private void GhostSimpleFleet()
 {
     if (this.SimpleFleetWindow != null && this.SimpleFleetWindow.IsInitialized)
     {
         this.SimpleFleetWindow.IsGhostMode = !this.SimpleFleetWindow.IsGhostMode;
     }
     else
     {
         MessageBoxDialog.Show(string.Format("{0}{1}", TextResource.NeedToOpen, TextResource.SimpleFleet));
     }
 }
        private bool validateInput()
        {
            string applicationName = NameTextBox.Text.Trim();

            if (string.IsNullOrWhiteSpace(applicationName))
            {
                MessageBoxDialog.Show(ESRI.ArcGIS.Mapping.Builder.Resources.Strings.EnterNameForApplication, ESRI.ArcGIS.Mapping.Builder.Resources.Strings.InvalidName, MessageBoxButton.OK);
                return(false);
            }

            return(true);
        }
Exemplo n.º 27
0
        void MainWindow_Closing(object o, CancelEventArgs e)
        {
            if (!Data.Settings.Current.EnableExitTip)
            {
                return;
            }

            if (!MessageBoxDialog.Show(TextResource.Exit_Msg_Content, TextResource.Exit_Msg_Title))
            {
                e.Cancel = true;
            }
        }
Exemplo n.º 28
0
        void onGetConfigurationCompleted(object sender, GetConfigurationCompletedEventArgs e)
        {
            if (e.Map == null)
            {
                MessageBoxDialog.Show(ESRI.ArcGIS.Mapping.Builder.Resources.Strings.ErrorRetrievingMapDocumentForSite);
                return;
            }

            mapXaml         = new MapXamlWriter(true).MapToXaml(e.Map);
            btnOk.IsEnabled = true;
            BuilderApplication.Instance.HideWindow(chooseSiteControl);
        }
        /// <summary>
        /// Column Doubleclick Event Handler Function.
        /// Enable User to edit/delete/configDatapoints of the selected Sample Group.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void IntervalConfigDataGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            string Function_Name = "IntervalConfigDataGridView_CellDoubleClick";

            try
            {
                if (e.RowIndex < 0)
                {
                    return;
                }
                string localIntervalGrpID = m_view.GetDataGridValue(e.RowIndex, OPCSampleGrpConfigStart.OPCSAMPLEGRP_IDCOL_INDEX);

                //Load selected sample group in the edit group controls
                if (e.ColumnIndex == OPCSampleGrpConfigStart.OPCSAMPLEGRP_EDITCOLUMN_INDEX)
                {
                    LoadEditData(localIntervalGrpID);
                }

                // Deletes the selected sampel group and refresh the datagrid.
                else if (e.ColumnIndex == OPCSampleGrpConfigStart.OPCSAMPLEGRP_DELETECOLUMN_INDEX)
                {
                    string messageTxt = StringHelper.GetInstance().getStringValue(FormCaptionHelper.OPCSAMPLECONFIG_DELETEMSG, EnglishString.MSG_DELETE_CONFIRM);
                    if (MessageBoxDialog.Show(string.Format(messageTxt, m_view.GetDataGridValue(e.RowIndex, 1)),
                                              StringHelper.GetInstance().getStringValue(FormCaptionHelper.OPCSAMPLECONFIG_DELETEMSGTITLE, EnglishString.MSG_SYSTEM_TITLE), MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString() == "Yes")
                    {
                        bool result = m_model.DeleteOPCSampleGrp(localIntervalGrpID);
                        if (!result)
                        {
                            MessageBoxDialog.Show(StringHelper.GetInstance().getStringValue(FormCaptionHelper.OPCSAMPLECONFIG_DELETEFAILED_MSG, EnglishString.MSG_DELETE_MSG));
                        }
                        else
                        {
                            m_DPGroupTrendList.Remove(GetOPCSampleGrp(localIntervalGrpID));
                            m_view.PopulateIntervalConfigDataGridView(2);
                        }
                    }
                }

                // Opens the DataPoint selector form
                else if (e.ColumnIndex == OPCSampleGrpConfigStart.OPCSAMPLEGRP_CONFIGCOLUMN_INDEX)
                {
                    IView view = ViewManager.GetInstance().GetView(OPCDataSelector.OPCDATASELECTORFRM);
                    ((OPCDataSelectorController)view.getController()).m_localIntervalGrpID       = localIntervalGrpID;
                    ((OPCDataSelectorController)view.getController()).m_localIntervalGrpLocation = m_view.GetDataGridValue(e.RowIndex, OPCSampleGrpConfigStart.OPCSAMPLEGRP_LOCATIONNAME_INDEX);
                    view.PutObject(OPCDataSelector.PARENTINTERVALNAME, m_view.GetDataGridValue(e.RowIndex, OPCSampleGrpConfigStart.OPCSAMPLEGRP_NAMECOL_INDEX));
                    view.ShowView(true);
                }
            }
            catch (Exception localException)
            {
                LogHelper.Error(CLASS_NAME, Function_Name, localException.ToString());
            }
        }
        /// <summary>
        /// Returns sample group entity from edit related controls.
        /// </summary>
        /// <returns></returns>
        public EtyDataLogDPGroupTrend GetEditFields()
        {
            string Function_Name = "GetEditFields";

            LogHelper.Trace(CLASS_NAME, Function_Name, "Function_Entered");

            EtyDataLogDPGroupTrend etyDPGrpTrend = new EtyDataLogDPGroupTrend();

            if (dateTimePicker.Checked)
            {
                etyDPGrpTrend.StartTime = dateTimePicker.Value.ToString("HH:mm");
            }
            etyDPGrpTrend.IntervalType = DAOHelper.MINITE;

            if (intervalTypeBox.SelectedIndex == INTERVALETYPE_MINUTE_INDEX)
            {
                etyDPGrpTrend.IntervalType = DAOHelper.MINITE;
            }
            else if (intervalTypeBox.SelectedIndex == INTERVALETYPE_HOUR_INDEX)
            {
                etyDPGrpTrend.IntervalType = DAOHelper.HOUR;
            }
            else if (intervalTypeBox.SelectedIndex == INTERVALETYPE_SECOND_INDEX)
            {
                etyDPGrpTrend.IntervalType = DAOHelper.SECOND;
            }

            // etyOPCSampleGroup.IntervalType = intervalTypeBox.Text;
            etyDPGrpTrend.SampleGrpName        = intervalNameTextBox.Text.Trim();
            etyDPGrpTrend.SampleGrpDescription = intervalDescTextBox.Text;
            etyDPGrpTrend.Disabled             = disableCheckBox.Checked;
            etyDPGrpTrend.Interval             = (double)intervalUnitBox.Value;
            etyDPGrpTrend.DeltaValue           = (double)deltaValueBox.Value;
            etyDPGrpTrend.LocationKey          = Convert.ToDouble(LocationKeyTextBox.Text);
            if (intervalNameTextBox.Text == "")
            {
                MessageBoxDialog.Show(StringHelper.GetInstance().getStringValue(FormCaptionHelper.OPCSAMPLECONFIG_GRPNAMEMISSING_MSG, EnglishString.MSG_FOR_GRP_NAME));
                return(null);
            }

            /*if (intervalUnitBox.Value <= 0)
             * {
             *  MessageBoxDialog.Show(StringHelper.GetInstance().getStringValue(FormCaptionHelper.OPCSAMPLECONFIG_INTERVALEVALMISS_MSG, EnglishString.MSG_FOR_INTERVAL));
             *  return null;
             * }*/
            if (m_editIntervalGrpID == "")
            {
                etyDPGrpTrend.NewData = true;
            }
            LogHelper.Trace(CLASS_NAME, Function_Name, "Function_Exited");
            return(etyDPGrpTrend);
        }