/// <summary>
        /// OnKeyDown(Process Down Key)
        /// </summary>
        /// <param name="e"></param>
        protected override void OnKeyDown(KeyEventArgs e)
        {
            if (e.Control &&
                (e.KeyCode == Keys.C || e.KeyCode == Keys.V || e.KeyCode == Keys.X))
            {
                base.OnKeyDown(e);
                return;
            }

            try
            {
                MyObjectPicker box1 = ParentObjectPicker;
                if (!box1.ReadOnly)
                {
                    GridControl grid = box1.DropDownControl;

                    switch (e.KeyCode)
                    {
                    case Keys.Down:
                        if (!box1.DroppedDown)
                        {
                            box1.DroppedDown = true;
                        }
                        MyComboBoxTextBoxArea.MoveCurrentRowDown(grid);
                        e.Handled = true;
                        break;

                    case Keys.Up:
                        MyComboBoxTextBoxArea.MoveCurrentRowUp(grid);
                        e.Handled = true;
                        break;

                    case Keys.Enter:
                        if (box1.DroppedDown)
                        {
                            box1.DroppedDown = false;
                        }
                        e.Handled = true;
                        break;

                    case Keys.Escape:
                        if (box1.DroppedDown)
                        {
                            box1.DroppedDown = false;
                        }
                        e.Handled = true;
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionProcess.ProcessWithResume(ex);
            }
        }
Пример #2
0
 // <summary>
 // launch any http:// or mailto: links clicked in the body of the rich text box
 // </summary>
 private void MoreRichTextBox_LinkClicked(object sender, LinkClickedEventArgs e)
 {
     try
     {
         System.Diagnostics.Process.Start(e.LinkText);
     }
     catch (Exception ex)
     {
         ExceptionProcess.ProcessWithResume(ex);
     }
 }
Пример #3
0
 /// <summary>
 /// Form_Closing
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected virtual void Form_Closing(object sender, FormClosingEventArgs e)
 {
     try
     {
         SaveLayout();
     }
     catch (Exception ex)
     {
         ExceptionProcess.ProcessWithResume(ex);
     }
 }
Пример #4
0
 private static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
 {
     try
     {
         ExceptionProcess.ProcessUnhandledException(e.Exception);
     }
     catch (Exception)
     {
         System.Windows.Forms.MessageBox.Show(e.Exception.Message, "错误");
     }
 }
Пример #5
0
        private void btnRun_Click(object sender, EventArgs e)
        {
            string query = null;

            if (string.IsNullOrEmpty(rtQuery.SelectedText))
            {
                query = rtQuery.Text;
            }
            else
            {
                query = rtQuery.SelectedText;
            }
            if (string.IsNullOrEmpty(query))
            {
                return;
            }

            try
            {
                btnRun.Enabled = false;

                if (!ckbHql.Checked)
                {
                    DataTable dt = null;
                    if (!string.IsNullOrEmpty(txtConfig.Text))
                    {
                        dt = Feng.Data.DbHelper.CreateDatabase(txtConfig.Text).ExecuteDataTable(query);
                    }
                    else
                    {
                        dt = Feng.Data.DbHelper.Instance.ExecuteDataTable(query);
                    }
                    dataGridView1.DataSource = dt;
                }
                else
                {
                    System.Collections.IList list = null;
                    using (Feng.NH.INHibernateRepository rep = new Feng.NH.Repository(txtConfig.Text))
                    {
                        list = rep.Session.CreateQuery(query).List();
                        dataGridView1.DataSource = list;
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionProcess.ProcessWithNotify(ex);
            }
            finally
            {
                btnRun.Enabled = true;
            }
        }
Пример #6
0
        private void asyncManager_WorkerDone(object sender, WorkerDoneEventArgs <object> e)
        {
            if (m_workDone != null)
            {
                m_workDone(e.Result);

                if (e.Exception != null)
                {
                    ExceptionProcess.ProcessWithNotify(e.Exception);
                }
            }
        }
Пример #7
0
 /// <summary>
 /// Any to Decimal(if exception, return null0)
 /// </summary>
 /// <param name="value"></param>
 /// <returns></returns>
 public static decimal?ToDecimal(object value)
 {
     try
     {
         return(Convert.ToDecimal(value.ToString()));
     }
     catch (Exception ex)
     {
         ExceptionProcess.ProcessWithResume(ex);
         return(null);
     }
 }
Пример #8
0
 /// <summary>
 /// Any to Int(if exception, return null)
 /// 12.34m -> 0(Exception)
 /// </summary>
 /// <param name="value"></param>
 /// <returns></returns>
 public static int?ToInt(object value)
 {
     try
     {
         return(Convert.ToInt32(value.ToString()));
     }
     catch (Exception ex)
     {
         ExceptionProcess.ProcessWithResume(ex);
         return(null);
     }
 }
Пример #9
0
 /// <summary>
 /// ²¥·ÅÉùÒô
 /// </summary>
 /// <param name="stream"></param>
 public static void PlaySound(Stream stream)
 {
     try
     {
         s_player.Stream = stream;
         s_player.PlaySync();
     }
     catch (Exception ex)
     {
         ExceptionProcess.ProcessWithResume(ex);
     }
 }
Пример #10
0
        private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            Exception ex = (Exception)e.ExceptionObject;

            try
            {
                ExceptionProcess.ProcessUnhandledException(ex);
            }
            catch (Exception)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message, "错误");
            }
        }
        internal static void ShowFormFromGrid(IArchiveMasterForm sourceForm, GridRelatedInfo info, bool asDetailDialog)
        {
            try
            {
                ISearchExpression se = GetSearchExpressionFromGrid(sourceForm, info, asDetailDialog);

                ShowFrom(info.Action.Name, se, asDetailDialog);
            }
            catch (Exception ex)
            {
                ExceptionProcess.ProcessWithNotify(ex);
            }
        }
Пример #12
0
 /// <summary>
 /// ²¥·ÅÉùÒô
 /// </summary>
 /// <param name="fileName"></param>
 public static void PlaySound(string fileName)
 {
     try
     {
         s_player.SoundLocation = fileName;
         //m_player.LoadAsync();
         s_player.PlaySync();
     }
     catch (Exception ex)
     {
         ExceptionProcess.ProcessWithResume(ex);
     }
 }
Пример #13
0
        private static void PerformClickMenu(object o)
        {
            ToolStripMenuItem menuItem = o as ToolStripMenuItem;

            if (menuItem.Text.Contains("忽略"))
            {
                return;
            }

            menuItem.PerformClick();

            TabbedMdiForm mdiForm = ServiceProvider.GetService <IApplication>() as TabbedMdiForm;

            try
            {
                foreach (Form form in mdiForm.MdiChildren)
                {
                    if (form is ArchiveSeeForm)
                    {
                        (form as ArchiveSeeForm).DisplayManager.SearchManager.LoadDataAccordSearchControls();
                        if ((form as ArchiveSeeForm).DisplayManager.Count > 0 &&
                            (form as ArchiveSeeForm).ArchiveDetailForm != null)
                        {
                            (form as ArchiveSeeForm).DoView();
                        }
                    }
                    //if (form is ArchiveOperationForm)
                    //{
                    //    (form as ArchiveOperationForm).DoAdd();
                    //}
                }

                foreach (Form form in mdiForm.MdiChildren)
                {
                    form.Close();
                    form.Dispose();
                }

                if (menuItem is ToolStripDropDownItem)
                {
                    foreach (ToolStripMenuItem subItem in ((ToolStripDropDownItem)menuItem).DropDownItems)
                    {
                        PerformClickMenu(subItem);
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionProcess.ProcessWithNotify(new ArgumentException(menuItem.Text + "出错", ex));
            }
        }
Пример #14
0
 public bool  达专家任务(专家任务 zjrw, DateTime 达时间)
 {
     try
     {
         zjrw.达时间 = 达时间;
         base.Update(zjrw);
         return(true);
     }
     catch (Exception ex)
     {
         ExceptionProcess.ProcessWithNotify(ex);
         return(false);
     }
 }
 private void row_ValidationError(object sender, RowValidationErrorEventArgs e)
 {
     e.CancelEdit = false;
     if (e.Exception != null)
     {
         if (e.Exception is Xceed.Grid.GridException)
         {
         }
         else
         {
             ExceptionProcess.ProcessWithResume(e.Exception);
         }
     }
 }
 private List <AjaxDictionary <string, object> > GetItems(string winTab)
 {
     try
     {
         return(OnGetItems(winTab));
     }
     catch (Exception ex)
     {
         ExceptionProcess.ProcessWithResume(ex);
         WebOperationContext.Current.OutgoingResponse.StatusCode = HttpStatusCode.BadRequest;
         throw;
     }
     return(null);
 }
Пример #17
0
        private void Save(SaveType saveType)
        {
            // 验证控件有效值(有些控件需移出焦点后对其他控件产生影响,如果这里不Validate,会先执行Save)
            this.ValidateChildren();

            if (m_cm.SaveCurrent())
            {
                任务 entity = m_cm.DisplayManager.CurrentItem as 任务;

                switch (saveType)
                {
                case SaveType.正式备案确认:
                    任务Dao.生成任务号(entity);
                    break;

                case SaveType.拒绝确认:
                    entity.是否拒绝     = true;
                    entity.IsActive = false;
                    entity.任务号      = null;
                    break;

                default:
                    break;
                }
                bool ret;
                if (m_cm.State == StateType.Edit)
                {
                    ret = m_cm.EndEdit(true);
                }
                else
                {
                    try
                    {
                        m_cm.Dao.Update(entity);
                        ret = true;
                    }
                    catch (Exception ex)
                    {
                        ExceptionProcess.ProcessWithNotify(ex);
                        ret = false;
                    }
                }

                if (m_cm.State == StateType.View)
                {
                    this.DialogResult = System.Windows.Forms.DialogResult.OK;
                    //ArchiveDetailForm.UpdateStatusDataControl(m_cm, m_gridName);
                }
            }
        }
Пример #18
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public NameValueList GetItems(string name)
 {
     try
     {
         return(OnGetItems(name));
     }
     catch (Exception ex)
     {
         ExceptionProcess.ProcessWithResume(ex);
         WebOperationContext.Current.OutgoingResponse.StatusCode = HttpStatusCode.BadRequest;
         throw;
     }
     return(null);
 }
Пример #19
0
        internal static bool Save(IControlManager cm, SaveType saveType)
        {
            if (cm.State == StateType.Edit)
            {
                if (!cm.SaveCurrent())
                {
                    return(false);
                }
            }

            任务 entity = cm.DisplayManager.CurrentItem as 任务;

            switch (saveType)
            {
            case SaveType.正式备案确认:
                任务Dao.生成任务号(entity);
                break;

            case SaveType.拒绝确认:
                entity.是否拒绝     = true;
                entity.IsActive = false;
                entity.任务号      = null;
                break;

            default:
                break;
            }

            bool ret;

            if (cm.State == StateType.Edit)
            {
                ret = cm.EndEdit(true);
            }
            else
            {
                try
                {
                    cm.Dao.Update(entity);
                    ret = true;
                }
                catch (Exception ex)
                {
                    ExceptionProcess.ProcessWithNotify(ex);
                    ret = false;
                }
            }

            return(ret);
        }
 public int GetItemCount()
 {
     try
     {
         return(OnGetItemCount());
     }
     catch (Exception ex)
     {
         ExceptionProcess.ProcessWithResume(ex);
         WebOperationContext.Current.OutgoingResponse.StatusCode = HttpStatusCode.BadRequest;
         throw;
     }
     return(0);
 }
Пример #21
0
        /// <summary>
        ///
        /// </summary>
        public void WaitForWorker()
        {
            var e = m_asyncManager.WaitForWorker();

            if (m_workDone != null)
            {
                m_workDone(e.Result);

                if (e.Exception != null)
                {
                    ExceptionProcess.ProcessWithNotify(e.Exception);
                }
            }
        }
Пример #22
0
 public bool SaveLayout()
 {
     EnumerateControls(this, (lc) =>
     {
         try
         {
             lc.SaveLayout();
         }
         catch (Exception ex)
         {
             ExceptionProcess.ProcessWithResume(ex);
         }
     });
     return(true);
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="fileName"></param>
 /// <param name="graph"></param>
 public static void Serialize(string fileName, object graph)
 {
     try
     {
         using (var file = System.IO.File.Open(fileName, System.IO.FileMode.Create))
         {
             var bf = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
             bf.Serialize(file, graph);
         }
     }
     catch (Exception ex)
     {
         ExceptionProcess.ProcessWithResume(ex);
     }
 }
Пример #24
0
        /// <summary>
        /// Form_Closing
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected override void Form_Closing(object sender, FormClosingEventArgs e)
        {
            try
            {
                SaveLayout();

                this.splitContainer1.Panel2.Controls.Clear();
            }
            catch (Exception ex)
            {
                ExceptionProcess.ProcessWithResume(ex);
            }

            base.Form_Closing(sender, e);
        }
Пример #25
0
 // <summary>
 // populate Assembly Information listview with ALL assemblies
 // </summary>
 private void PopulateAssemblies()
 {
     foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies())
     {
         try
         {
             PopulateAssemblySummary(a);
         }
         catch (Exception ex)
         {
             ExceptionProcess.ProcessWithResume(ex);
         }
     }
     AssemblyNamesComboBox.SelectedIndex = AssemblyNamesComboBox.FindStringExact(_EntryAssemblyName);
 }
Пример #26
0
 public Feng.Map.GeobaseMapMarker AddGeobaseMarker(string fileName)
 {
     try
     {
         Feng.Map.GeobaseMapMarker marker = new Feng.Map.GeobaseMapMarker(this, fileName);
         GMapOverlay overlay = new GMapOverlay(this, "geobase" + Guid.NewGuid());
         overlay.Markers.Add(marker);
         this.Overlays.Insert(0, overlay);
         return(marker);
     }
     catch (Exception ex)
     {
         ExceptionProcess.ProcessWithResume(ex);
         return(null);
     }
 }
Пример #27
0
 /// <summary>
 /// CreateDatabase
 /// </summary>
 /// <param name="name"></param>
 /// <returns></returns>
 public static DbHelper CreateDatabase(string name)
 {
     if (!m_databases.ContainsKey(name))
     {
         try
         {
             m_databases[name] = new DbHelper(Microsoft.Practices.EnterpriseLibrary.Data.DatabaseFactory.CreateDatabase(name));
         }
         catch (Exception ex)
         {
             ExceptionProcess.ProcessWithResume(ex);
             m_databases[name] = null;
         }
     }
     return(m_databases[name]);
 }
Пример #28
0
        //private void SetUserManagerAddress()
        //{
        //    if (string.IsNullOrEmpty(txtIp.Text))
        //    {
        //        return;
        //    }

        //    short port = 80;
        //    if (!string.IsNullOrEmpty(txtPort.Text))
        //    {
        //        Int16.TryParse(txtPort.Text, out port);
        //    }

        //    ProviderBase provider = ProviderManager.Instance.DefaultProvider;
        //    UserManager.WebServiceProvider webServiceProvider = provider as UserManager.WebServiceProvider;
        //    if (webServiceProvider != null)
        //    {
        //        webServiceProvider.SetWebServiceAddress(txtIp.Text, port);
        //    }
        //    else
        //    {
        //        throw new NotSupportedException("Only WebService UserManager Provider support custom address!");
        //    }

        //    SystemConfiguration.ServerIP = txtIp.Text;
        //    SystemConfiguration.ServerPort = port;
        //}

        private void btnLogin_Click(object sender, EventArgs e)
        {
            SaveConfig();

            bool res = false;

            try
            {
                res = aspNetLoginControl1.Login();
            }
            catch (Exception ex)
            {
                ExceptionProcess.ProcessWithResume(ex);
                MessageForm.ShowWarning("不能登录,请稍后再试。");
            }
        }
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 bool ILayoutControl.SaveLayout()
 {
     try
     {
         m_profile.SetValue("Forms." + GetFullName() + ".Position", "Width", this.Width);
         m_profile.SetValue("Forms." + GetFullName() + ".Position", "Height", this.Height);
         m_profile.SetValue("Forms." + GetFullName() + ".Position", "Top", this.Top);
         m_profile.SetValue("Forms." + GetFullName() + ".Position", "Left", this.Left);
         return(false);
     }
     catch (Exception ex)
     {
         ExceptionProcess.ProcessWithResume(ex);
     }
     return(true);
 }
 public void SaveConfigurationToCache(string sessionFactoryConfigPath, Configuration configuration)
 {
     try
     {
         string fileName = GetConfigCacheFileName(sessionFactoryConfigPath);
         using (var file = File.Open(fileName, FileMode.Create))
         {
             var bf = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
             bf.Serialize(file, configuration);
         }
     }
     catch (Exception ex)
     {
         ExceptionProcess.ProcessWithResume(ex);
     }
 }