Пример #1
0
        public NewUserRegistrationFormModel()
        {
            Page    = new NewUserRegistrationFormView(this);
            BtnSave = new DelegateCommand((obj) =>
            {
                if (!Checking)
                {
                    ErrorForm?.Invoke("Вы не заполнили обязательные поля");
                    return;
                }


                if (Password != PasswordChecking)
                {
                    ErrorForm?.Invoke("Ой, пароли не совпадают");
                    return;
                }

                SuccesCompletionForm.Invoke(new NewUserRegistration()
                {
                    Login    = Login,
                    Name     = Name,
                    Password = Password,
                    Phone    = Phone
                });
            });
            BtnCancel = new DelegateCommand((obj) => CancelForm?.Invoke());
        }
Пример #2
0
        protected override void OnClick()
        {
            var bufZonesLayer = new BufZonesLayer {
                IsAVR = m_MapImage.Parent is AvrMapControl
            };

            if (bufZonesLayer.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    var eidssUserBufZoneLayer = UserDbLayersManager.CreateBufZoneLayer(bufZonesLayer.ZoneLayerName,
                                                                                       bufZonesLayer.Description,
                                                                                       bufZonesLayer.PivotalLayer);
                    //MapImage.Map.Layers.Add(eidssUserBufZoneLayer);

                    if (OnCreateBufZone != null)
                    {
                        OnCreateBufZone(new KeyValuePair <Guid, string>(eidssUserBufZoneLayer.LayerDbGuid,
                                                                        eidssUserBufZoneLayer.LayerName));
                    }
                    //MapControl.RefreshContent();
                    MapImage.Refresh();
                    //ZoneLayerStorage.UpdateZoneLayerDict(); //not need more
                }
                catch (Exception ex)
                {
                    ErrorForm.ShowError(ex);
                }
            }
        }
Пример #3
0
 private void ButtonClicked(Object sender, EventArgs eventArgs)
 {
     Debug.WriteLine("Button clicked");
     if (Connectivity.NetworkAccess == NetworkAccess.Internet)
     {
         if (this.IsValid())
         {
             if (twitterService.Authenticate(this.user))
             {
                 this.ErrorForm.ErrorLabel.IsVisible = false;
                 this.Navigation.PushAsync(new TweetsListView());
             }
             else
             {
                 this.ErrorForm.Error = "utilisateur inconnu";
                 this.ErrorForm.Show();
             }
         }
     }
     else
     {
         ErrorForm.Error = "Veuillez vous connecter à internet";
         ErrorForm.Show();
     }
 }
Пример #4
0
        private async void submitButton_Click(object sender, EventArgs e)
        {
            string validateResult = validate();

            if (!validateResult.Equals(""))
            {
                ErrorForm errorForm = new ErrorForm(validateResult, "Ошибка валидации", false);
                errorForm.ShowDialog(Owner);
            }
            else
            {
                string resultString = await Task.Run(() => ApiRequests.LoginPost(emailTextBox.Text,
                                                                                 MD5Handler.GetMd5Hash(passwordTextBox.Text)));

                bool result = Parser.ResultParse(resultString);
                if (result)
                {
                    //добавить что-то дополнительное об успешности
                    Memory.isAuth = true;
                    Settings.SaveSettingsCrypt();
                    changeToMain();
                }
                else
                {
                    Error("Авторизация не удалась", closeApp: false);
                }
            }
        }
Пример #5
0
        public static void alert(string str, int isBarcode)
        {
            ErrorForm Errorform = new ErrorForm();

            Errorform.errormessage = str;
            Errorform.ShowDialog();
        }
Пример #6
0
 private static void OnError(Exception e)
 {
     using (ErrorForm errorForm = new ErrorForm(Application.ProductName, e, DebugHelper.Logger, LogFilePath, Links.URL_ISSUES))
     {
         errorForm.ShowDialog();
     }
 }
        private bool CheckForErrors()
        {
            if ((string.IsNullOrWhiteSpace(NameTextBox.Text) || string.IsNullOrWhiteSpace(LastNameTextBox.Text) ||
                 string.IsNullOrWhiteSpace(SexComboBox.Text) ||
                 string.IsNullOrWhiteSpace(ClassComboBox.Text)))
            {
                var fieldsError = new ErrorForm("You are missing some required fields!");
                fieldsError.ShowDialog();
                return(false);
            }

            var studentToUpdate = _studentRepository.GetAllStudents()
                                  .First(student => student.ToString() == _selectedStudent);

            if (studentToUpdate.Name == NameTextBox.Text && studentToUpdate.LastName == LastNameTextBox.Text &&
                studentToUpdate.SchoolClass == (SchoolClass)Enum.Parse(typeof(SchoolClass), ClassComboBox.Text))
            {
                return(true);
            }


            if (_studentRepository.GetAllStudents().FirstOrDefault(student =>
                                                                   student.Name == NameTextBox.Text && student.LastName == LastNameTextBox.Text &&
                                                                   student.SchoolClass == (SchoolClass)Enum.Parse(typeof(SchoolClass), ClassComboBox.Text)) ==
                null)
            {
                return(true);
            }
            var existingStudent = new ErrorForm("That student already exists!");

            existingStudent.ShowDialog();
            return(false);
        }
