コード例 #1
0
        void savecheckset()
        {
            List <systemcheckset> ls = new List <systemcheckset>();

            try {
                systemcheckset s = new systemcheckset();
                s.throwvalue = Convert.ToDecimal(this.tb_throw.Text.Trim());
                // s.boundaryvalue = Convert.ToDecimal(this.tb_jmax .Text .Trim  ());
                s.count       = Convert.ToInt32(this.tb_jcount.Text.Trim());
                s.arry        = Convert.ToInt32(this.tb_jarry.Text.Trim());
                s.ishavejuser = (this.rb_true.IsChecked == null || this.rb_true.IsChecked == false) ? false : true;
                s.noticeshow  = (this.rb_show.IsChecked == null || this.rb_show.IsChecked == false) ? false : true;
                s.noticetime  = Convert.ToInt32(this.tb_hour.Text.Trim()).ToString("D2") + ":" + Convert.ToInt32(this.tb_min.Text.Trim()).ToString("D2") + ":" + Convert.ToInt32(this.tb_second.Text.Trim()).ToString("D2");
                s.noticedays  = this.tb_day.Text.Trim();
                ls.Add(s);
                if (SerializeXML <systemcheckset> .exit())
                {
                    SerializeXML <systemcheckset> .del();
                }
                SerializeXML <systemcheckset> .SaveList(ls);

                MessageAlert.Alert("设置成功!");
            }

            catch (Exception ex) { MessageAlert.Error("出错!" + ex); }
        }
コード例 #2
0
        public void Should_Pass_ExcpectedResults()
        {
            string expected = "{\"foo\":\"bar\"}";
            string result   = SerializeXML.XmlToJson("<foo>bar</foo>");

            Assert.AreEqual(expected, result);
        }
コード例 #3
0
        decimal CheckDataValidate(decimal checkdata)
        {
            try
            {
                systemcheckset        sysset = null;
                List <systemcheckset> scsl   = SerializeXML <systemcheckset> .Getlist();

                if (scsl != null || scsl.Count > 0)
                {
                    sysset = scsl.FirstOrDefault();
                }
                if (sysset == null || sysset.throwvalue == null || sysset.throwvalue <= 0)
                {
                    return(checkdata);
                }
                decimal targetvalue  = Convert.ToDecimal(GetTargetValue());
                decimal throwdatemin = targetvalue * (((sysset.throwvalue ?? 0) / 100));
                decimal throwdatemax = targetvalue * (1 + ((sysset.throwvalue ?? 0) / 100));
                if (targetvalue > throwdatemax || targetvalue < throwdatemin)
                {
                    return(0);
                }
                return(checkdata);
            }
            catch { return(0); }
        }
コード例 #4
0
 private void ResetSizes_Click(object sender, EventArgs e)
 {
     CreateBtn.Enabled = true;
     new DBController().AddDetailsSet();
     SerializeXML.Clear();
     ui.SyncSizes(groupBox1);
 }
コード例 #5
0
 private void ResetSizes_Click(object sender, EventArgs e)
 {
     CreateBtn.Enabled = true;
     new DBController().AddDetailsSet();
     //new SerializeXML(Status.CurrentDirectory + @"\FEMAP\SIZES.xml").Clear();
     SerializeXML.Clear();
     ui.SyncSizes(groupBox1);
 }
コード例 #6
0
 void savetester()
 {
     if (SerializeXML <TorqueTestModel> .exit())
     {
         SerializeXML <TorqueTestModel> .del();
     }
     SerializeXML <TorqueTestModel> .SaveList(ttmlist);
 }
コード例 #7
0
 private void ResetSizes_Click(object sender, EventArgs e)
 {
     CreateBtn.Enabled = true;
     new DBController().AddDetailsSet();
     //  new SerializeXML(@"C:\FemapModels\SIZES.xml").Clear();
     SerializeXML.Clear();
     ui.SyncSizes(groupBox1);
 }
