public MainWindow() { InitializeComponent(); ticker = new Clock(); /* * We could also use the Action type instead of NoArg and save some code. * But then we'd need to understand Generics... * so I'll stick with NoArg for now. */ NoArg start = ticker.Start; /* * .NET prevents us from updating UI elements from another thread. * Our clock uses Thread.Sleep which would make our app look like it crashed. * We'll use a separate thread for the clock.Start method, then use the Dispatcher * to update the UI in its own sweet time on its own sweet thread. Think of * queueing up a message that is then processed by the UI thread when it's able. * * Importantly, we don't have to change the Clock class to take advantage of threading. * All the Dispatch/BeginInvoke magic happens here in the client code. * */ ticker.MilliSecondsChanged += Ticker_MilliSecondsChangedOnDifferentThread; ticker.SecondsChanged += Ticker_SecondsChangedOnDifferentThread; ticker.MinutesChanged += Ticker_MinutesChangedOnDifferentThread; ticker.HoursChanged += Ticker_HoursChangedOnDifferentThread; ticker.DaysChanged += Ticker_DaysChangedOnDifferentThread; start.BeginInvoke(null, null); }
private void _read() { _code = ((PythonPickle.Opcode)m_io.ReadU1()); switch (Code) { case PythonPickle.Opcode.Ext4: { _arg = m_io.ReadU4le(); break; } case PythonPickle.Opcode.Tuple1: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Setitem: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.ReadonlyBuffer: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Stop: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Ext2: { _arg = m_io.ReadU2le(); break; } case PythonPickle.Opcode.EmptyTuple: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Newtrue: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Long: { _arg = new DecimalnlLong(m_io, this, m_root); break; } case PythonPickle.Opcode.Newobj: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Bytearray8: { _arg = new Bytearray8(m_io, this, m_root); break; } case PythonPickle.Opcode.Put: { _arg = new DecimalnlShort(m_io, this, m_root); break; } case PythonPickle.Opcode.StackGlobal: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.PopMark: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Append: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Newfalse: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Binpersid: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Build: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.EmptyDict: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Tuple2: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Long4: { _arg = new Long4(m_io, this, m_root); break; } case PythonPickle.Opcode.NextBuffer: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Appends: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Binbytes: { _arg = new Bytes4(m_io, this, m_root); break; } case PythonPickle.Opcode.Dup: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.List: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Proto: { _arg = m_io.ReadU1(); break; } case PythonPickle.Opcode.Pop: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Frame: { _arg = m_io.ReadU8le(); break; } case PythonPickle.Opcode.String: { _arg = new Stringnl(m_io, this, m_root); break; } case PythonPickle.Opcode.Binunicode: { _arg = new Unicodestring4(m_io, this, m_root); break; } case PythonPickle.Opcode.Float: { _arg = new Floatnl(m_io, this, m_root); break; } case PythonPickle.Opcode.Reduce: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.GlobalOpcode: { _arg = new StringnlNoescapePair(m_io, this, m_root); break; } case PythonPickle.Opcode.Binput: { _arg = m_io.ReadU1(); break; } case PythonPickle.Opcode.Memoize: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Persid: { _arg = new StringnlNoescape(m_io, this, m_root); break; } case PythonPickle.Opcode.Ext1: { _arg = m_io.ReadU1(); break; } case PythonPickle.Opcode.None: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.ShortBinunicode: { _arg = new Unicodestring1(m_io, this, m_root); break; } case PythonPickle.Opcode.Obj: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Binfloat: { _arg = m_io.ReadF8be(); break; } case PythonPickle.Opcode.NewobjEx: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.EmptyList: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Tuple: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Binunicode8: { _arg = new Unicodestring8(m_io, this, m_root); break; } case PythonPickle.Opcode.Binget: { _arg = m_io.ReadU1(); break; } case PythonPickle.Opcode.Dict: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Binstring: { _arg = new String4(m_io, this, m_root); break; } case PythonPickle.Opcode.Setitems: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Binint2: { _arg = m_io.ReadU2le(); break; } case PythonPickle.Opcode.Binbytes8: { _arg = new Bytes8(m_io, this, m_root); break; } case PythonPickle.Opcode.Binint1: { _arg = m_io.ReadU1(); break; } case PythonPickle.Opcode.Inst: { _arg = new StringnlNoescapePair(m_io, this, m_root); break; } case PythonPickle.Opcode.LongBinget: { _arg = m_io.ReadU4le(); break; } case PythonPickle.Opcode.LongBinput: { _arg = m_io.ReadU4le(); break; } case PythonPickle.Opcode.Int: { _arg = new DecimalnlShort(m_io, this, m_root); break; } case PythonPickle.Opcode.Binint: { _arg = m_io.ReadS4le(); break; } case PythonPickle.Opcode.Unicode: { _arg = new Unicodestringnl(m_io, this, m_root); break; } case PythonPickle.Opcode.Long1: { _arg = new Long1(m_io, this, m_root); break; } case PythonPickle.Opcode.ShortBinstring: { _arg = new String1(m_io, this, m_root); break; } case PythonPickle.Opcode.Mark: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Frozenset: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Tuple3: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Additems: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Get: { _arg = new DecimalnlShort(m_io, this, m_root); break; } case PythonPickle.Opcode.EmptySet: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.ShortBinbytes: { _arg = new Bytes1(m_io, this, m_root); break; } } }
/// <summary> /// <c>no.</c> - Indicates that the subsequent instruction need not perform the specified fault check when it is executed. Currently not implemented in the CLR. /// <para>This is a prefix instruction.</para> /// </summary> /// <param name="operand">The operand.</param> public static void No(NoArg operand) => IL.Throw();
/// <summary> /// In response to the click motion of the start button. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BStart_Click(object sender, RoutedEventArgs e) { //读入仿真参数 if (!_nd.ReadParams()) return; //检查仿真数据是否已经读入 if (!_nd.IsNaviDataReady) { string naviDataPath = ReadFileDialog(Properties.Resources.ReadNaviData); if (!_nd.ReadNaviData(naviDataPath)) return; } //检查训练数据是否读入(仅在高斯地图被考虑的时候检查) if (!_nd.IsTraingDataReady && _nd.IsGaussianOn) { string trainingDataPath = ReadFileDialog(Properties.Resources.ReadTrainingData); if (!_nd.ReadTrainingData(trainingDataPath)) return; } //所有数据准备完毕,开始仿真 if (_isSimOn) { _isSimOn = false; //修改UI BStart.Content = "开始仿真"; BStepping.IsEnabled = false; BReadData.IsEnabled = true; BOutput.IsEnabled = false; TbStatues.Text = ""; //清空画板,结束本次仿真 _cl.Stop(); } else { _isSimOn = true; //修改UI BStart.Content = "清除画板"; BStart.IsEnabled = false; BReadData.IsEnabled = false; //异步调用仿真控制逻辑 var nr = new NoArg(_cl.Start); nr.BeginInvoke(Complete, nr); } }