Пример #8
0
 private void DeleteButtonClick(object sender, EventArgs e)
 {
     if (!(studentsListBox.SelectedItem is Student selectedStudent))
     {
         var errorForm = new ErrorForm("You have to select student");
         errorForm.ShowDialog();
     }
Пример #9
0
 // Creates the error message and displays it.
 private DialogResult ShowThreadExceptionDialog(Exception e)
 {
     try
     {
         if (e is DbModelTimeoutException)
         {
             ErrorForm.ShowWarning("msgTimeoutList", "Cannot retrieve records from database because of the timeout. Please change search criteria and try again");
         }
         else if (!SqlExceptionHandler.Handle(e))
         {
             ErrorForm.ShowError(StandardError.UnprocessedError, e);
         }
     }
     catch (Exception e1)
     {
         Dbg.Debug("application error: {0} ", e.ToString());
         if (e.InnerException != null)
         {
             Dbg.Debug("Inner exception: {0} ", e.InnerException.ToString());
         }
         Dbg.Debug("error during displaying application error: {0} ", e1.ToString());
         return(MessageForm.Show(e.Message, "Application Error", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Stop));
     }
     if (BaseFormManager.MainForm == null || !((MainForm)BaseFormManager.MainForm).m_Loaded)
     {
         return(DialogResult.Abort);
     }
     return(DialogResult.Ignore);
 }
Пример #10
0
 /// <summary>
 /// Display Exception
 /// </summary>
 public static void ShowErrorForm(Exception exception)
 {
     using (var form = new ErrorForm(exception))
     {
         form.ShowDialog();
     }
 }
Пример #11
0
        private void pictureBox1_Click_1(object sender, EventArgs e)
        {
            ProcessManagement.TriggerTaskmanager(false);

            ProcessManagement.TaskManagerIsRunning();

            if (label4.Text.Equals("Scanning"))
            {
                ErrorForm ef = new ErrorForm();
                ef.label2.Text = "Game is running!";
                ef.Show();
                return;
            }

            if (label4.Text.Equals("Uploading"))
            {
                ErrorForm ef = new ErrorForm();
                ef.label2.Text = "Please wait until uploading ends!";
                ef.Show();
                return;
            }

            ProcessManagement.TriggerTaskmanager(true);

            notifyIcon1.Visible = false;

            if (Directory.Exists(Core.AppPath + "acscreens\\") == true)
            {
                DirectoryInfo di = new DirectoryInfo(Core.AppPath + "acscreens\\");
                di.Delete(true);
            }

            Environment.Exit(0);
        }
Пример #12
0
        private void exitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ProcessManagement.TriggerTaskmanager(false);

            ProcessManagement.TaskManagerIsRunning();

            if (label4.Text.Equals("Scanning"))
            {
                ErrorForm ef = new ErrorForm();
                ef.label2.Text = "Game is running!";
                ef.Show();
                return;
            }

            if (label4.Text.Equals("Uploading"))
            {
                ErrorForm ef = new ErrorForm();
                ef.label2.Text = "Please wait until uploading ends!";
                ef.Show();
                return;
            }

            ProcessManagement.TriggerTaskmanager(true);

            notifyIcon1.Visible = false;

            Environment.Exit(0);
        }
Пример #13
0
        /// <summary>
        /// 打开一个报错窗口,并传递错误信息
        /// </summary>
        /// <param name="error">错误信息</param>
        public static void Get(string error)
        {
            ErrorForm page = new ErrorForm();

            page.SetError(error);
            page.ShowDialog();
        }
Пример #14
0
        private void editItemButton_Click(object sender, EventArgs e)
        {
            string convertedImage = ImageClass.prepareImageToString(imgLocation);

            if (ValidateForm().Keys.First())
            {
                ItemModel model = new ItemModel(
                    editItemItemText.Text,
                    editItemAssetText.Text,
                    editItemArrivedText.Text,
                    editItemInvoiceText.Text,
                    editItemCcdText.Text,
                    editItemNameRusText.Text,
                    editItemPositionCcdText.Text,
                    editItemStatusText.Text,
                    editItemBoxText.Text,
                    editItemContainerText.Text,
                    editItemCommentText.Text,
                    convertedImage
                    );

                ApiHelpers.ApiConnectorHelper.EditData <ItemModel>(item_id.ToString(), model, pathItemsEdit);
            }
            else
            {
                ErrorForm errorForm = new ErrorForm(ValidateForm().Values.First());
                errorForm.Show();
            }
        }
        private bool CheckForErrors()
        {
            if (string.IsNullOrWhiteSpace(NameTextBox.Text))
            {
                var fieldsError = new ErrorForm("You are missing some required fields!");
                fieldsError.ShowDialog();
                return(false);
            }

            var publisherToUpdate = _publisherRepository.GetAllPublishers()
                                    .First(publisher => publisher.ToString() == _selectedPublisher);

            if (publisherToUpdate.Name == NameTextBox.Text)
            {
                Close();
                return(false);
            }

            if (_publisherRepository.GetAllPublishers()
                .FirstOrDefault(publisher => publisher.Name == NameTextBox.Text) == null)
            {
                return(true);
            }
            var existingPublisher = new ErrorForm("That publisher already exists!");

            existingPublisher.ShowDialog();
            return(false);
        }
Пример #16
0
 private static void OnError(Exception e)
 {
     using (ErrorForm errorForm = new ErrorForm(e.Message, $"{e}\r\n\r\n{TitleLong}", LogsFilePath, Links.URL_ISSUES))
     {
         errorForm.ShowDialog();
     }
 }
Пример #17
0
 private static void OnError(Exception e)
 {
     using (ErrorForm errorForm = new ErrorForm(e, LogsFilePath, Links.URL_ISSUES))
     {
         errorForm.ShowDialog();
     }
 }