コード例 #8
0
        //void AddToList(ShowCheckresult sc)
        //{
        //    if (sc == null) return;
        //    if (CountPlus(sc))
        //    {

        //        sc.id = id;
        //        showcheckset.Add(sc);
        //        CheckDataBind();
        //        id++;

        //    }
        //}

        bool CountPlus(decimal checkdata)
        {
            systemcheckset        sysset = null;
            List <systemcheckset> scsl   = SerializeXML <systemcheckset> .Getlist();

            if (scsl != null || scsl.Count > 0)
            {
                sysset = scsl.FirstOrDefault();
            }
            if (procheckdata)
            {
                successcount++;
            }

            if (successcount > sysset.count)
            {
                arry         = sysset.arry ?? 1;
                successcount = 0;
                arry         = 4;
            }

            if (arry > sysset.arry)
            {
                finisharry++;
                NextCheck(finisharry);
                successcount = 0;
                arry         = 1;
                procheckdata = true;
            }

            if (finisharry > 3)
            {
                isFinishCheck = true;
                return(false);
            }

            ShowCheckresult sc = CheckResult(checkdata);

            sc.id = id;
            showcheckset.Add(sc);
            CheckDataBind();
            id++;

            if (sc.result.Equals("√"))
            {
                procheckdata = true;

                this.lb_status.Content = "本次不合格!";
            }
            else
            {
                procheckdata = false;
                successcount = 0;
                arry++;
                this.lb_status.Content = "本次不合格!";
            }
            return(true);
        }
コード例 #9
0
        void saveErrorRang(errorrangset et)
        {
            errorrangset er = new errorrangset();

            er = et;
            try
            {
                er.speciesID    = this.cb_species.SelectedValue.ToString();
                er.speciesname  = (this.cb_species.SelectedItem as wrenchspecies).speciesName;
                er.rangmax      = Convert.ToDecimal(this.tb_max.Text.Trim());
                er.rangmin      = Convert.ToDecimal(this.tb_min.Text.Trim());
                er.errorrangMax = Convert.ToDecimal(this.tb_errormax.Text.Trim());
                er.errorrangMin = Convert.ToDecimal(this.tb_errormin.Text.Trim());
                er.errorrang    = _errorrangset.errorrangMin.ToString() + "~" + _errorrangset.errorrangMax.ToString();
                er.rangvalue    = this.tb_min.Text.Trim() + "~" + this.tb_max.Text.Trim();
            }
            catch
            {
                MessageAlert.Error("请填写正确的数值!"); return;
            }
            if (!string.IsNullOrEmpty(er.guid))
            {
                if (errorset.FindIndex(p => p.guid == er.guid) >= 0)
                {
                    errorset.RemoveAt(errorset.FindIndex(p => p.guid == er.guid));
                }
            }
            else
            {
                er.guid = Guid.NewGuid().ToString();
            }

            List <errorrangset> esl = errorset.FindAll(p => p.speciesname == er.speciesname);

            foreach (errorrangset e in esl)
            {
                if ((e.rangmin < er.rangmax && er.rangmax <= e.rangmax) || (e.rangmin <= er.rangmin && er.rangmin < e.rangmax))
                {
                    MessageAlert.Alert("设置数值范围重合!");
                    return;
                }
                if ((er.rangmax >= e.rangmax) && (er.rangmin <= e.rangmin))
                {
                    MessageAlert.Alert("设置数值范围重合!");
                    return;
                }
            }

            errorset.Add(er);
            if (SerializeXML <errorrangset> .exit())
            {
                SerializeXML <errorrangset> .del();
            }
            SerializeXML <errorrangset> .SaveList(errorset);

            getErrorRanng();
            Clear();
        }
コード例 #10
0
        void showtester()
        {
            try
            {
                ttmlist = SerializeXML <TorqueTestModel> .Getlist();

                if (ttmlist.Count > 0)
                {
                    TorqueTestModel t1 = ttmlist.Find(p => p.testername == "校验仪1");
                    TorqueTestModel t2 = ttmlist.Find(p => p.testername == "校验仪2");
                    if (t1 != null)
                    {
                        this.tb_1max.Text    = t1.maxvalue.ToString();
                        this.tb_1min.Text    = t1.minvalue.ToString();
                        this.tb_databit.Text = t1.databit.ToString();
                        foreach (string s in cb_name.Items)
                        {
                            if (s == t1.portname)
                            {
                                cb_name.SelectedItem = t1.portname;
                            }
                        }

                        foreach (int i in cb_baundrate.Items)
                        {
                            if (i == t1.baundrate)
                            {
                                cb_baundrate.SelectedItem = t1.baundrate;
                            }
                        }
                    }
                    if (t2 != null)
                    {
                        this.tb_2max.Text     = t2.maxvalue.ToString();
                        this.tb_2min.Text     = t2.minvalue.ToString();
                        this.tb_2databit.Text = t2.databit.ToString();
                        foreach (string s in cb_2name.Items)
                        {
                            if (s == t2.portname)
                            {
                                cb_2name.SelectedItem = t2.portname;
                            }
                        }

                        foreach (int i in cb_2baundrate.Items)
                        {
                            if (i == t2.baundrate)
                            {
                                cb_2baundrate.SelectedItem = t2.baundrate;
                            }
                        }
                    }
                }
            }
            catch { }
        }
