Пример #1
0
        private void BtnLoadSqlServerTables_Click()
        {
            WaitDialog wd = null;

            try
            {
                wd = new WaitDialog();
                wd.Show();//not modal
            }
            catch
            {
                MessageBox.Show("Please restart the about window!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                wd.Close();
            }

            try
            {
                IDataService  controller = new DataService();
                List <string> tables     = controller.GetSqlServerTables(this.FormData.SqlServer, this.FormData.ServerInstance, this.FormData.ServerDatenbank,
                                                                         this.FormData.ServerVersion, this.FormData.ServerUser, this.FormData.ServerPasswort);
                this.FormData.Tables = tables;
                FormData.Table       = tables.FirstOrDefault();
            }
            catch (Exception ex)
            {
                MessageBox.Show("The legend table wasn't defined or the session has been canceled! " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                //this.staLblMessage.Content = "The legend table wasn't defined or the session has been canceled!";
            }

            wd.Close();
        }
Пример #2
0
 private void HandleServerResponse(ServerResponseEventArgs e)
 {
     this.Dispatcher.BeginInvoke(() =>
     {
         _wait.Close();
         // Sign Up Response
         var cmd = e.Tags.GetCommands().Where(c => c.TypeName == "SIGNUP").FirstOrDefault();
         if (cmd != null)
         {
             var success = cmd.GetArg <bool>(0);
             if (success)
             {
                 ScreenManager.SetScreen(new LoginScreen());
             }
             else
             {
                 SignupForm.ValidationSummary.Errors.Add(new ValidationSummaryItem(cmd.GetArg <string>(1)));
             }
         }
         else
         {
             SignupForm.ValidationSummary.Errors.Add(new ValidationSummaryItem("An error occured on the server preventing the registration from completing. The error information has been recorded and will be addressed ASAP. Please try back again soon or contact [email protected] for assistance."));
         }
     });
 }
Пример #3
0
        private void buttonQuery_Click(object sender, EventArgs e)
        {
            this.buttonQuery.Enabled = false;

            WaitDialog waitDialog = new WaitDialog("Loading", string.Empty, new Size(260, 70), this.AppForm());

            try
            {
                this.InitQueryOption();

                string dataType  = this.dataSelectRadioGroup.Properties.Items[this.dataSelectRadioGroup.SelectedIndex].Description;
                string timeUnit  = this.timeUnitComboBox.Text;
                string queryType = string.Format("{0} ({1})", dataType, timeUnit);

                waitDialog.SetCaption("Loading data...");
                var dataList = this.GetDataList(queryType);

                waitDialog.SetCaption(string.Format("Writing data... ({0} items)", dataList.Count()));
                this.SetMainView(dataList, queryType);
            }
            finally
            {
                if (waitDialog != null)
                {
                    waitDialog.Close(this);
                }
                waitDialog = null;

                this.buttonQuery.Enabled = true;
            }
        }
Пример #4
0
        private async Task Worker(CancellationToken tok)
        {
            await Task.Run(() =>
            {
                int x;
                int count = 100;

                this.BeginInvoke(() => { if (_dialog != null)
                                         {
                                             _dialog.MaxValue = count;
                                         }
                                 });

                for (x = 0; x < count; x++)
                {
                    tok.ThrowIfCancellationRequested();
                    this.BeginInvoke(() => { if (_dialog != null)
                                             {
                                                 _dialog.CurrentValue = x;
                                             }
                                     });
                    Thread.Sleep(100);
                }
                this.BeginInvoke(() => { if (_dialog != null)
                                         {
                                             _dialog.IsCancellable = true; _dialog.Close();
                                         }
                                 });
            });
        }
Пример #5
0
        private void ProcessResponse(RdlTagCollection tags)
        {
            bool       validLogin = false;
            RdlAuthKey key        = tags.Where(t => t.TagName == "AUTH").FirstOrDefault() as RdlAuthKey;

            if (key != null)
            {
                if (!String.IsNullOrEmpty(key.Key))
                {
                    validLogin = true;
                }

                // Check for persist login token.
                if (!String.IsNullOrEmpty(key.PersistLoginToken))
                {
                    StorageManager.SetPersistLoginToken(key.PersistLoginToken);
                }
            }

            this.Dispatcher.BeginInvoke(() =>
            {
                _waitDialog.Close();
            });

            if (validLogin)
            {
                Settings.UserAuthKey = key.Key;
                ScreenManager.SetScreen(new HomeScreen());
            }
            else
            {
                valMain.Errors.Add(new ValidationSummaryItem("The username/password combination you supplied is invalid. Please ensure caps lock is not on and try again."));
            }
        }
Пример #6
0
        public virtual bool OpenTuner()
        {
            /* display the wait message */
#if false
            WaitDialog waitDlg = new WaitDialog();
            waitDlg.Show();
            waitDlg.Refresh();
#endif


            try
            {
            }
            catch (BadImageFormatException e)
            {
                ErrorMessage = "Unsupported architecture.";


                base.Close();
                return(false);
            }
            catch (Exception e)
            {
                ErrorMessage = "Unhandled exception." + Environment.NewLine + e;

                base.Close();
                return(false);
            }
            ErrorMessage = "";

            SelectFiles(true);

            Connected = true;


            /* close wait dialog and show ours */
#if false
            waitDlg.Close();
#endif

            Show();

            radioAcqOff.Checked = true;
            radioTuner.Checked  = true;
            radioAgcOff.Checked = true;
            chkAtt.Checked      = false;
            chkPreAmp.Checked   = false;

            radioTuner_CheckedChanged(null, null);
            chkAtt_CheckedChanged(null, null);
            chkPreAmp_CheckedChanged(null, null);
            radioAgcOff_CheckedChanged(null, null);

            radioAcqBlock.Checked = true;

            return(true);
        }
Пример #7
0
 static void AsynchronousMethod()
 {
     waitDialog.Show();
     while (!isEnd)
     {
         Thread.Sleep(10);
         Application.DoEvents();
     }
     waitDialog.Close();
 }
Пример #8
0
        private void ProcessCommands(RdlTagCollection tags)
        {
            List <RdlCommand> commands = tags.GetCommands();

            if (commands != null && commands.Count > 0)
            {
                foreach (var cmd in commands)
                {
                    if (cmd.TypeName.Equals("EXIT"))
                    {
#if DEBUG
                        StorageManager.WriteError(String.Format("[ {0} ]{1}{2}", DateTime.Now, Environment.NewLine, cmd.ToString()));
#endif
                        ScreenManager.SetScreen(new GameOfflineScreen());
                        //System.Windows.Browser.HtmlPage.Window.Eval("window.location.reload();");
                    }
                    if (cmd.TypeName.Equals("CHECKROLE"))
                    {
                        // Args:
                        // 0 = role
                        // 1 = is in role
                        Settings.Role = cmd.GetArg <string>(0);
                        bool isInRole = cmd.GetArg <bool>(1);
                        if (!String.IsNullOrEmpty(Settings.Role) && Settings.Role.ToLower().Equals("god") && isInRole)
                        {
                            btnAdmin.Visibility = Visibility.Visible;
                        }
                        else
                        {
                            btnAdmin.Visibility = Visibility.Collapsed;
                        }
                    }
                    if (cmd.TypeName.Equals("CONNECT"))
                    {
                        if (_hasErrors)
                        {
                            _waitDialog.HasCloseButton = true;
                        }
                        else
                        {
                            _waitDialog.Close();
                        }
                    }
                }
            }
        }
Пример #9
0
        /// <summary>
        /// Opens a new <see cref="ConfigurationSourceModel"/> from a file the user specifies.
        /// </summary>
        public void OpenConfigurationSource()
        {
            if (!PromptSaveChangesIfDirtyAndContinue())
            {
                return;
            }

            var dialog = new OpenFileDialog()
            {
                Title       = Resources.OpenConfigurationFileDialogTitle,
                DefaultExt  = "*.config",
                Multiselect = false,
                Filter      = Resources.OpenConfigurationFileDialogFilter,
                FilterIndex = 0
            };

            var result = uiService.ShowFileDialog(dialog);

            if (result.DialogResult == true)
            {
                var waitDialog = new WaitDialog
                {
                    Message = string.Format(CultureInfo.CurrentCulture, Resources.ApplicationLoadingConfigurationFileWaitMessage, result.FileName)
                };
                uiService.ShowWindow(waitDialog);
                try
                {
                    environments.Clear();
                    Load(result.FileName);
                }
                finally
                {
                    waitDialog.Close();
                }
            }
        }
            /*------------------------------------------------------------------------------------**/
            /// <summary>
            /// Import
            /// </summary>
            /// <param name="unparsed"></param>
            /*--------------+---------------+---------------+---------------+---------------+------*/
            public static void Import
            (
                string unparsed
            )
            {
                if (string.IsNullOrEmpty(unparsed))
                {
                    WorkspaceUtilities.DisplayErrorMessage(LocalizableStrings.BadImportCommand, LocalizableStrings.ImportCommandFormat);
                    return;
                }

                BMECApi.Instance.ClearActivePlacementTool();  // exit current placement tool
                IECClass ecClass = SchemaUtilities.PlantSchema.GetClass(unparsed.Trim());

                if (ecClass == null)
                {
                    WorkspaceUtilities.DisplayErrorMessage(string.Format(LocalizableStrings.BadClassName, unparsed.Trim()), "");
                    return;
                }

                BMECInstanceManager instanceManager = BMECApi.Instance.InstanceManager;

                OpenFileDialog openFileDlg = new OpenFileDialog();

                openFileDlg.Multiselect = false;
                openFileDlg.Filter      = "Import data file|*.txt";
                openFileDlg.ShowDialog();
                if (string.IsNullOrEmpty(openFileDlg.FileName))
                {
                    return;
                }

                if (!IsImportFileValidFormat(openFileDlg.FileName, ecClass))
                {
                    return;
                }

                System.IO.StreamReader sr = System.IO.File.OpenText(openFileDlg.FileName);

                ArrayList associations   = new ArrayList();
                ArrayList propertyValues = new ArrayList();


                WaitDialog wtDlg = new WaitDialog();

                wtDlg.SetTitleString(LocalizableStrings.ImportingInstances);
                wtDlg.SetInformationSting(LocalizableStrings.ImportingInstancesInfo);
                wtDlg.Show();

                string lineRead = sr.ReadLine().Trim();

                while (!sr.EndOfStream)
                {
                    Application.DoEvents();
                    if (string.IsNullOrEmpty(lineRead))
                    {
                        lineRead = sr.ReadLine().Trim();
                        continue;
                    }
                    if (lineRead == "[Associations]")
                    {
                        associations.Clear();
                        while (!sr.EndOfStream)
                        {
                            lineRead = sr.ReadLine().Trim();
                            if (string.IsNullOrEmpty(lineRead))
                            {
                                continue;
                            }

                            if (lineRead == "[InstanceData]")
                            {
                                break;
                            }

                            associations.Add(lineRead);
                        }
                    }

                    if (lineRead == "[InstanceData]")
                    {
                        propertyValues.Clear();
                        while (!sr.EndOfStream)
                        {
                            lineRead = sr.ReadLine().Trim();
                            if (lineRead == "[InstanceData]")
                            {
                                break;
                            }

                            if (lineRead == "[Associations]")
                            {
                                break;
                            }

                            if (string.IsNullOrEmpty(lineRead))
                            {
                                continue;
                            }

                            propertyValues.Add(lineRead);
                        }

                        IECInstance ecInstance = instanceManager.CreateECInstance(ecClass.Name);
                        BMECApi.Instance.SpecProcessor.FillCurrentPreferences(ecInstance, true);
                        ecInstance.InstanceId = "mechanical";
                        ECInstanceDialog ecDlg = new ECInstanceDialog(ecInstance);
                        ecDlg.InitializeWithCustomProperties(associations, propertyValues, true);
                        ecDlg.SaveData();
                    }
                }
                wtDlg.Close();
                sr.Close();
            }
Пример #11
0
 void closeForm()
 {
     defaultSplashScreen.Close();
     //defaultSplashScreen.Dispose();
 }
Пример #12
0
        public virtual bool OpenTuner()
        {
            /* display the wait message */
#if false
            WaitDialog waitDlg = new WaitDialog();
            waitDlg.Show();
            waitDlg.Refresh();
#endif

            USBRX = new USBRXDevice();
            //USBRX.ShowConsole(true);
            USBRX.TunerCombination = TunerCombination;

            try
            {
                if (!USBRX.Init())
                {
                    ErrorMessage = "Could not find USB-RX on USB.";
#if false
                    waitDlg.Close();
#endif
                    base.Close();
                    return(false);
                }
            }
            catch (BadImageFormatException e)
            {
                ErrorMessage = "Unsupported architecture.";
#if false
                waitDlg.Close();
#endif
                base.Close();
                return(false);
            }
            catch (Exception e)
            {
                ErrorMessage = "Unhandled exception." + Environment.NewLine + e;
#if false
                waitDlg.Close();
#endif
                base.Close();
                return(false);
            }
            ErrorMessage = "";

            FilterList.NCOFreq = USBRX.Atmel.TCXOFreq;
            FilterList.UpdateFilters("Filter");
            FilterList.AddFilters("..\\..\\..\\Filter");
            FilterList.FilterSelected += new EventHandler(FilterList_FilterSelected);

            USBRX.Tuner.SamplingRateChanged     += new EventHandler(Tuner_FilterRateChanged);
            USBRX.Tuner.FilterWidthChanged      += new EventHandler(Tuner_FilterWidthChanged);
            USBRX.Tuner.InvertedSpectrumChanged += new EventHandler(Tuner_InvertedSpectrumChanged);
            USBRX.Tuner.DeviceDisappeared       += new EventHandler(Tuner_DeviceDisappeared);

            frequencySelector1.UpperLimit = USBRX.Tuner.HighestFrequency;
            frequencySelector1.LowerLimit = USBRX.Tuner.LowestFrequency;
            CurrentFrequency = USBRX.Tuner.GetFrequency();
            SetFreqTextbox(CurrentFrequency);

            _SampleSource = new ShmemSampleSource("USB-RX Device Control", USBRX.ShmemChannel, 1, 0);
            _SampleSource.InvertedSpectrum = InvertedSpectrum;
            _SampleSource.DataFormat       = ByteUtil.eSampleFormat.Direct16BitIQFixedPointLE;

            ToolTip ttFreq = new ToolTip();
            ttFreq.SetToolTip(frequencySelector1, "Min Freq: " + FrequencyFormatter.FreqToStringAccurate(USBRX.Tuner.LowestFrequency) + Environment.NewLine + "Max Freq: " + FrequencyFormatter.FreqToStringAccurate(USBRX.Tuner.HighestFrequency));
            ttFreq.AutomaticDelay = 500;

            UpdateAtmelFilters();
            SelectFiles(true);

            Connected = true;

            /* small hack to select first (widest) filter */
            FilterList.FilterSelect(FilterList.FirstFilter);

            /* close wait dialog and show ours */
#if false
            waitDlg.Close();
#endif

            Show();

            radioAcqOff.Checked   = true;
            radioTunerInt.Checked = true;
            radioAgcOff.Checked   = true;
            chkAtt.Checked        = false;
            chkPreAmp.Checked     = false;

            radioTunerInt_CheckedChanged(null, null);
            chkAtt_CheckedChanged(null, null);
            chkPreAmp_CheckedChanged(null, null);
            radioAgcOff_CheckedChanged(null, null);

            radioAcqBlock.Checked = true;


            DeviceOpened?.Invoke(this, EventArgs.Empty);

            return(true);
        }