Пример #18
0
 public RegistryEditorControl()
 {
     try
     {
         InitializeComponent();
         if (!DesignMode)
         {
             _localMachine32 = new UtilsRegistry(Registry.LocalMachine, @"Software\Microsoft\Office");
             _currentUser32 = new UtilsRegistry(Registry.CurrentUser, @"Software\Microsoft\Office");
             if (Is64Bit)
             { 
                 _localMachine64 = new UtilsRegistry(Registry.LocalMachine, @"Software\Wow6432Node\Microsoft\Office");
                 _currentUser64 = new UtilsRegistry(Registry.CurrentUser, @"Software\Wow6432Node\Microsoft\Office");
             }
             _userIsAdmin = IsAdministrator();
             pictureBoxNoAdminHint.Visible = !_userIsAdmin;
             labelNoAdminHint.Visible = !_userIsAdmin;
             labelNoAdminHintIcon.Visible = !_userIsAdmin;
         }
     }
     catch (Exception exception)
     {
         ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
         errorForm.ShowDialog(this);
     }
 }
 /// <summary>
 /// Display Exception
 /// </summary>
 public static void ShowErrorForm(Exception exception)
 {
     using(var form = new ErrorForm(exception))
     {
         form.ShowDialog();
     }
 }
Пример #20
0
        public AddinGuardControl()
        {
            try
            {
                InitializeComponent();
                if (!DesignMode)
                {
                    panelDeactivatedElements.Location = panelRegistryValues.Location;
                    panelDeactivatedElements.Size = panelRegistryValues.Size;

                    labelColorLegendCaption.Location = labelIconLegendCaption.Location;
                    splitContainer1.Panel2.Controls.Add(panelInfos);
                    panelInfos.Location = panelRegistryValues.Location;
                    panelInfos.Size = panelRegistryValues.Size;
                    panelInfos.Visible = true;

                    panelColorLegend.Location = panelIconLegend.Location;
                    panelColorLegend.Size = panelIconLegend.Size;

                    _controller = new WatchController();
                    _controller.PropertyChanged += new PropertyChangedEventHandler(_controller_PropertyChanged);
                    _controller.WatchNotify.MessageFired += new EventHandler(WatchNotify_MessageFired);

                    pictureBoxNoAdmin.Visible = !IsAdministrator();
                    labelNoAdminHint.Visible = !IsAdministrator();
                    labelNoAdminHintIcon.Visible = !IsAdministrator();
                    _controller.ReadOnlyModeForMachineKeys = !IsAdministrator();
                }
            }
            catch (Exception exception)
            {
                ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
                errorForm.ShowDialog(this);
            }
        }
Пример #21
0
 public RegistryEditorControl()
 {
     try
     {
         InitializeComponent();
         if (!DesignMode)
         {
             _localMachine32 = new UtilsRegistry(Registry.LocalMachine, @"Software\Microsoft\Office");
             _currentUser32  = new UtilsRegistry(Registry.CurrentUser, @"Software\Microsoft\Office");
             if (Is64Bit)
             {
                 _localMachine64 = new UtilsRegistry(Registry.LocalMachine, @"Software\Wow6432Node\Microsoft\Office");
                 _currentUser64  = new UtilsRegistry(Registry.CurrentUser, @"Software\Wow6432Node\Microsoft\Office");
             }
             _userIsAdmin = IsAdministrator();
             pictureBoxNoAdminHint.Visible = !_userIsAdmin;
             labelNoAdminHint.Visible      = !_userIsAdmin;
             labelNoAdminHintIcon.Visible  = !_userIsAdmin;
         }
     }
     catch (Exception exception)
     {
         ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
         errorForm.ShowDialog(this);
     }
 }
Пример #22
0
 private void treeViewRegistry_BeforeExpand(object sender, TreeViewCancelEventArgs e)
 {
     try
     {
         if ((e.Node.Nodes.Count > 0) && ("#stub" == e.Node.Nodes[0].Text))
         {
             e.Node.Nodes.Clear();
             string           fullPath = GetFullNodePath(e.Node);
             UtilsRegistryKey key      = new UtilsRegistryKey(GetRegistry(e.Node), fullPath);
             ShowRegNodeChilds(key, e.Node);
         }
         else if (null != e.Node.Tag)
         {
             e.Node.Nodes.Clear();
             string           fullPath = GetFullNodePath(e.Node);
             UtilsRegistryKey key      = new UtilsRegistryKey(GetRegistry(e.Node), fullPath);
             ShowRegNodeChilds(key, e.Node);
         }
     }
     catch (Exception exception)
     {
         ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
         errorForm.ShowDialog(this);
     }
 }
Пример #23
0
        public void ShowWarningTest()
        {
            const string str        = "ErrUserNotFound";
            const string defaultStr = "Username Not Found.";

            ErrorForm.ShowWarning(str, defaultStr);
        }
