Example #1
0
        public static T LoadFromFile <T>(string filter = null)
        {
            OpenFileDialog f = new OpenFileDialog();

            if (filter == null)
            {
                f.Filter = "Text Files(*.txt)|*.txt|All Files(*.*)|*.*";
            }
            else
            {
                f.Filter = filter;
            }
            try
            {
                if (f.ShowDialog().Value)
                {
                    return(CommonProc.LoadObjFromFile <T>(f.FileName));
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("load fail");
                LogSupport.Error(e);
            }
            return(default(T));
        }