コード例 #11
0
        systemcheckset GetSystem()
        {
            List <systemcheckset> scsl = SerializeXML <systemcheckset> .Getlist();

            if (scsl != null && scsl.Count > 0)
            {
                return(scsl.FirstOrDefault());
            }
            return(new systemcheckset());
        }
コード例 #12
0
ファイル: Class1.cs プロジェクト: OldTangN/TorqueCheckManage
        /// <summary>
        /// 获取设置校验次数组数
        /// </summary>
        void getSystemSet()
        {
            List <systemcheckset> scsl = SerializeXML <systemcheckset> .Getlist();

            if (scsl != null || scsl.Count > 0)
            {
                sysset = scsl.FirstOrDefault();
            }
            sysset = null;
        }
コード例 #13
0
        public int CheckdetailCount()
        {
            int i = 5;
            List <systemcheckset> scsl = SerializeXML <systemcheckset> .Getlist();

            if (scsl != null || scsl.Count > 0)
            {
                i = scsl.FirstOrDefault().count ?? 5;
            }
            return(i);
        }
コード例 #14
0
        List <PowerList> Getxml()
        {
            List <PowerList> templ = new List <PowerList>();

            try {
                templ = SerializeXML <PowerList> .Getlist();

                return(templ);
            }
            catch { return(templ); }
        }
コード例 #15
0
        void getsystemset()
        {
            string porterror = "";

            ttml = SerializeXML <TorqueTestModel> .Getlist();

            if (ttml.Count > 0)
            {
                _tester1 = ttml.Find(p => p.testername == "校验仪1");
                if (_tester1 != null)
                {
                    try
                    {
                        _t1.PortName = _tester1.portname;
                        _t1.BaudRate = _tester1.baundrate;
                        _t1.DataBits = _tester1.databit;
                        porterror   += "校验仪1链接端口为" + _tester1.portname;
                    }
                    catch
                    {
                        porterror += "校验仪1端口配置失败!";
                        //  MessageAlert.Error("校验仪1端口打开失败!");
                    }
                    finally
                    {
                        this.porterror.Content = porterror;
                    }
                }
                _tester2 = ttml.Find(p => p.testername == "校验仪2");
                if (_tester2 != null)
                {
                    try
                    {
                        _t2.PortName = _tester2.portname;
                        _t2.BaudRate = _tester2.baundrate;
                        _t2.DataBits = _tester2.databit;
                        porterror   += "     校验仪2链接端口为" + _tester2.portname;
                    }
                    catch
                    {
                        porterror += "校验仪2端口配置失败!";
                        // MessageAlert.Error("校验仪2端口打开失败!");
                    }
                    finally
                    {
                        this.porterror.Content = "提示: " + porterror;
                    }
                }
            }
        }
コード例 #16
0
ファイル: Program.cs プロジェクト: akaDova/Tracer
        static void Main(string[] args)
        {
            var tracer = new Tracer();

            new Example(tracer).Method();
            TraceResult result     = tracer.GetTraceResult();
            var         serialJSON = new SerializeJSON();
            var         serialXML  = new SerializeXML();

            new ConsoleWriter(result).WriteData(serialJSON.SerializeResult);
            new ConsoleWriter(result).WriteData(serialXML.SerializeResult);
            new FileWriter(result, "./result.json").WriteData(serialJSON.SerializeResult);
            new FileWriter(result, "./result.xml").WriteData(serialXML.SerializeResult);
        }