Пример #24
0
 /// <summary>
 /// Removes all event (AVR) layers from map control
 /// </summary>
 public void RemoveAllEventLayers()
 {
     try
     {
         for (var i = 0; i < Map.Layers.Count; i++)
         {
             var l = (Layer)(Map.Layers[i]);
             if ("eventgroup".Equals(l.Tag) /*Map.Layers[i] is EventLayer*/)
             {
                 //Map.Layers.Remove(((EventLayer) Map.Layers[i]).LabelLayer);
                 Map.Layers.Remove(Map.Layers[i]);
                 if (i >= 2)
                 {
                     i = i - 2;
                 }
                 else
                 {
                     i--;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         ErrorForm.ShowError("ErrAVRLayerRemoving", "", ex);
     }
 }
Пример #25
0
        public void ShowMessageTest()
        {
            const string errResourceName = "ErrUserNotFound";
            const string errMsg          = "Username Not Found.";

            ErrorForm.ShowMessage(errResourceName, errMsg);
        }
Пример #26
0
        public void ShowErrorDirectTest()
        {
            const string errResourceName = "errSqlServerNotFound";
            var          args            = new[] { "Sql2005" };

            ErrorForm.ShowErrorDirect(errResourceName, args);
        }
 private void SaveData(bool confirmSave)
 {
     try
     {
         POP3_Settings pOP = this.m_pVirtualServer.SystemSettings.POP3;
         pOP.Enabled                 = this.m_pEnabled.Checked;
         pOP.GreetingText            = this.m_pGreetingText.Text;
         pOP.SessionIdleTimeOut      = (int)this.m_pSessionTimeout.Value;
         pOP.MaximumConnections      = (int)this.m_pMaxConnections.Value;
         pOP.MaximumConnectionsPerIP = (int)this.m_pMaxConnsPerIP.Value;
         pOP.MaximumBadCommands      = (int)this.m_pMaxBadCommands.Value;
         List <IPBindInfo> list = new List <IPBindInfo>();
         foreach (ListViewItem listViewItem in this.m_pTabGeneral_Bindings.Items)
         {
             list.Add((IPBindInfo)listViewItem.Tag);
         }
         pOP.Binds = list.ToArray();
         if (this.m_pVirtualServer.SystemSettings.HasChanges && (!confirmSave || MessageBox.Show(this, "You have changes settings, do you want to save them ?", "Confirm:", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes))
         {
             this.m_pVirtualServer.SystemSettings.Commit();
         }
     }
     catch (Exception x)
     {
         ErrorForm errorForm = new ErrorForm(x, new StackTrace());
         errorForm.ShowDialog(this);
     }
 }
Пример #28
0
 private void ShowError(object sender, ValidationEventArgs args)
 {
     if (!m_ValidatingRow)
     {
         ErrorForm.ShowWarningFormat(args.MessageId, null, args.Pars);
     }
 }
Пример #29
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // Controller.
            Controller controller = new Controller();

            // GUI.
            EnterForm enterForm  = new EnterForm();
            ChatForm  chatWindow = new ChatForm();
            ErrorForm errorForm  = new ErrorForm();

            controller.EnterForm          = enterForm;
            controller.UserList           = chatWindow;
            controller.TextMessageInput   = chatWindow;
            controller.TextMessageOutput  = chatWindow;
            controller.UserJoinHandler    = chatWindow;
            controller.UserLeaveHandler   = chatWindow;
            controller.ErrorMessageOutput = errorForm;

            enterForm.ConnectionController   = controller;
            chatWindow.TextMessageController = controller;
            chatWindow.ConnectionController  = controller;
            chatWindow.SoundInputController  = controller;
            chatWindow.SoundOutputController = controller;

            // Sound.
            AudioOutput <string> audioOutput     = new AudioOutput <string>();
            MicrophoneInput      microphoneInput = new MicrophoneInput();

            controller.SoundOutput = audioOutput;
            controller.SoundInput  = microphoneInput;

            // Networking.
            ServiceConnector serviceConnector = new ServiceConnector();

            controller.TextSender        = serviceConnector;
            controller.SoundSender       = serviceConnector;
            controller.ConnectionHandler = serviceConnector;

            serviceConnector.UserController        = controller;
            serviceConnector.SoundController       = controller;
            serviceConnector.TextMessageController = controller;
            serviceConnector.DisconnectController  = controller;

            // Text processing.
            MessageTransformer  messageTransformer  = new MessageTransformer();
            NicknameTransformer nicknameTransformer = new NicknameTransformer();
            MessageVerifier     messageVerifier     = new MessageVerifier(possibleLength: PossibleLength);
            NicknameVerifier    nicknameVerifier    = new NicknameVerifier();

            controller.MessageTransformer  = messageTransformer;
            controller.NicknameTransformer = nicknameTransformer;
            controller.MessageVerifier     = messageVerifier;
            controller.NicknameVerifier    = nicknameVerifier;

            Application.Run(new MessengerAppContext(enterForm, chatWindow, errorForm));
        }
    private static void ShowErrorForm(object arg)
    {
        ErrorFormParams errorFormParams = (ErrorFormParams)arg;
        ErrorForm       form            = new ErrorForm(errorFormParams.ErrorNumber, errorFormParams.OkButtonText, errorFormParams.Message, errorFormParams.Sql, errorFormParams.Location);

        form.ShowDialog();
        Application.DoEvents();
    }
Пример #31
0
        static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            string message = GetExceptionMessage(e);
            var    form    = new ErrorForm(message);

            form.ShowDialog();
            Environment.Exit(1);
        }
 public void ShowWindow()
 {
     if (ErrorForm == null || ErrorForm.IsDisposed)
     {
         ErrorForm = Activator.CreateInstance(ErrorForm.GetType()) as Form;
     }
     ErrorForm.Show();
 }
Пример #33
0
 private void LoadData()
 {
     try
     {
         SipSettings sIP = this.m_pVirtualServer.SystemSettings.SIP;
         this.m_pTabGeneral_Enabled.Checked = sIP.Enabled;
         if ((sIP.ProxyMode & SIP_ProxyMode.B2BUA) != (SIP_ProxyMode)0)
         {
             this.m_pTabGeneral_ProxyType.SelectedIndex = 0;
         }
         else
         {
             this.m_pTabGeneral_ProxyType.SelectedIndex = 1;
         }
         this.m_pTabGeneral_MinExpires.Value = Convert.ToDecimal(sIP.MinimumExpires);
         IPBindInfo[] binds = sIP.Binds;
         for (int i = 0; i < binds.Length; i++)
         {
             IPBindInfo   iPBindInfo   = binds[i];
             ListViewItem listViewItem = new ListViewItem();
             listViewItem.Text = iPBindInfo.HostName;
             if (iPBindInfo.IP.ToString() == "0.0.0.0")
             {
                 listViewItem.SubItems.Add("Any IPv4");
             }
             else if (iPBindInfo.IP.ToString() == "0:0:0:0:0:0:0:0")
             {
                 listViewItem.SubItems.Add("Any IPv6");
             }
             else
             {
                 listViewItem.SubItems.Add(iPBindInfo.IP.ToString());
             }
             listViewItem.SubItems.Add(iPBindInfo.Protocol.ToString());
             listViewItem.SubItems.Add(iPBindInfo.Port.ToString());
             listViewItem.SubItems.Add(iPBindInfo.SslMode.ToString());
             listViewItem.SubItems.Add(Convert.ToString(iPBindInfo.Certificate != null));
             listViewItem.Tag = iPBindInfo;
             this.m_pTabGeneral_Bindings.Items.Add(listViewItem);
         }
         foreach (SipGateway sipGateway in this.m_pVirtualServer.SystemSettings.SIP.Gateways)
         {
             ListViewItem listViewItem2 = new ListViewItem(sipGateway.UriScheme);
             listViewItem2.SubItems.Add(sipGateway.Transport);
             listViewItem2.SubItems.Add(sipGateway.Host);
             listViewItem2.SubItems.Add(sipGateway.Port.ToString());
             listViewItem2.Tag = sipGateway;
             this.m_pTabGateways_Gateways.Items.Add(listViewItem2);
         }
         this.m_pTabGateways_Gateways_SelectedIndexChanged(null, null);
     }
     catch (Exception x)
     {
         ErrorForm errorForm = new ErrorForm(x, new StackTrace());
         errorForm.ShowDialog(this);
     }
 }
 public OutlookSecurityControl()
 {
     try
     {
         InitializeComponent();
         if (!DesignMode)
         {
             NetOffice.OutlookSecurity.Supress.OnAction += new NetOffice.OutlookSecurity.Supress.SecurityDialogAction(Supress_OnAction);
             NetOffice.OutlookSecurity.Supress.OnError += new NetOffice.OutlookSecurity.Supress.ErrorOccuredEventHandler(Supress_OnError);
         }
     }
     catch (Exception exception)
     {
         ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
         errorForm.ShowDialog(this);
     }
 }
 public ApplicationObserverControl()
 {
     try
     {
         InitializeComponent();
         if (!DesignMode)
         {
             _applicationObserver = new OfficeApplicationObserver(listViewApps);
             textBoxHotKey.Text = _applicationObserver.HotKey.ToString();
             _applicationObserver.InstanceRunningCountChanged += new EventHandler(_applicationObserver_InstanceRunningCountChanged);
             _applicationObserver.AllProcessesChanged += new EventHandler(_applicationObserver_AllProcessesChanged);
         }
     }
     catch (Exception exception)
     {
         ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
        errorForm.ShowDialog(this);
     }
     
 }
        void _applicationObserver_AllProcessesChanged(object sender, EventArgs e)
        {
            try
            {
                listViewProcess.Items.Clear();
                Process[] process = sender as Process[];
                foreach (Process item in process)
                {
                    ListViewItem vieItem = listViewProcess.Items.Add("");
                    vieItem.SubItems.Add(item.Id.ToString());
                    vieItem.SubItems.Add(item.ProcessName);
                    vieItem.ImageIndex = GetProcessImageIndex(item.ProcessName);
                }
            }
            catch (Exception exception)
            {

                ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
                errorForm.ShowDialog(this);
            }
        }
        private void checkBoxAppKill_CheckedChanged(object sender, EventArgs e)
        {
            try
            {
                _applicationObserver.HotKeyEnabled = checkBoxAppKill.Checked;
            }
            catch (Exception exception)
            {

                ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
                errorForm.ShowDialog(this);
            }
        }
        private void listViewApps_ItemChecked(object sender, ItemCheckedEventArgs e)
        {
            try
            {
                string appName = e.Item.Text;

                if (((e.Item.SubItems[1].Text != "0") && (!buttonKillApps.Enabled)))
                    buttonKillApps.Enabled = true;

                switch (appName)
                {
                    case "Excel":
                        _applicationObserver.Excel = e.Item.Checked;
                        break;
                    case "Winword":
                        _applicationObserver.Word = e.Item.Checked;
                        break;
                    case "Outlook":
                        _applicationObserver.Outlook = e.Item.Checked;
                        break;
                    case "PowerPnt":
                        _applicationObserver.PowerPoint = e.Item.Checked;
                        break;
                    case "MsAccess":
                        _applicationObserver.Access = e.Item.Checked;
                        break;
                    case "WinProj":
                        _applicationObserver.Project = e.Item.Checked;
                        break;
                    case "Visio":
                        _applicationObserver.Visio = e.Item.Checked;
                        break;
                }
            }
            catch (Exception exception)
            {
                ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
                errorForm.ShowDialog(this);
            }
        }
 public void LoadConfiguration(XmlNode configNode)
 {
     try
     {
         System.Xml.XmlNode node = configNode.SelectSingleNode("SupressEnabled");
         if (null == node)
         {
             node = configNode.OwnerDocument.CreateElement("SupressEnabled");
             node.InnerText = "false";
             configNode.AppendChild(node);
         }
         bool mode = Convert.ToBoolean(node.Value);
         checkBoxSupressEnabled.Checked = mode;
     }
     catch (Exception exception)
     {
         ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
         errorForm.ShowDialog(this);
     }
 }
Пример #40
0
        void _controller_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            try
            {
                _addinsItemToDisplay = sender as AddinsKey;
                _disabledItemToDisplay = sender as DisabledKey;
                _displayedException = sender as Exception;

                if (null != _addinsItemToDisplay)
                    this.Invoke(new MethodInvoker(_controller_AddinsKeyChangedInvoke));
                else if (null != _disabledItemToDisplay)
                    this.Invoke(new MethodInvoker(_controller_DisabledKeyChangedInvoke));
                else if (sender is WatchController)
                    this.Invoke(new MethodInvoker(_controller_PropertyChangedInvoke));
                else if (sender is Exception)
                    this.Invoke(new MethodInvoker(WatchNotify_ExceptionThrownInvoke));
                /*
                                if (null != _addinsItemToDisplay)
                                { 
                                if (_addinsItemToDisplay.Name == "Outlook")
                                {
                                    stopFlag = true;
                                    _controller.Enabled = false;
                                }
                                }
                 * */
            }
            catch (Exception exception)
            {
                ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
                errorForm.ShowDialog(this);
            }
        }  
        private void ImportByFile_Click(object sender, EventArgs e)
        {
            OpenFileDialog fileDialog = new OpenFileDialog();
            fileDialog.Multiselect = false;
            fileDialog.CheckFileExists = true;
            fileDialog.CheckPathExists = true;
            fileDialog.Filter = "Text Files|*.txt";
            DialogResult result = fileDialog.ShowDialog();
            if (result == DialogResult.OK)
            {

                Dictionary<string, int> list = new Dictionary<string, int>();

                string path = fileDialog.FileName;
                StreamReader fileReader = new StreamReader(File.OpenRead(path));

                while (!fileReader.EndOfStream)
                {
                    string line = fileReader.ReadLine();
                    string[] parseLines = line.Split(',');

                    try
                    {
                        if (parseLines.Length == 2)
                        {
                            if (list.ContainsKey(parseLines[0].Trim()))
                            {
                                list[parseLines[0].Trim()] += Int32.Parse(parseLines[1].Trim());
                            }
                            else
                            {
                                list.Add(parseLines[0].Trim(), Int32.Parse(parseLines[1].Trim()));
                            }

                        }
                        else
                        {
                            if (list.ContainsKey(parseLines[0].Trim()))
                            {
                                list[parseLines[0].Trim()] += 1;
                            }
                            else
                            {
                                list.Add(parseLines[0].Trim(), 1);
                            }

                        }
                    }
                    catch (Exception)
                    {
                        if (_errorForm == null)
                        {
                            _errorForm = new ErrorForm();
                            _errorForm.Caption = "Lỗi";
                            _errorForm.ErrorString = "Các mã vạch bị lỗi khi nhập mã vạch từ file text";
                        }
                        _errorForm.ErrorDetails.Add(line);
                        continue;
                    }
                }
                foreach (KeyValuePair<string, int> barCodeLine in list)
                {
                    if (!string.IsNullOrEmpty(barCodeLine.Key) && barCodeLine.Key.Length == 12)
                    {
                        var eventArgs = new DepartmentStockOutEventArgs();
                        eventArgs.ProductId = barCodeLine.Key;
                        EventUtility.fireEvent(FindBarcodeEvent, this, eventArgs);
                        if (eventArgs.EventResult == null)
                        {
                            if (_errorForm == null)
                            {
                                _errorForm = new ErrorForm();
                                //_errorForm.Caption = "Lỗi";
                                _errorForm.ErrorString = "Các mã vạch bị lỗi khi nhập mã vạch từ file text";
                            }
                            _errorForm.ErrorDetails.Add(barCodeLine.Key + "," + barCodeLine.Value);
                            continue;
                        }
                        bool found = false;
                        DepartmentStockOutDetail foundStockOutDetail = null;
                        foreach (DepartmentStockOutDetail detail in deptSODetailList)
                        {
                            if (eventArgs.SelectedDepartmentStockOutDetail.Product.ProductId.Equals(detail.Product.ProductId))
                            {
                                found = true;
                                foundStockOutDetail = detail;
                                break;
                            }
                        }

                        if (found)
                        {
                            foundStockOutDetail.GoodQuantity += barCodeLine.Value;
                            bdsStockIn.ResetBindings(false);
                            dgvDeptStockIn.Refresh();
                            dgvDeptStockIn.Invalidate();
                            CalculateTotalStorePrice();
                        }
                        else
                        {
                            // reset quantity to 1
                            eventArgs.SelectedDepartmentStockOutDetail.GoodQuantity = barCodeLine.Value;
                            deptSODetailList.Add(eventArgs.SelectedDepartmentStockOutDetail);
                            bdsStockIn.ResetBindings(false);
                            dgvDeptStockIn.Refresh();
                            dgvDeptStockIn.Invalidate();
                            cbbStockOutType.Enabled = false;
                            LockField(deptSODetailList.Count - 1, eventArgs.SelectedDepartmentStockOutDetail);
                            CalculateTotalStorePrice();
                        }

                        // process department stock
                        if (eventArgs.DepartmentStock != null)
                        {
                            found = false;
                            foreach (DepartmentStock detail in departmentStockList)
                            {
                                if (eventArgs.DepartmentStock.DepartmentStockPK.ProductId.Equals(detail.Product.ProductId))
                                {
                                    found = true;
                                    break;
                                }
                            }
                            if (!found)
                            {
                                departmentStockList.Add(eventArgs.DepartmentStock);
                            }
                        }
                    }

                }
                CalculateTotalStorePrice();
                if (_errorForm != null)
                {
                    _errorForm.ShowDialog();
                    _errorForm = null;
                }
            }
        }
Пример #42
0
        private void radioButtonMsgBox_CheckedChanged(object sender, EventArgs e)
        {
            try
            {
                if (_programmaticChange)
                    return;

                RadioButton button = sender as RadioButton;
                if (button.Checked)
                    _controller.NotifyType = NotificationType.MessageBox;
                else
                    _controller.NotifyType = NotificationType.TrayBallon;
            }
            catch (Exception exception)
            {
                ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
                errorForm.ShowDialog(this);
            }
        }
 private void buttonInfo_Click(object sender, EventArgs e)
 {
     try
     {
         InfoControl infoBox = new InfoControl("ApplicationObserver.Info" + _currentLanguageID.ToString() + ".rtf", true);
         this.Controls.Add(infoBox);
         infoBox.BringToFront();
         infoBox.Show();
     }
     catch (Exception exception)
     {
         ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
         errorForm.ShowDialog(this);
     }
 }
 private void linkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     try
     {
         LinkLabel label = sender as LinkLabel;
         System.Diagnostics.Process.Start(label.Text);
     }
     catch (Exception exception)
     {
         ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
         errorForm.ShowDialog(this);
     }
 }
 public void SaveConfiguration(XmlNode configNode)
 {
     try
     {
         System.Xml.XmlNode node = configNode.SelectSingleNode("SupressEnabled");
         node.InnerText = BoolToString(checkBoxSupressEnabled.Checked);
     }
     catch (Exception exception)
     {
         ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
         errorForm.ShowDialog(this);
     }
 }
