コード例 #1
0
        /// <summary>
        /// Adds the specified function.
        /// </summary>
        /// <param name="function">The function.</param>
        /// <param name="weight">The weight.</param>
        /// <param name="mode">The mode.</param>
        /// <returns></returns>
        public functionArrayEntry Add(IFunctionGenerator function, Double weight = 1, functionArrayEntryMode mode = functionArrayEntryMode.useGeneralAlpha)
        {
            var output = new functionArrayEntry();

            output.function = function;
            output.weight   = weight;
            output.mode     = mode;

            items.Add(output);

            return(output);
        }
コード例 #2
0
        protected override IFunctionFactory MakeFunctionFactory()
        {
            iAssemblerMock = new Mock <IFunctionGenerator>();
            iAssembler     = iAssemblerMock.Object;
            var factory = new Mock <IFunctionFactory>();

            factory.Setup(x => x.CreateAssembler(It.IsAny <string>(), It.IsAny <string>())).Returns((string nativeName, string managedName) => iAssembler);
            factory.Setup(x => x.CreateAnalyser(It.IsAny <List <Declaration> >(), It.IsAny <CType>())).Returns((
                                                                                                                   List <Declaration> decls, CType retType) => new FunctionSpecificationAnalyser(decls, retType));
            iAssemblerMock
            .Setup(x => x.AddManagedParameter(It.IsAny <string>(), It.IsAny <CSharpType>()))
            .Callback((string name, CSharpType t) => iManagedParameterOrder.Add(name));
            iAssemblerMock
            .Setup(x => x.AddPInvokeParameter(It.IsAny <CSharpType>(), It.IsAny <string>(), It.IsAny <string>()))
            .Callback((CSharpType t, string name, string expr) => iPInvokeParameterOrder.Add(name));
            return(factory.Object);
        }
コード例 #3
0
ファイル: Debug.cs プロジェクト: vnvizitiu/FluentBoilerplate
 public void Initialize()
 {
     this.generator = new FunctionGenerator();
     this.provider  = new LogProvider(this.generator, Visibility.Debug);
 }
コード例 #4
0
 public TranslationProvider(IFunctionGenerator functionGenerator, bool shouldThrowExceptions = false)
 {
     this.functionGenerator     = functionGenerator;
     this.shouldThrowExceptions = shouldThrowExceptions;
 }
コード例 #5
0
ファイル: MainWindow.xaml.cs プロジェクト: uwgridlab/SALT-App
        private void ENET_Constructor()
        {
            string FG_IP     = "";
            string OSCOPE_IP = "";

            // #Saved IP Addresses, do not edit
            // FGIP=0.0.0.0
            // OSIP=0.0.0.0
            if (File.Exists("enet.cfg"))
            {
                string[] configInput = File.ReadAllLines("enet.cfg");
                if (configInput.Length < 3)
                {
                    // someone messed with the config file >:(
                    FG_IP     = "0.0.0.0";
                    OSCOPE_IP = "0.0.0.0"; // set to default IP
                }
                else
                {
                    FG_IP     = configInput[1].Substring(5); // get the actual IP strings from config file
                    OSCOPE_IP = configInput[2].Substring(5);
                }
            }
            IPInputWindow IPWindow = new IPInputWindow();

            IPWindow.FunctionGenIPInputBox.Text  = FG_IP;
            IPWindow.OscilloscopeIPInputBox.Text = OSCOPE_IP;
            IPWindow.ShowDialog();
            FG_IP     = IPWindow.FunctionGenIPInputBox.Text;
            OSCOPE_IP = IPWindow.OscilloscopeIPInputBox.Text;                                                         // get the results after the user clicked okay

            File.WriteAllText("enet.cfg", "#Saved IP Addresses, do not edit\nFGIP=" + FG_IP + "\nOSIP=" + OSCOPE_IP); // write the user's specified IP addresses
            // to the file, where they can be read from again.
            string             FG_VISA     = "TCPIP0::" + FG_IP + "::inst0::INSTR";                                   // generate the two VISA ids for devices at the given IP addresses
            string             OSCOPE_VISA = "TCPIP0::" + OSCOPE_IP + "::inst0::INSTR";
            IOscilloscope      tempScope   = VISAOscilloscope.TryOpen(OSCOPE_VISA);
            IFunctionGenerator tempFG      = VISAFunctionGenerator.TryOpen(FG_VISA); // attempt to open the devices at the specified IP addresses

            if (tempFG == null)
            {
                MessageBoxResult result = MessageBox.Show("Error: Could not open function generator at " + FG_IP,
                                                          appName, MessageBoxButton.OK);
                switch (result)
                {
                case MessageBoxResult.OK: // there's only one case
                    ExitAll();            // let the user try again without exiting probably, but we'll do that logic in a sec
                    return;
                }
            }
            if (tempScope == null)
            {
                MessageBoxResult result = MessageBox.Show("Error: Could not open oscilloscope at " + OSCOPE_IP,
                                                          appName, MessageBoxButton.OK);
                switch (result)
                {
                case MessageBoxResult.OK: // there's only one case
                    ExitAll();            // let the user try again without exiting probably, but we'll do that logic in a sec
                    return;
                }
            }
            // if we made it down here, both the scope and function generator are initialized, so we can set the global variables and return from this function
            fg    = tempFG;
            scope = tempScope;
            // yay!
        }
コード例 #6
0
 public LogProvider(IFunctionGenerator functionGenerator, Visibility visibility)
 {
     this.functionGenerator = functionGenerator;
     this.visibility        = visibility;
 }
コード例 #7
0
 public TryCatchBlockProvider(IFunctionGenerator functionGenerator)
 {
     this.functionGenerator = functionGenerator;
 }
コード例 #8
0
ファイル: Debug.cs プロジェクト: Norhaven/FluentBoilerplate
 public void Initialize()
 {
     this.generator = new FunctionGenerator();
     this.provider = new LogProvider(this.generator, Visibility.Debug);
 }
コード例 #9
0
 public void MakeAssembler()
 {
     iFunctionAssembler = new FunctionAssembler("my_native_function", "MyManagedMethod");
 }
コード例 #10
0
 public void MakeAssembler()
 {
     iFunctionAssembler = new FunctionAssembler("my_native_function", "MyManagedMethod");
 }