コード例 #17
0
 void getErrorRanng()
 {
     errorset = new List <errorrangset>();
     try
     {
         errorset = SerializeXML <errorrangset> .Getlist();
     }
     catch
     {
         //MessageAlert.Alert("没有误差方案数据!"); return;
     }
     if (errorset.Count >= 0)
     {
         this.dg_set.ItemsSource = null;
         this.dg_set.ItemsSource = errorset;
     }
 }
コード例 #18
0
        private void Mainwindow_Loaded(object sender, RoutedEventArgs e)
        {
            // this.WindowState = System.Windows.WindowState.Normal;
            //  this.WindowStyle = System.Windows.WindowStyle.None;
            //this.ResizeMode = System.Windows.ResizeMode.NoResize;

            this.Left   = 0.0;
            this.Top    = 0.0;
            this.Width  = System.Windows.SystemParameters.PrimaryScreenWidth;
            this.Height = System.Windows.SystemParameters.PrimaryScreenHeight;
            show();
            if (this.cf == null)
            {
                this.main.Children.Add(cf = new CheckFinal(ruc, rct1, rct2));
                cf.SetSerialPort          = EncoderPlcPort;
            }
            else
            {
                this.main.Children.Add(cf);
            }
            this.user.Content = "当前登录用户:" + SystData.userInfo.user.username;
            //    l = new Login(this);
            //this.main.Children.Clear();
            //this.main.Children.Add(l);
            ew = new editerWrench();
            List <systemcheckset> ls = new List <systemcheckset>();

            try
            {
                ls = SerializeXML <systemcheckset> .Getlist();

                if (ls != null && ls.Count > 0)
                {
                    if (ls.FirstOrDefault().noticeshow)
                    {
                        //this.taskbarNotifier.Show();
                        //this.taskbarNotifier.NotifyContent.Clear();
                        //this.taskbarNotifier.NotifyContent.Add(new NotifyObject(GetWrenchList(Convert.ToInt32(ls.FirstOrDefault().noticedays))));
                        //WinWrenchRepair WinWrenchRepair = new WinWrenchRepair(GetWrenchList(Convert.ToInt32(ls.FirstOrDefault().noticedays)));
                        //WinWrenchRepair.Show();
                    }
                }
            }
            catch { }
        }
コード例 #19
0
        private void del_Click(object sender, RoutedEventArgs e)
        {
            if (this.dg_set.SelectedIndex < 0)
            {
                return;
            }

            errorrangset er = this.dg_set.SelectedItem as errorrangset;

            errorset.RemoveAt(errorset.FindIndex(p => p.guid == er.guid));
            if (SerializeXML <errorrangset> .exit())
            {
                SerializeXML <errorrangset> .del();
            }
            SerializeXML <errorrangset> .SaveList(errorset);

            getErrorRanng();
        }
コード例 #20
0
        //void OnTimedEvent(object serder, EventArgs e)
        //{
        //    this.Dispatcher.Invoke(DispatcherPriority.Normal,
        //        new TimerDispatcherDelegate(UpdateUI));
        //}

        //void UpdateUI()
        //{
        //    try
        //    {
        //        uint result = Convert.ToUInt32(EncoderPlc.getIntimeData(),16);
        //        Console.WriteLine("值:"+result);
        //        this.machon.Text = Convert.ToInt64(EncoderPlc.getIntimeData(),16).ToString ();
        //        if (EncoderPlc.Direction())
        //        {
        //            direction_yes.Visibility = Visibility.Visible;
        //            direction_no.Visibility = Visibility.Hidden;
        //        }
        //        else
        //        {
        //            direction_yes.Visibility = Visibility.Hidden;
        //            direction_no.Visibility = Visibility.Visible;
        //        }
        //        if (EncoderPlc.ReDirection())
        //        {
        //            redirection_yes.Visibility = Visibility.Visible;
        //            redirection_no.Visibility = Visibility.Hidden;
        //        }
        //        else
        //        {
        //            redirection_yes.Visibility = Visibility.Hidden;
        //            redirection_no.Visibility = Visibility.Visible;
        //        }
        //    }
        //    catch(Exception ex)
        //    {
        //    }
        //}
        void checksetshow()
        {
            // bool sl = SerializeXML<systemcheckset>.exit();

            List <systemcheckset> ls = new List <systemcheckset>();

            try
            {
                ls = SerializeXML <systemcheckset> .Getlist();


                if (ls.Count > 0)
                {
                    systemcheckset s = new systemcheckset();
                    s = ls.FirstOrDefault();
                    this.tb_jarry.Text  = s.arry == null?"":s.arry.ToString();
                    this.tb_jcount.Text = s.count == null?"":s.count.ToString();
                    this.tb_throw.Text  = s.throwvalue.ToString();
                    radiobutton((s.ishavejuser == null || s.ishavejuser == false)?false:true);
                    string[] time = s.noticetime.Split(':');
                    if (time.Length >= 3)
                    {
                        this.tb_hour.Text   = Convert.ToInt32(time[0]).ToString("D2");
                        this.tb_min.Text    = Convert.ToInt32(time[1]).ToString("D2");
                        this.tb_second.Text = Convert.ToInt32(time[2]).ToString("D2");
                    }
                    this.tb_day.Text = s.noticedays.ToString();
                    if (s.noticeshow)
                    {
                        this.rb_show.IsChecked = true;
                    }
                    else
                    {
                        this.rb_notshow.IsChecked = true;
                    }
                }
            }
            catch
            {
                // MessageAlert.Alert("没有相应的检验参数设置"); return;
            }
        }