Пример #46
0
 private void buttonChangeLegend_Click(object sender, EventArgs e)
 {
     try
     {
         Button button = sender as Button;
         if (">" == button.Text)
         {
             panelIconLegend.Visible = false;
             panelColorLegend.Visible = true;
             labelColorLegendCaption.Visible = true;
             labelIconLegendCaption.Visible = false;
             button.Text = "<";
         }
         else
         {
             panelIconLegend.Visible = true;
             panelColorLegend.Visible = false;
             labelColorLegendCaption.Visible = false;
             labelIconLegendCaption.Visible = true;
             button.Text = ">";
         }
     }
     catch (Exception exception)
     {
         ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
         errorForm.ShowDialog(this);
     }
 }
Пример #47
0
 private void treeViewRegistry_AfterCollapse(object sender, TreeViewEventArgs e)
 {
     try
     {
         e.Node.ImageIndex = 0;
     }
     catch (Exception exception)
     {
         ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
         errorForm.ShowDialog(this);
     }
 }
Пример #48
0
        private void treeViewRegistry_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                dataGridViewValues.Rows.Clear();
                if (e.Node.Tag is AddinKey)
                {
                    panelDeactivatedElements.Visible = false;
                    panelInfos.Visible = false;
                    panelRegistryValues.Visible = true;

                    AddinKey addinKey = e.Node.Tag as AddinKey;
                    foreach (AddinKeyValue item in addinKey.Values)
                    {
                        dataGridViewValues.Rows.Add();
                        DataGridViewRow row = dataGridViewValues.Rows[dataGridViewValues.Rows.Count - 1];
                        row.Cells[0].Value = GetValueKindImage(item.Type);
                        row.Cells[1].Value = item.Name;
                        row.Cells[2].Value = item.Type;
                        row.Cells[3].Value = item.Value;
                    }
                }
                else if (e.Node.Tag is DisabledValue)
                {
                    panelRegistryValues.Visible = false;
                    panelInfos.Visible = false;
                    panelDeactivatedElements.Visible = true;
                    DisabledValue disabledValue = e.Node.Tag as DisabledValue;

                    labelOfficeProduct.Text = disabledValue.OfficeProductVersion;
                    labelDisabledRegistryValue.Text = disabledValue.Value;
                    labelDisabledRegistryPath.Text = disabledValue.Parent.RegistryPath + " - " + disabledValue.ValueName;
                }
                else
                {
                    panelRegistryValues.Visible = false;
                    panelDeactivatedElements.Visible = false;
                    panelInfos.Visible = true;
                }
            }
            catch (Exception exception)
            {
                ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
                errorForm.ShowDialog(this);
            }
        }
