public DeliveryTypeViewModel()
        {
            //"不限", "电瓶车", "驾车"
            this.Datas = new List <Tmp>()
            {
                new Tmp()
                {
                    Title = "不限", Img = "unlimited"
                },
                new Tmp()
                {
                    Title = "自行车", Img = "bike"
                },
                new Tmp()
                {
                    Title = "电瓶车", Img = "tram"
                },
                new Tmp()
                {
                    Title = "驾车", Img = "car"
                },
            };

            this.Selected = this.Datas.First();
        }
Beispiel #2
0
        public MainBussinessViewModel()
        {
            this.Datas = new List <Tmp>()
            {
                new Tmp()
                {
                    Title = "休闲食品"
                },
                new Tmp()
                {
                    Title = "生鲜果蔬"
                },
                new Tmp()
                {
                    Title = "办公/居家"
                },
                new Tmp()
                {
                    Title = "鲜花"
                },
                new Tmp()
                {
                    Title = "蛋糕"
                },
                new Tmp()
                {
                    Title = "其它"
                }
            };

            this.Selected = this.Datas.First();
        }
Beispiel #3
0
            /// <summary>
            /// todoComment
            /// </summary>
            /// <param name="AKey"></param>
            /// <param name="AValue"></param>
            public static void SetUserDefault(String AKey, String AValue)
            {
                Int32       FoundInRow;
                DataRowView Tmp;

                FoundInRow = UUserDefaults.Find(AKey);

                if (FoundInRow != -1)
                {
                    // User default found
                    if (AValue != UUserDefaults[FoundInRow][SUserDefaultsTable.GetDefaultValueDBName()].ToString())
                    {
                        // Update only if the value is actually different
                        UUserDefaults[FoundInRow][SUserDefaultsTable.GetDefaultValueDBName()] = AValue;
                    }
                }
                else
                {
                    // User default not found, add it to the user defaults table
                    Tmp = UUserDefaults.AddNew();
                    Tmp[SUserDefaultsTable.GetUserIdDBName()]       = Ict.Petra.Shared.UserInfo.GUserInfo.UserID;
                    Tmp[SUserDefaultsTable.GetDefaultCodeDBName()]  = AKey;
                    Tmp[SUserDefaultsTable.GetDefaultValueDBName()] = AValue;
                    Tmp.EndEdit();
                }
            }