コード例 #21
0
        void getsystemset()
        {
            try
            {
                List <systemcheckset> scsl = SerializeXML <systemcheckset> .Getlist();

                erl = SerializeXML <errorrangset> .Getlist();

                ttml = SerializeXML <TorqueTestModel> .Getlist();

                if (scsl.Count > 0)
                {
                    _systemcheckset = scsl.FirstOrDefault();
                }
            }
            catch
            {
                MessageAlert.Alert("校验仪没有任何进行设置!不能校验!");
            }
        }
コード例 #22
0
        private void Notice(string time)
        {
            List <systemcheckset> ls = new List <systemcheckset>();

            try
            {
                ls = SerializeXML <systemcheckset> .Getlist();


                if (ls != null && ls.Count > 0)
                {
                    if (time.EndsWith(ls.FirstOrDefault().noticetime))
                    {
                        this.taskbarNotifier.NotifyContent.Clear();
                        this.taskbarNotifier.NotifyContent.Add(new NotifyObject(GetWrenchList(Convert.ToInt32(ls.FirstOrDefault().noticedays))));
                        this.taskbarNotifier.Notify();
                    }
                }
            }
            catch { }
        }
コード例 #23
0
        public IActionResult Index()
        {
            var parseXML = SerializeXML <ProjectModel> .ReadFromXML();

            var projects = (from a in parseXML.
                            select new ProjectModel
            {
                ProjectID = a.ProjectID,
                ProjectNumber = a.ProjectNumber,
                AllSubmissions = (from b in a.AllSubmissions
                                  select new SubmissionModel
                {
                    SubmissionID = b.SubmissionID,
                    SubmissionNumber = b.SubmissionNumber,
                    SubmissionType = b.SubmissionType,
                    ProjectID = b.ProjectID
                }).ToList()
            }).ToList();

            return(View(projects));
        }
コード例 #24
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string tempstr = (cb_role.SelectedItem as role).roleName;
                if (_powerlist.FindIndex(p => p.role == tempstr) >= 0)
                {
                    _powerlist.RemoveAt(_powerlist.FindIndex(p => p.role == tempstr));
                }
                PowerList pl = new PowerList()
                {
                    role = tempstr, rolepower = (List <string>)lv_havefunctio.ItemsSource
                };
                _powerlist.Add(pl);
                SerializeXML <PowerList> .SaveList(_powerlist);

                _powerlist = SerializeXML <PowerList> .Getlist();

                MessageAlert.Alert("保存完成!");
            }
            catch { MessageAlert.Alert("保存失败!"); }
        }