Пример #49
0
        private void radioButtonActivate_CheckedChanged(object sender, EventArgs e)
        {
            try
            {
                RadioButton button = sender as RadioButton;

                if (button.Checked)
                    checkBoxRestoreLoadBehavior.ForeColor = Color.Black;
                else
                    checkBoxRestoreLoadBehavior.ForeColor = Color.Gray;

                if (_programmaticChange)
                    return;

                _controller.Enabled = button.Checked;
            }
            catch (Exception exception)
            {
                ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
                errorForm.ShowDialog(this);
            }
        }
        private void textBoxHotKey_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (true == checkBoxAppKill.Checked)
                    checkBoxAppKill.Checked = false;

                string CtrlKeys = "";
                if (e.Control)
                    CtrlKeys += "Ctrl ";
                if (e.Alt)
                    CtrlKeys += "Alt ";

                if (e.KeyCode == (Keys.LButton | Keys.ShiftKey))
                    textBoxHotKey.Text = CtrlKeys;
                else if (e.KeyCode == Keys.Menu)
                    textBoxHotKey.Text = CtrlKeys;
                else
                    textBoxHotKey.Text = CtrlKeys + e.KeyCode.ToString();

                if ((e.Control) && (e.Alt))
                    _applicationObserver.HotKey = e.KeyCode | Keys.Control | Keys.Alt;
                else if (e.Control)
                    _applicationObserver.HotKey = e.KeyCode | Keys.Control;
                else if (e.Alt)
                    _applicationObserver.HotKey = e.KeyCode | Keys.Alt;
                else
                    _applicationObserver.HotKey = e.KeyCode;
            }
            catch (Exception exception)
            {

                ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
                errorForm.ShowDialog(this);
            }
        }
 private void buttonKillApps_Click(object sender, EventArgs e)
 {
     try
     {
         _applicationObserver.KillProcesses();
     }
     catch (Exception exception)
     {
         ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
         errorForm.ShowDialog(this);
     }
 }
 private void labelKillQuestion_TextChanged(object sender, EventArgs e)
 {
     try
     {
         _applicationObserver.KillQuestion = labelKillQuestion.Text;
     }
     catch (Exception exception)
     {
         ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
         errorForm.ShowDialog(this);
     }
 }
 private void checkBoxSupressEnabeld_CheckedChanged(object sender, EventArgs e)
 {
     try
     {
         if (_programaticChange)
             return;
         NetOffice.OutlookSecurity.Supress.Enabled = checkBoxSupressEnabled.Checked;
     }
     catch (Exception exception)
     {
         ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
         errorForm.ShowDialog(this);
     }
 }