Beispiel #4
0
 public Form1()
 {
     InitializeComponent();
     string value = "Document 1";
     
     if (Tmp.InputBox("New document", "New document name:", ref value, new Bitmap("Your Image Here") == DialogResult.OK)
     {
         this.Text = value;
     }
 }
Beispiel #5
0
 public void Add_Path(String Path)
 {
     foreach (String Tmp in Path.Split(';'))
     {
         if (Tmp.IndexOfAny(new char[] { '\0', ' ', '\n', '\r' }) != 0 && Tmp.Equals("") == false)
         {
             Console.WriteLine(Tmp);
             this.Path[Cur_Methods].Add(Tmp);
         }
     }
 }
Beispiel #6
0
 /// <summary>
 /// エラーが出るのが嫌すぎてここだけ慣れないtry文使った。
 /// 今後はもっと使いたい。
 /// 参考 https://ufcpp.net/study/csharp/oo_exception.html
 /// </summary>
 void Start()
 {
     try
     {
         tmp = GameObject.Find("Test").GetComponent <Tmp>();
     }
     catch (NullReferenceException)
     {
         Debug.Log("TestがSceneに存在しません");
     }
 }
Beispiel #7
0
        public IActionResult OnPost()
        {
            string Controllo = Request.Form["controlTelefono"];
            string idRiga    = Request.Form["rigaCancellare"];

            if (Controllo != "fail")
            {
                string Nome     = Request.Form["Nome"];
                string Telefono = Request.Form["Telefono"];
                try
                {
                    DateTime Data = Convert.ToDateTime(Request.Form["Data"]);
                    string   Sum  = System.IO.File.ReadAllText(Path);
                    System.IO.File.WriteAllText(Path, Sum + Environment.NewLine + Nome + ";" + Telefono + ";" + Data.ToString("yyyy-MM-dd"));
                }
                catch { }
            }

            if (idRiga != "")
            {
                Dictionary <int, List <string> > MatriceRighe = new Dictionary <int, List <string> >();

                //popolo il dizionario matrice dal file txt
                Testo = System.IO.File.ReadAllText(Path);
                string[] Tmprighe = Testo.Split(Environment.NewLine);

                int    h = Tmprighe.Length;
                int    f = 0;
                string Tmp;

                while (f < h)
                {
                    Tmp = Tmprighe[f];
                    List <string> colonne = Tmp.Split(';').ToList(); //lista delle 3 colonne nome tel data
                    MatriceRighe.Add(f, colonne);
                    f += 1;
                }

                int id = Int32.Parse(idRiga);

                MatriceRighe.Remove(id);

                var csvLines = MatriceRighe.Values.Select(riga => string.Join(";", riga));
                var csv      = string.Join("\r\n", csvLines);
                System.IO.File.WriteAllText(Path, csv);
            }
            return(RedirectToPage("/Index"));
        }
Beispiel #8
0
        public void OnGet()
        {
            //popolo il dizionario matrice dal file txt
            Testo = System.IO.File.ReadAllText(Path);
            string[] Tmprighe = Testo.Split(Environment.NewLine);

            int n = Tmprighe.Length;

            i = 0;
            string Tmp;

            while (i < n)
            {
                Tmp = Tmprighe[i];
                List <string> colonne = Tmp.Split(';').ToList(); //lista delle 3 colonne nome tel data
                Matrice.Add(i, colonne);
                i += 1;
            }
        }
Beispiel #9
0
        private void addURL_Click(object sender, EventArgs e)
        {
            string reg   = @"https:\/\/youtu.be\/([a-zA-Z0-9]){11}";
            string value = "https://youtu.be/";

            if (Tmp.InputBox("Tiny youtube url hozzáadása", "Adja meg a tiny youtube url-t:", ref value) == DialogResult.OK)
            {
                if (Regex.IsMatch(value, reg))
                {
                    connection.Open();
                    SqlDataReader command = new SqlCommand($"update Tracks set url = '{value.Remove(0, 17)}' where title like '{dgwTitles.SelectedRows[0].Cells[0].Value.ToString()}'", connection).ExecuteReader();
                    connection.Close();
                }
                else
                {
                    MessageBox.Show("Nem megfelelő link!");
                }
            }
        }
Beispiel #10
0
        protected internal void parse()
        {
            Tokenizer st = new Tokenizer(rawData, "{");

            try
            {
                if (st.HasMoreTokens())
                {
                    type = st.NextToken().Trim();
                }
                else
                {
                    return;
                }

                size = st.Count;

                segments = new NameValueCollection[size];

                string Tmp, Name, Value;

                Tokenizer tst = null;

                for (int i = 0; st.HasMoreTokens(); i++)
                {
                    Tmp = st.NextToken().Trim();
                    Tmp = Tmp.Substring(0, Tmp.Length - 1);
                    tst = new Tokenizer(Tmp, delimiter);

                    segments[i] = new NameValueCollection();

                    while (tst.HasMoreTokens())
                    {
                        Name  = tst.NextToken();
                        Value = tst.NextToken();
                        segments[i].Add(Name, Value);
                    }
                }
            }
            catch (Exception e)
            {
            }
        }
Beispiel #11
0
        private void _toolStripMenuItem_Click(object sender, EventArgs e)
        {
            /*foreach (ToolStripMenuItem item in toolStripMenuItem2.DropDownItems)
             * {
             *  item.Checked = false;
             * }
             * ((ToolStripMenuItem)sender).Checked = true;*/
            //string s = string.Format("{0}\n{1}", sender.ToString(), e.ToString());
            //MessageBox.Show(s);
            String txt   = event_Buttons[now_click_btn].Text;
            String value = "";

            if ((((ToolStripMenuItem)sender).Text.Split('_')[0]) == "Run")
            {
                event_Buttons[now_click_btn].Text = ((ToolStripMenuItem)sender).Text;
            }
            else if ((((ToolStripMenuItem)sender).Text.Split('_')[0]) == "Send")
            {
                event_Buttons[now_click_btn].Text = ((ToolStripMenuItem)sender).Text;
            }
            else if ((((ToolStripMenuItem)sender).Text).Equals("원하는 내용입력"))
            {
                if (Tmp.InputBox("입력", "입력하고 싶은 내용", ref value) == DialogResult.OK)
                {
                    if (value.Split('_')[0].Equals("Send") || value.Split('_')[0].Equals("Rund"))
                    {
                        MessageBox.Show("사용자 입력에서는 이벤트를 사용할 수 없습니다.");
                    }
                    else
                    {
                        if (value.Length > 100)
                        {
                            MessageBox.Show("사용자 입력내용이 너무 많습니다.");
                        }
                        else
                        {
                            event_Buttons[now_click_btn].Text = value;
                        }
                    }
                }
            }
        }
Beispiel #12
0
        public void Add_Methods(String Name, String Methods, String Path)
        {
            int n = Find_Project_Pos(Name);

            if (n >= 0)
            {
                List <String> SubPath = new List <String>();
                this.Path.Add(SubPath);
                this.Methods.Add(Methods);

                foreach (String Tmp in Path.Split(';'))
                {
                    if (Tmp.IndexOfAny(new char[] { '\0', ' ', '\n', '\r' }) != 0 && Tmp.Equals("") == false)
                    {
                        this.Path[Methods_Num].Add(Tmp);
                    }
                }

                Methods_Num++;
            }
        }
        private async void SaveCommandExecute()
        {
            Item.FechaReg = DateTime.Now.Month + "-" + DateTime.Now.Day + "-" + DateTime.Now.Year;

            var result = await FicLoSrvCatAlmacenes.FicMetGetListCatAlmacenes();

            var tmp = new Tmp();

            foreach (var ficPaItem in result)
            {
                if (ficPaItem.IdAlmacen.Equals(Item.IdAlmacen))
                {
                    await tmp.DisplayAlert("Advertencia", "El Id Almacén: " + Item.IdAlmacen + " ya existe. Favor de utilizar uno diferente.", "OK");

                    return;
                }
            }

            await FicLoSrvCatAlmacenes.FicMetInsertNewCatAlmacen(Item);

            FicLoSrvNavigationInventario.FicMetNavigateBack();
        }
Beispiel #14
0
        public void GetCacheTest()
        {
            Tmp tmp = new Tmp()
            {
                Str = "A"
            };

            cacheManager.Get("GetCacheTest", () => tmp)
            .Str
            .Should()
            .Be("A");

            tmp.Str = "B";

            cacheManager.Get("GetCacheTest", () => new Tmp()
            {
                Str = "C"
            })
            .Str
            .Should()
            .Be("B");
        }
        public GoodsInfoViewModel()
        {
            this.Datas = new List <Tmp>()
            {
                new Tmp()
                {
                    Title = "休闲食品"
                },
                new Tmp()
                {
                    Title = "生鲜果蔬"
                },
                new Tmp()
                {
                    Title = "办公/居家"
                },
                new Tmp()
                {
                    Title = "鲜花"
                },
                new Tmp()
                {
                    Title = "蛋糕"
                },
                new Tmp()
                {
                    Title = "大件物品"
                },
                new Tmp()
                {
                    Title = "其它"
                }
            };

            this.Selected = this.Datas.First();
        }
Beispiel #16
0
        /// <summary>
        /// 上传设置到窗帘模块
        /// </summary>
        /// <param name="DIndex"></param>
        /// <param name="DevID"></param>
        /// <param name="DeviceType"></param>
        /// <param name="DevName"></param>
        /// <returns></returns>
        public bool UploadCurtainInfosToDevice(string DevName, int PageIndex, int DeviceType)
        {
            string strMainRemark = DevName.Split('\\')[1].Trim().Split('(')[0].Trim();
            String TmpDevName    = DevName.Split('\\')[0].Trim();

            //保存basic informations
            byte SubNetID = byte.Parse(TmpDevName.Split('-')[0].ToString());
            byte DeviceID = byte.Parse(TmpDevName.Split('-')[1].ToString());

            byte[] ArayMain      = new byte[20];
            byte[] arayTmpRemark = HDLUDP.StringToByte(strMainRemark);
            if (arayTmpRemark.Length > 20)
            {
                Array.Copy(arayTmpRemark, 0, ArayMain, 0, 20);
            }
            else
            {
                Array.Copy(arayTmpRemark, 0, ArayMain, 0, arayTmpRemark.Length);
            }

            if (CsConst.mySends.AddBufToSndList(ArayMain, 0x0010, SubNetID, DeviceID, false, true, true, false) == false)
            {
                return(false);
            }
            if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
            {
                CsConst.calculationWorker.ReportProgress(10, null);
            }
            if (PageIndex == 0 || PageIndex == 1)
            {
                netWork.ModifyNetworkInfomation(SubNetID, DeviceID);
                #region
                byte[] arayTmp = new byte[57];
                arayTmp[0] = bytWorkType;

                arayTmpRemark = HDLUDP.StringToByte(strGroup);
                Array.Copy(arayTmpRemark, 0, arayTmp, 1, arayTmpRemark.Length);
                arayTmpRemark = HDLUDP.StringToByte(strPrjName);
                Array.Copy(arayTmpRemark, 0, arayTmp, 21, arayTmpRemark.Length);
                arayTmpRemark = HDLUDP.StringToByte(strUser);
                Array.Copy(arayTmpRemark, 0, arayTmp, 41, arayTmpRemark.Length);
                arayTmpRemark = HDLUDP.StringToByte(strPWD);
                Array.Copy(arayTmpRemark, 0, arayTmp, 49, arayTmpRemark.Length);

                if (CsConst.mySends.AddBufToSndList(arayTmp, 0x3003, SubNetID, DeviceID, false, true, true, false) == false)
                {
                    return(false);
                }
                if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
                {
                    CsConst.calculationWorker.ReportProgress(20, null);
                }

                arayTmp = new byte[14];
                string[] strTmp = strServer1.Split('.');
                for (int i = 0; i < 4; i++)
                {
                    arayTmp[i] = byte.Parse(strTmp[i].ToString());
                }
                arayTmp[4] = (byte)(intPort1 / 256);
                arayTmp[5] = (byte)(intPort1 % 256);

                strTmp = strServer2.Split('.');
                for (int i = 0; i < 4; i++)
                {
                    arayTmp[i + 6] = byte.Parse(strTmp[i].ToString());
                }
                arayTmp[10] = (byte)(intPort2 / 256);
                arayTmp[11] = (byte)(intPort2 % 256);
                arayTmp[12] = bytEnDHCP;
                arayTmp[13] = bytTimer;


                if (CsConst.mySends.AddBufToSndList(arayTmp, 0x3005, SubNetID, DeviceID, false, true, true, false) == false)
                {
                    return(false);
                }
                if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
                {
                    CsConst.calculationWorker.ReportProgress(30, null);
                }
                #endregion
            }

            if (PageIndex == 0 || PageIndex == 2)
            {
                //上传拦截列表
                #region
                byte bytI = 0;
                if (MyBlocks != null)
                {
                    foreach (RFBlock Tmp in MyBlocks)
                    {
                        Tmp.ModifyfBlockSetupInformation(SubNetID, DeviceID, bytI);
                        if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
                        {
                            CsConst.calculationWorker.ReportProgress(50 + bytI);
                        }
                        bytI++;
                    }
                }
                #endregion
            }

            if (PageIndex == 0 || PageIndex == 3) // 无线遥控器或者无源开关
            {
                #region
                // 上传无源开关的地址
                byte[] RemoteAddress = new Byte[11];
                RemoteControllers.CopyTo(RemoteAddress, 3);
                if (CsConst.mySends.AddBufToSndList(RemoteAddress, 0xE012, SubNetID, DeviceID, false, true, true, false))
                {
                    return(false);
                }

                Byte ValidRemoteNumber = 4;
                //判断地址是不是全部一样 一样保存一个即可
                if (((RemoteAddress[3] == RemoteAddress[5]) && (RemoteAddress[5] == RemoteAddress[7]) && (RemoteAddress[7] == RemoteAddress[9])) &&
                    ((RemoteAddress[4] == RemoteAddress[6]) && (RemoteAddress[6] == RemoteAddress[8]) && (RemoteAddress[8] == RemoteAddress[10])))
                {
                    ValidRemoteNumber = 1;
                }

                for (Byte i = 0; i < ValidRemoteNumber; i++)
                {
                    //无效地址不保存
                    if (RemoteAddress[3 + i * 2] == 0 && RemoteAddress[4 + i * 2] == 0)
                    {
                        continue;
                    }
                    if (RemoteAddress[3 + i * 2] == 255 && RemoteAddress[4 + i * 2] == 255)
                    {
                        continue;
                    }

                    Byte[] arayKeyMode   = new Byte[IPmoduleDeviceTypeList.HowManyButtonsEachPage];
                    Byte[] arayKeyMutex  = new Byte[IPmoduleDeviceTypeList.HowManyButtonsEachPage];
                    Byte[] arayKeyDimmer = new Byte[IPmoduleDeviceTypeList.HowManyButtonsEachPage];
                    Byte[] arayKeyLED    = new Byte[IPmoduleDeviceTypeList.HowManyButtonsEachPage];

                    for (int j = 0; j < IPmoduleDeviceTypeList.HowManyButtonsEachPage; j++)
                    {
                        HDLButton TmpKey = MyRemoteControllers[i * IPmoduleDeviceTypeList.HowManyButtonsEachPage + j];
                        // key mode and dimmer valid
                        arayKeyMode[TmpKey.ID - 1]   = TmpKey.Mode;
                        arayKeyMutex[TmpKey.ID - 1]  = TmpKey.bytMutex;
                        arayKeyDimmer[TmpKey.ID - 1] = byte.Parse(((TmpKey.IsDimmer << 4) + TmpKey.SaveDimmer).ToString());
                        arayKeyLED[TmpKey.ID - 1]    = (byte)(TmpKey.IsLEDON);

                        if (TmpKey.Mode == 0 || TmpKey.Mode > 30)
                        {
                            continue;
                        }

                        TmpKey.UploadButtonRemarkAndCMDToDevice(SubNetID, DeviceID, DeviceType, i + 1, 255);
                        if (TmpKey.ID + 2 < 15)
                        {
                            if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
                            {
                                CsConst.calculationWorker.ReportProgress(2 + TmpKey.ID);
                            }
                        }
                    }
                    // upload all key mode
                    if (CsConst.mySends.AddBufToSndList(arayKeyMode, 0xE00A, SubNetID, DeviceID, false, true, true, true) == false)
                    {
                        return(false);
                    }
                    HDLUDP.TimeBetwnNext(64);

                    SaveButtonDimFlagToDeviceFrmBuf(i, SubNetID, DeviceID, DeviceType);
                    CsConst.myRevBuf = new byte[1200];
                }
                #endregion
            }

            if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
            {
                CsConst.calculationWorker.ReportProgress(100, null);
            }
            return(true);
        }
 private static void VMSChanged(BindableObject bindable, INotifyCollectionChanged oldValue, INotifyCollectionChanged newValue) {
     var tab = (TabbedPage)bindable;
     var tmp = new Tmp(tab, newValue);
 }
Beispiel #18
0
        public void Eliminar(string path)
        {
            Console.Clear();
            Console.BackgroundColor = ConsoleColor.DarkMagenta;
            StreamReader Lectura;
            StreamWriter Tmp;
            string       Busqueda, Line, res;

            Busqueda = " ";
            Line     = " ";
            res      = " ";
            bool ValorBuscado;

            ValorBuscado = false;
            string[] tabla     = new string[6];
            char[]   indicador = { ';' };
            try
            {
                using (Lectura = File.OpenText(path))
                {
                    Tmp = File.CreateText("Tmp.txt");
                    Console.WriteLine("Ingrese el numero de control a eliminar");
                    Busqueda = Console.ReadLine();
                    Line     = Lectura.ReadLine();

                    while (Line != null)
                    {
                        tabla = Line.Split(indicador);
                        if (tabla[0].Trim().Equals(Busqueda))
                        {
                            Console.WriteLine("Deseas eliminar el registro?");
                            res = Console.ReadLine();
                            if ((res.ToUpper()) == "S")
                            {
                                ValorBuscado = true;
                            }
                            else
                            {
                                return;
                            }
                        }
                        else
                        {
                            Tmp.WriteLine(Line);
                        }
                        Line = Lectura.ReadLine();
                    }
                    if (ValorBuscado == false)
                    {
                        Console.WriteLine("EL alumno con número de control {0} no está en la base ", Busqueda);
                    }
                    else
                    {
                        Console.WriteLine("EL alumno con número de control {0} ha sido eliminado ", Busqueda);
                    }
                    Lectura.Close();
                    Tmp.Close();
                    File.Delete("miarchivo.txt");
                    File.Move("Tmp.txt", "miarchivo.txt");
                }
            }
            catch (Exception)
            {
                Console.WriteLine("No se puede leer el archivo");
            }
        }
 private static void VMSChanged(BindableObject bindable, INotifyCollectionChanged oldValue, INotifyCollectionChanged newValue)
 {
     var tab = (TabbedPage)bindable;
     var tmp = new Tmp(tab, newValue);
 }
Beispiel #20
0
        public void Editar(string path)
        {
            Console.Clear();
            Console.BackgroundColor = ConsoleColor.DarkYellow;
            StreamReader Lectura;
            StreamWriter Tmp;
            int          op;
            string       Busqueda, Line, res, CampoNuevo;

            CampoNuevo = " ";
            Busqueda   = " ";
            Line       = " ";
            res        = " ";
            op         = 0;
            bool ValorBuscado;

            ValorBuscado = false;
            string[] tabla     = new string[6];
            char[]   indicador = { ';' };
            try
            {
                using (Lectura = File.OpenText(path))
                {
                    Tmp = File.CreateText("Tmp.txt");
                    Console.WriteLine("Ingrese el numero de control a modificar");
                    Busqueda = Console.ReadLine();
                    Line     = Lectura.ReadLine();

                    while (Line != null)
                    {
                        tabla = Line.Split(indicador);
                        if (tabla[0].Trim().Equals(Busqueda))
                        {
                            Console.WriteLine("0.Número de control: {0}", tabla[0].Trim());
                            Console.WriteLine("1.Nombre: {0}", tabla[1].Trim());
                            Console.WriteLine("2.Carrea: {0}", tabla[2].Trim());
                            Console.WriteLine("3.Direccion: {0}", tabla[3].Trim());
                            Console.WriteLine("4.Número Telefonico: {0}", tabla[4].Trim());
                            Console.WriteLine("5.Email: {0}", tabla[5].Trim());
                            ValorBuscado = true;
                            Console.WriteLine("Desea editar este registro?");
                            res = Console.ReadLine();
                            if ((res.ToUpper()) == "S")
                            {
                                try{
                                    Console.WriteLine("Ingrese el numero del campo que desea editar");
                                    op = Convert.ToInt32(Console.ReadLine());
                                    switch (op)
                                    {
                                    case 0:
                                        Console.WriteLine("El numero de control no es editable");
                                        Tmp.WriteLine(tabla[0] + "; " + tabla[1] + ";" + tabla[2] + ";" + tabla[3] + ";" + tabla[4] + ";" + tabla[5]);
                                        break;

                                    case 1:
                                        Console.WriteLine("Ingrese el nuevo nombre");
                                        CampoNuevo = Console.ReadLine();
                                        Tmp.WriteLine(tabla[0] + ";" + CampoNuevo + ";" + tabla[2] + ";" + tabla[3] + ";" + tabla[4] + ";" + tabla[5]);
                                        Console.WriteLine("Registro editado con exito!");
                                        break;

                                    case 2:
                                        Console.WriteLine("Ingrese la nueva carrera");
                                        CampoNuevo = Console.ReadLine();
                                        Tmp.WriteLine(tabla[0] + ";" + tabla[1] + ";" + CampoNuevo + ";" + tabla[3] + ";" + tabla[4] + ";" + tabla[5]);
                                        Console.WriteLine("Registro editado con exito!");
                                        break;

                                    case 3:
                                        Console.WriteLine("Ingrese la nueva dirección");
                                        CampoNuevo = Console.ReadLine();
                                        Tmp.WriteLine(tabla[0] + ";" + tabla[1] + "; " + tabla[2] + ";" + CampoNuevo + ";" + tabla[4] + "; " + tabla[5]);
                                        Console.WriteLine("Registro editado con exito!");
                                        break;

                                    case 4:
                                        Console.WriteLine("Ingrese el nuevo número telefonico");
                                        CampoNuevo = Console.ReadLine();
                                        Tmp.WriteLine(tabla[0] + ";" + tabla[1] + ";" + tabla[2] + ";" + tabla[3] + ";" + CampoNuevo + ";" + tabla[5]);
                                        Console.WriteLine("Registro editado con exito!");
                                        break;

                                    case 5:
                                        Console.WriteLine("Ingrese el nuevo número email");
                                        CampoNuevo = Console.ReadLine();
                                        Tmp.WriteLine(tabla[0] + ";" + tabla[1] + ";" + tabla[2] + ";" + tabla[3] + ";" + tabla[4] + ";" + CampoNuevo);
                                        Console.WriteLine("Registro editado con exito!");
                                        break;

                                    default:
                                        Console.WriteLine("No existe el campo ingresado");
                                        break;
                                    }
                                }catch (FormatException e) {
                                    Console.WriteLine("Entrada invalida: {0}", e.Message);
                                }
                            }
                            else
                            {
                                Tmp.WriteLine(Line);
                            }
                        }
                        else
                        {
                            Tmp.WriteLine(Line);
                        }
                        Line = Lectura.ReadLine();
                    }
                    if (ValorBuscado == false)
                    {
                        Console.WriteLine("EL alumno con número de control {0} no está en la base ", Busqueda);
                    }

                    Lectura.Close();
                    Tmp.Close();
                    File.Delete("miarchivo.txt");
                    File.Move("Tmp.txt", "miarchivo.txt");
                }
            }
            catch (Exception)
            {
                Console.WriteLine("No se puede leer el archivo");
            }
        }
Beispiel #21
0
        /// <summary>
        /// 上传设置到窗帘模块
        /// </summary>
        /// <param name="DIndex"></param>
        /// <param name="DevID"></param>
        /// <param name="DeviceType"></param>
        /// <param name="DevName"></param>
        /// <returns></returns>
        public bool UploaDeviceFromBufferToDevice(string DevName, int wdDeviceType)
        {
            byte bytI = 1;

            string strMainRemark = DevName.Split('\\')[1].Trim().Split('(')[0].Trim();

            DevName = DevName.Split('\\')[0].Trim();

            //保存basic informations
            byte bytSubID = byte.Parse(DevName.Split('-')[0].ToString());
            byte bytDevID = byte.Parse(DevName.Split('-')[1].ToString());

            byte[] ArayMain = new byte[20];

            if (HDLSysPF.ModifyDeviceMainRemark(bytSubID, bytDevID, strMainRemark, wdDeviceType) == false)
            {
                return(false);
            }
            if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
            {
                CsConst.calculationWorker.ReportProgress(2);
            }
            HDLUDP.TimeBetwnNext(20);
            #region
            if (CurtainDeviceType.NormalCurtainG1DeviceType.Contains(wdDeviceType) || CurtainDeviceType.CurtainG2DeviceType.Contains(wdDeviceType))
            {
                if (Curtains != null)
                {
                    foreach (BasicCurtain Tmp in Curtains)
                    {
                        Tmp.ModifyCurtainSetupInformation(bytSubID, bytDevID, bytI, wdDeviceType);
                        bytI++;
                    }
                }
            }
            else
            {
                if (CurtainDeviceType.NormalMotorCurtainDeviceType.Contains(wdDeviceType))
                {
                    bytCurType = 2;
                }
                else if (CurtainDeviceType.RollerCurtainDeviceType.Contains(wdDeviceType))
                {
                    bytCurType = 2;
                }
                else
                {
                    bytCurType = 1;
                }
                //if new curtain, add jog time to it
                if (bytCurType == 1)
                {
                    byte[] arayTmp = new byte[3];
                    arayTmp[0] = 1;
                    arayTmp[1] = byte.Parse((intJogTime / 256).ToString());
                    arayTmp[2] = byte.Parse((intJogTime % 256).ToString());
                    if (CsConst.mySends.AddBufToSndList(arayTmp, 0x1C74, bytSubID, bytDevID, false, true, true, CsConst.minAllWirelessDeviceType.Contains(wdDeviceType)) == false)
                    {
                        return(false);
                    }
                    HDLUDP.TimeBetwnNext(3);

                    //if new curtain, add jog time to it
                    arayTmp[0] = 2;
                    arayTmp[1] = byte.Parse((intJogTime1 / 256).ToString());
                    arayTmp[2] = byte.Parse((intJogTime1 % 256).ToString());
                    if (CsConst.mySends.AddBufToSndList(arayTmp, 0x1C74, bytSubID, bytDevID, false, true, true, CsConst.minAllWirelessDeviceType.Contains(wdDeviceType)) == false)
                    {
                        return(false);
                    }
                    HDLUDP.TimeBetwnNext(20);

                    //if new curtain, add jog time to it
                    arayTmp[0] = 3;
                    arayTmp[1] = byte.Parse((intJogTime2 / 256).ToString());
                    arayTmp[2] = byte.Parse((intJogTime2 % 256).ToString());
                    if (CsConst.mySends.AddBufToSndList(arayTmp, 0x1C74, bytSubID, bytDevID, false, true, true, CsConst.minAllWirelessDeviceType.Contains(wdDeviceType)) == false)
                    {
                        return(false);
                    }
                    HDLUDP.TimeBetwnNext(20);

                    //if new curtain, add jog time to it
                    arayTmp[0] = 4;
                    arayTmp[1] = byte.Parse((intJogTime3 / 256).ToString());
                    arayTmp[2] = byte.Parse((intJogTime3 % 256).ToString());
                    if (CsConst.mySends.AddBufToSndList(arayTmp, 0x1C74, bytSubID, bytDevID, false, true, true, CsConst.minAllWirelessDeviceType.Contains(wdDeviceType)) == false)
                    {
                        return(false);
                    }
                    HDLUDP.TimeBetwnNext(20);
                }
                else if (bytCurType == 2)
                {
                    byte[] arayTmp = new byte[9];
                    arayTmp[0] = bytInvert;
                    arayTmp[1] = bytAutoMeasure;
                    arayTmp[2] = bytDragMode;
                    arayTmp[3] = byte.Parse((intDragLong * 100 / 256).ToString());
                    arayTmp[4] = byte.Parse((intDragLong * 100 % 256).ToString());
                    arayTmp[5] = byte.Parse((intDragShort * 100 / 256).ToString());
                    arayTmp[6] = byte.Parse((intDragShort * 100 % 256).ToString());
                    arayTmp[7] = byte.Parse((intDragSafe * 100 / 256).ToString());
                    arayTmp[8] = byte.Parse((intDragSafe * 100 % 256).ToString());

                    if (CurtainDeviceType.RollerCurtainDeviceType.Contains(wdDeviceType))
                    {
                        for (int i = 1; i < 9; i++)
                        {
                            arayTmp[i] = 0;
                        }
                    }
                    if (CsConst.mySends.AddBufToSndList(arayTmp, 0x1F00, bytSubID, bytDevID, false, false, true, CsConst.minAllWirelessDeviceType.Contains(wdDeviceType)) == true)
                    {
                        if (CsConst.myRevBuf[25] == 0xF5)
                        {
                            MessageBox.Show(CsConst.mstrINIDefault.IniReadValue("Public", "99606", ""), "",
                                            MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                            return(false);
                        }
                        CsConst.myRevBuf = new byte[1200];
                    }
                    else
                    {
                        MessageBox.Show(CsConst.mstrINIDefault.IniReadValue("Public", "99606", ""), "",
                                        MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                        return(false);
                    }
                    HDLUDP.TimeBetwnNext(3);
                }
            }
            #endregion
            if (CsConst.calculationWorker != null && CsConst.calculationWorker.IsBusy)
            {
                CsConst.calculationWorker.ReportProgress(100, null);
            }
            return(true);
        }