コード例 #25
0
        //private void borrow_Click(object sender, RoutedEventArgs e)
        //{
        //    WrenchBorrow wb = new WrenchBorrow(ruc);
        //    this.main.Children.Clear();
        //    this.main.Children.Add(wb);
        //}

        //private void return_Click(object sender, RoutedEventArgs e)
        //{
        //    WrenchReturn wr = new WrenchReturn(ruc);
        //    this.main.Children.Clear();
        //    this.main.Children.Add(wr);
        //}

        private void searchwrenchdata_Click(object sender, RoutedEventArgs e)
        {
            List <systemcheckset> ls = new List <systemcheckset>();

            //try
            //{
            ls = SerializeXML <systemcheckset> .Getlist();

            if (ls != null && ls.Count > 0)
            {
                //        if (ls.FirstOrDefault().noticeshow)
                //        {
                //this.taskbarNotifier.Show();
                //this.taskbarNotifier.NotifyContent.Clear();
                //this.taskbarNotifier.NotifyContent.Add(new NotifyObject(GetWrenchList(Convert.ToInt32(ls.FirstOrDefault().noticedays))));
                WinWrenchRepair WinWrenchRepair = new WinWrenchRepair(GetWrenchList(Convert.ToInt32(ls.FirstOrDefault().noticedays)));
                WinWrenchRepair.Show();
                //        }
            }
            //}
            //catch { }
        }
コード例 #26
0
        static void Main()
        {
            var jsonReader   = new JsonReader("data.json");
            var service      = new ServiceLayer.ServiceLayer(jsonReader);
            var listIdInfo   = jsonReader.GetElement <List <int> >("IDs");
            var xmlGenerator = new SerializeXML();
            var fileWriter   = new FileManager.FileManager(jsonReader);
            var logger       = new Logger.Logger(jsonReader);

            foreach (var id in listIdInfo)
            {
                logger.Log($"getting Info_{id}");
                var item = service.GetInfo(id);
                logger.Log($"generate xml and xsd");
                var xml = xmlGenerator.SerializeXmlWithXsd(item, $"Info_{id}");
                var xsd = xmlGenerator.SerializeXsd(item);
                logger.Log($"create Info_{id}.xml and xsd");
                fileWriter.FileName = $"Info_{id}.xml";
                fileWriter.AddTextToFile(xml);
                fileWriter.FileName = $"Info_{id}.xsd";
                fileWriter.AddTextToFile(xsd);
            }
        }
コード例 #27
0
        public string XmlToJson(string xml)
        {
            log.Info(String.Format("In : XmlToJson : xml = {0}", xml));
            // Uncomment for the WaitingForm test
            //Thread.Sleep(2000);
            string result = String.Empty;

            try
            {
                result = SerializeXML.XmlToJson(xml);
            }
            catch (Exception ex)
            {
                log.Error("Exception : XmlToJson : " + ex.Message);
                return("Bad Xml format");
            }
            finally
            {
                log.Info("Out : XmlToJson");
            }

            return(result);
        }
コード例 #28
0
 public PersonsDataProviderXml(Mutex mutex)
 {
     _svr = new SerializeXML<PersonAndRoles>(mutex);
 }
コード例 #29
0
ファイル: Program.cs プロジェクト: Cch25/Microsoft-70-483
        public static void ChapterFour()
        {
            #region [ File I/O and Network]
            FilesExample fe = new FilesExample();
            //fe.FileStream();
            //fe.FileStreamImprove();
            //fe.StreamWriterAndReader();
            //fe.ChainStreams();
            //fe.FileHelperClass();
            //fe.ExceptionHandling();
            //fe.FileStorage();
            //fe.FileInfo();
            //fe.Directory();
            //fe.SearchFiles();
            NetworkReadsAndWrites nraw = new NetworkReadsAndWrites();
            //_ = nraw.WebRequest();
            //_ = nraw.WebClient();
            //_ = nraw.HttpClient();
            #endregion

            #region [ Consume Data ]
            ConsumeDataExample cd = new ConsumeDataExample();
            //cd.ConsumeJsonData();
            //cd.ConsumeXmlData();
            //cd.ConsumeXmlDataInDOM();
            //cd.ConsumeSoapClient(5,6);
            #endregion

            #region [ LINQ ]
            QueryLinqData qld = new QueryLinqData();
            //qld.Query();
            //qld.Projection();
            //qld.Join();
            //qld.Group();
            LinqToXML ltx = new LinqToXML();
            //ltx.ReadXml();
            //ltx.FilterXml();
            //ltx.CreateAddModifyXmlWithLinq();
            #endregion

            #region [ Data Serialization and Deserialization ]
            SerializeData sd = new SerializeData();
            //sd.BinarySerialization();
            //sd.BinaryDeserialization();
            CustomSerialization cs = new CustomSerialization();
            //cs.ArtistsSerializationApproachOne();
            //cs.ArtSerializationApproachTwo();
            VersioningSerialization vs = new VersioningSerialization();
            //vs.Versionate();
            SerializeXML sxml = new SerializeXML();
            //sxml.XMLSerialize();
            DataContractSerializerXML dcs = new DataContractSerializerXML();
            //dcs.SerializeWithDataContractSerializer();
            #endregion

            #region [ Collections ]
            StoreAndRetrieve sar = new StoreAndRetrieve();
            //sar.BasicCollections();
            //sar.CountLetterOccurencies();
            //sar.HashSets();
            //sar.StacksAndQueues();
            CustomCollections cc = new CustomCollections();
            //cc.CustomCollectionWithList();
            //cc.CustomeCollectionWithCollection();
            #endregion
        }