Пример #54
0
        private void checkBoxRestoreLoadBehavior_CheckedChanged(object sender, EventArgs e)
        {
            try
            {
                if (_programmaticChange)
                    return;

                CheckBox button = sender as CheckBox;
                _controller.RestoreLastLoadBehavior = button.Checked;
            }
            catch (Exception exception)
            {
                ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
                errorForm.ShowDialog(this);
            }
        }
 private void checkBoxShowQuestion_CheckedChanged(object sender, EventArgs e)
 {
     try
     {
         _applicationObserver.ShowQuesionBeforeKill = checkBoxShowQuestion.Checked;
     }
     catch (Exception exception)
     {
         ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
         errorForm.ShowDialog(this);
     }
 }
 void Supress_OnError()
 {
     try
     {
         _programaticChange = true;
         checkBoxSupressEnabled.Checked = false;
         _programaticChange = false;
         labelMessages.Text = "Error:" + _exception.Message + labelMessages.Text + Environment.NewLine;
     }
     catch (Exception exception)
     {
         ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
         errorForm.ShowDialog(this);
     } 
 }
 void _applicationObserver_InstanceRunningCountChanged(object sender, EventArgs e)
 {
     try
     {
         foreach (ListViewItem item in listViewApps.Items)
         {
             if (item.SubItems[1].Text.Length > 0)
             {
                 int number = Convert.ToInt32(item.SubItems[1].Text);
                 if ((number > 0) && (item.Checked))
                 {
                     buttonKillApps.Enabled = true;
                     return;
                 }
             }
         }
         buttonKillApps.Enabled = false;
     }
     catch (Exception exception)
     {
         ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
         errorForm.ShowDialog(this);
     }
 }
