Exemple #1
0
        /// <summary>
        /// Rehbere kişi bilgileri eklenmektedir.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            #region Boş kontrolü yapılıyor ...
            if (String.IsNullOrEmpty(txtName.Text) ||
                String.IsNullOrEmpty(txtPhoneNumber.Text.Trim()) ||
                String.IsNullOrEmpty(cmbCity.Text))
            {
                MessageBox.Show("Lütfen tüm alanları doldurunuz");
            }
            #endregion

            #region Bilgiler eksizsiz ise ekleme işlemi gerçekleşiyor ..
            else
            {
                FileReadAndWrite.AddGuidInformation(txtName.Text, txtPhoneNumber.Text, cmbCity.Text, GuidTextFile);
                DialogResult result = new DialogResult();
                result = MessageBox.Show("Rehberinize kayıt başarılı bir şekilde gerçekleşmiştir.\nEklenen kaydı rehber listelemede görmek istiyor musunuz ? \nGörmek için 'Yes' - Programı kapatmak için 'No' ya basınız. ", "Listeleme Onayı", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (result == DialogResult.Yes)
                {
                    listBox1.Items.Clear();
                    Application.Restart();
                }
                else
                {
                    Application.Exit();
                }
            }
            #endregion
        }
Exemple #2
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Process instance = RunningInstance();

            if (instance == null)
            {
                #region 在线更新
                try
                {
                    //string _ip = Securit.DeDES(FileReadAndWrite.IniReadValue("ftpfile", "ip"));
                    //string _id = Securit.DeDES(FileReadAndWrite.IniReadValue("ftpfile", "id"));
                    //string _pwd = Securit.DeDES(FileReadAndWrite.IniReadValue("ftpfile", "pwd"));
                    //FileUpDown fileUpDown = new FileUpDown(_ip, _id, _pwd);

                    thePreUpdateDate = GetTheUpdateVersionNum(System.Windows.Forms.Application.StartupPath);//上次的版本号

                    //fileUpDown.Download(CommonStaticParameter.TEMP, "UpdateConfig.xml", "WorkLog");

                    //thePreUpdateDate = GetTheUpdateVersionNum(CommonStaticParameter.TEMP);//这次的版本号
                }
                catch (Exception ex)
                {
                    MessageBox.Show("程序出错 原因:" + ex.Message.ToString());
                }
                #endregion


                string isSelfStarting = FileReadAndWrite.IniReadValue("temp", "isSelfStarting");

                //Application.EnableVisualStyles();
                //Application.SetCompatibleTextRenderingDefault(false);
                if (isSelfStarting == CommonStaticParameter.YES)
                {
                    SetSelfStarting();
                }



                login           = new login();
                login.ShowMain += login_ShowMain;
                login.ShowDialog();

                //loginmessage = login.loginMessage;
                //if (login.loginMessage == "")
                {
                    //}
                    //if (login.ShowDialog() == DialogResult.OK)
                    //{
                }
                //Application.Run(new TimeManagement());
            }
            else
            {
                HandleRunningInstance(instance);
            }
        }
    // Load a population of genes
    public bool LoadGeneration(string filePath)
    {
        if (!System.IO.File.Exists(filePath))
        {
            return(false);
        }

        Save = FileReadAndWrite.ReadFromBinaryFile(filePath);

        return(true);
    }
        private void SaveAndUploadHeadPic()
        {
            if (this.pb_photo_cut.BackgroundImage != null)
            {
                Bitmap savpic        = new Bitmap(this.pb_photo_cut.BackgroundImage);
                string addressonlyid = CommonStaticParameter.ICONS + @"\" + this.user.Id.ToString() + ".png";
                string address       = CommonStaticParameter.ICONS + @"\" + this.user.Id.ToString() + "__" + DateTime.Now.Ticks.ToString() + ".png";

                if (!Directory.Exists(CommonStaticParameter.ICONS))
                {
                    Directory.CreateDirectory(CommonStaticParameter.ICONS);
                }

                if (File.Exists(addressonlyid))
                {
                    FileInfo oldfi = new FileInfo(addressonlyid);
                    oldfi.Delete();
                }

                savpic.Save(addressonlyid); //保存临时文件

                //ToRoundPic(address).Save(address);
                if (fileop == null)
                {
                    string _ip  = Securit.DeDES(FileReadAndWrite.IniReadValue("ftpfile", "ip"));
                    string _id  = Securit.DeDES(FileReadAndWrite.IniReadValue("ftpfile", "id"));
                    string _pwd = Securit.DeDES(FileReadAndWrite.IniReadValue("ftpfile", "pwd"));
                    fileop = new FileUpDown(_ip, _id, _pwd);
                }
                try
                {
                    fileop.IsConnectSucceed(this.user.Id.ToString() + ".png", "Iconpics");
                    bool isxe = fileop.DirectoryExist(this.user.Id.ToString() + ".png", "Iconpics");
                    if (isxe)
                    {
                        fileop.DeleteFileName(this.user.Id.ToString() + ".png", "Iconpics");
                    }
                    fileop.Upload(addressonlyid, "Iconpics");
                    fileop.Rename(addressonlyid, this.user.Id.ToString() + ".png", "Iconpics");
                    themain.RefreshHeaderPic();
                    MessageBox.Show("上传成功!");
                }
                catch (Exception exp)
                {
                    MessageBox.Show("上传失败" + exp.ToString());
                    return;
                }
            }
        }
        private void onlineUpDate()
        {
            #region 在线更新
            string thePreUpdateDate = "";
            try
            {
                string     _ip        = Securit.DeDES(FileReadAndWrite.IniReadValue("ftpfile", "ip"));
                string     _id        = Securit.DeDES(FileReadAndWrite.IniReadValue("ftpfile", "id"));
                string     _pwd       = Securit.DeDES(FileReadAndWrite.IniReadValue("ftpfile", "pwd"));
                FileUpDown fileUpDown = new FileUpDown(_ip, _id, _pwd);

                string theLastsUpdateVersionNumber = GetTheUpdateVersionNum(System.Windows.Forms.Application.StartupPath);//上次的版本号


                fileUpDown.Download(CommonStaticParameter.TEMP, "UpdateConfig.xml", "WorkLog");

                thePreUpdateDate = GetTheUpdateVersionNum(CommonStaticParameter.TEMP);//这次的版本号
                if (thePreUpdateDate != "")
                {
                    //如果客户端将升级的应用程序的更新版本号与服务器上的不一致则进行更新
                    if (thePreUpdateDate != theLastsUpdateVersionNumber)
                    {
                        MessageBox.Show("有可更新的版本,程序将关闭…", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        {
                            this.Close();
                            themain.DialogResult = DialogResult.OK;
                            return;
                        }
                    }
                    else
                    {
                        MessageBox.Show("当前版本为最新版" + thePreUpdateDate + ",无需更新");
                        return;
                    }
                }
                else
                {
                    onlineUpDate();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("程序出错 原因:" + ex.Message.ToString());
            }
            #endregion
        }
 // Save a Population of genes
 public void SaveGeneration(string filePath)
 {
     FileReadAndWrite.WriteToXMLFile(filePath, Save);
 }
Exemple #7
0
 /// <summary>
 /// FormLoad ekran ilk açıldığında gerçekleşecek olaylar tanımlanmaktadır.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Form1_Load(object sender, EventArgs e)
 {
     FileReadAndWrite.ListBoxFillPersonInformation(GuidTextFile, listBox1);
     ComboboxFilled();
 }