コード例 #30
0
        public List <CheckOutDetail> GetDetail(WrenchCheckOut wrenchcheckout)
        {
            List <CheckOutDetail> codlist = new List <CheckOutDetail>();

            if (wrenchcheckout == null)
            {
                return(codlist = null);
            }
            List <torquecheckrecord> tempcheckrecorklist = new List <torquecheckrecord>();

            tempcheckrecorklist = CheckTargetRecord.SelectByCheckTargetID(wrenchcheckout.guid);
            if (tempcheckrecorklist == null || tempcheckrecorklist.Count <= 0)
            {
                return(codlist = null);
            }
            if (tempcheckrecorklist.FindIndex(p => p.isEffective == true) < 0)
            {
                int i = 0, j = 0;
                List <systemcheckset> scsl = SerializeXML <systemcheckset> .Getlist();

                if (scsl == null || scsl.Count <= 0)
                {
                    i = 5;
                }
                else
                {
                    i = Convert.ToInt16(scsl.First().count);
                }
                foreach (torquecheckrecord t in tempcheckrecorklist)
                {
                    if (j >= i)
                    {
                        break;
                    }
                    codlist.Add(new CheckOutDetail()
                    {
                        wrenchbarcode = wrenchcheckout.wrenchbarcode,
                        checkdata     = t.analyserValue.ToString(),
                        checktime     = t.checkTime.ToString(),
                        iseffect      = t.passedFlag
                    });
                    j++;
                }
            }
            else
            {
                foreach (torquecheckrecord t in tempcheckrecorklist)
                {
                    if (t.isEffective)
                    {
                        codlist.Add(new CheckOutDetail()
                        {
                            wrenchbarcode = wrenchcheckout.wrenchbarcode,
                            checkdata     = t.analyserValue.ToString(),
                            checktime     = t.checkTime.ToString(),
                            iseffect      = t.passedFlag
                        });
                    }
                }
            }

            return(codlist);
        }