Пример #58
0
        void _controller_DisabledKeyChangedInvoke()
        {
            try
            {
                string selectedKey = null;
                if (null != treeViewRegistry.SelectedNode)
                    selectedKey = treeViewRegistry.SelectedNode.Name;

                if (null == _disabledItemToDisplay)
                    return;

                TreeNode node = treeViewRegistry.Nodes[_disabledItemToDisplay.Name];
                DeleteDisabledNodes(node);
                foreach (DisabledValue subItem in _disabledItemToDisplay.Values)
                {
                    string key = subItem.Parent.RootKey.ToString() + "-" + subItem.Parent.Name + "-" + subItem.Name;
                    TreeNode subNode = node.Nodes.Add(subItem.Name);
                    subNode.ImageIndex = 4;
                    subNode.SelectedImageIndex = subNode.ImageIndex;
                    subNode.Tag = subItem;
                }

                treeViewRegistry.ExpandAll();

                if (null != selectedKey)
                    SelectNode(treeViewRegistry, selectedKey);
            }
            catch (Exception exception)
            {
                ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
                errorForm.ShowDialog(this);
            }
        }
  void Supress_OnAction()
  {
      try
      {
          labelMessages.Text = "Dialog:" + _dialog.Caption + " CheckBox:" + _targetBox.Caption + " Button:" + _targetButton.Caption + Environment.NewLine;
      }
      catch (Exception exception)
      {
          ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
          errorForm.ShowDialog(this);
      } 
 }
Пример #60
0
 void _controller_PropertyChangedInvoke()
 {
     try
     {
         _programmaticChange = true;
         radioButtonActivate.Checked = _controller.Enabled;
         checkBoxRestoreLoadBehavior.Checked = _controller.RestoreLastLoadBehavior;
         radioButtonMsgBox.Checked = (NotificationType.MessageBox == _controller.NotifyType);
         _programmaticChange = false;
     }
     catch (Exception exception)
     {
         ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
         errorForm.ShowDialog(this);
     }
 }