コード例 #31
0
ファイル: Assembly.cs プロジェクト: ehotsk8/SPMAC_Femap-API
        public async Task CreateAssembly_Async(CancellationToken cts, string Path, bool rod,
                                               bool coverRod, bool piston, bool finger, bool crankshaft, bool cylinder)
        {
            SerializeXML serialize = new SerializeXML(Path + "/Sizes.XML");
            List <SIZE>  list      = serialize.DeSerializer();

            if (list.Count > 0)
            {
                cts.ThrowIfCancellationRequested();
                if (!cts.IsCancellationRequested)
                {
                    Status.CurrState = Status.CurrentState.ASSEMBLY;
                    FemapModel.feFileNew();
                    new SyncGUI(FemapModel).View();
                    Status.ProgressValue = 10;
                }
                if (!cts.IsCancellationRequested && piston)
                {
                    if (FemapModel.feFileReadStep(Path + "/PISTON/Piston.stp") == zReturnCode.FE_OK)
                    {
                        FemapModel.feModifyColorMultiple(zDataType.FT_SOLID, -FemapModel.feSolid.CountSet(),
                                                         zColor.FCL_STEELBLUE, 0, 1, 1);
                        Status.ProgressValue = 20;
                    }
                }

                if (!cts.IsCancellationRequested && rod)
                {
                    if (FemapModel.feFileReadStep(Path + "/ROD/Rod.stp") == zReturnCode.FE_OK)
                    {
                        FemapModel.feModifyColorMultiple(zDataType.FT_SOLID, -FemapModel.feSolid.CountSet(),
                                                         zColor.FCL_AVOCADO, 0, 1, 1);
                        FemapModel.feViewAutoscaleAll(1, true);
                        FemapModel.feViewRegenerate(0);
                        Status.ProgressValue = 40;
                    }
                }
                if (!cts.IsCancellationRequested && finger)
                {
                    if (FemapModel.feFileReadStep(Path + "/FINGER/Finger.stp") == zReturnCode.FE_OK)
                    {
                        FemapModel.feModifyColorMultiple(zDataType.FT_SOLID, -FemapModel.feSolid.CountSet(),
                                                         zColor.FCL_ORANGE, 0, 1, 1);
                        FemapModel.feViewAutoscaleAll(1, true);
                        FemapModel.feViewRegenerate(0);
                        Status.ProgressValue = 60;
                    }
                }
                if (!cts.IsCancellationRequested && coverRod)
                {
                    if (FemapModel.feFileReadStep(Path + "/COVER/CoverRod.stp") == zReturnCode.FE_OK)
                    {
                        FemapModel.feModifyColorMultiple(zDataType.FT_SOLID, -FemapModel.feSolid.CountSet(),
                                                         zColor.FCL_AVOCADO, 0, 1, 1);

                        Point point = FemapModel.fePoint;
                        point.x = -list.First(VARIABLE => VARIABLE.Id == "l3").Value;
                        FemapModel.feMoveBy(zDataType.FT_SOLID, -FemapModel.feSolid.CountSet(), false, -point.x, point.xyz);

                        FemapModel.feViewAutoscaleAll(1, true);
                        FemapModel.feViewRegenerate(0);
                        Status.ProgressValue = 80;
                    }
                }
                if (!cts.IsCancellationRequested && cylinder)
                {
                    if (FemapModel.feFileReadStep(Path + "/SLEEVE/SleeveCylinder.stp") == zReturnCode.FE_OK)
                    {
                        FemapModel.feModifyColorMultiple(zDataType.FT_SOLID, -FemapModel.feSolid.CountSet(),
                                                         zColor.FCL_GOLDENROD, 0, 1, 1);
                        Point points = FemapModel.fePoint;
                        points.x = list.First(VARIABLE => VARIABLE.Id == "l3").Value / 2;
                        FemapModel.feMoveBy(zDataType.FT_SOLID, -FemapModel.feSolid.CountSet(), false, points.x, points.xyz);
                        FemapModel.feViewAutoscaleAll(1, true);
                        FemapModel.feViewRegenerate(0);
                        Status.ProgressValue = 90;
                    }
                }
                if (!cts.IsCancellationRequested && crankshaft)
                {
                    if (FemapModel.feFileReadStep(Path + "/CRANKSHAFT/Crankshaft.stp") == zReturnCode.FE_OK)
                    {
                        FemapModel.feModifyColorMultiple(zDataType.FT_SOLID, -FemapModel.feSolid.CountSet(),
                                                         zColor.FCL_GRAY110, 0, 1, 1);
                        Point point = FemapModel.fePoint;
                        point.x = -list.First(VARIABLE => VARIABLE.Id == "l3").Value;
                        FemapModel.feMoveBy(zDataType.FT_SOLID, -FemapModel.feSolid.CountSet(), false, -point.x, point.xyz);
                        FemapModel.feViewAutoscaleAll(1, true);
                        FemapModel.feViewRegenerate(0);
                        Status.ProgressValue = 100;
                    }
                    Status.CurrState = Status.CurrentState.SAVING;
                    FemapModel.Pref_WorkplaneNotVisible = true;
                    FemapModel.feViewRegenerate(1);
                    FemapModel.feFileSaveAs(false, Status.CurrentDetailsSetDirectory + "/Assembly.modfem");
                }
                Status.CurrState     = Status.CurrentState.READY;
                Status.ProgressValue = 0;
                await Task.Delay(500, cts);

                Status.CancellationTokenSourse = new CancellationTokenSource();
            }
        }