Example #1
0
 /// <summary>
 ///     Reconstructs an object of the specified type from the specified serialized form by applying the values to an
 ///     existing instance of the type.</summary>
 /// <typeparam name="T">
 ///     Type of object to reconstruct.</typeparam>
 /// <param name="xml">
 ///     Serialized form to reconstruct object from.</param>
 /// <param name="intoObject">
 ///     Object to assign values to in order to reconstruct the original object.</param>
 /// <param name="options">
 ///     Options.</param>
 /// <param name="format">
 ///     Implementation of a Classify format. See <see cref="ClassifyXmlFormat"/> for an example.</param>
 public static void DeserializeIntoObject <T>(XElement xml, T intoObject, ClassifyOptions options = null, IClassifyFormat <XElement> format = null)
 {
     Classify.DeserializeIntoObject <XElement, T>(xml, intoObject, format ?? DefaultFormat, options);
 }
Example #2
0
 /// <summary>
 ///     Reconstructs an object from the specified file by applying the values to an existing instance of the desired
 ///     type. The type of object is inferred from the object passed in.</summary>
 /// <param name="filename">
 ///     Path and filename of the file to read from.</param>
 /// <param name="intoObject">
 ///     Object to assign values to in order to reconstruct the original object. Also determines the type of object
 ///     expected.</param>
 /// <param name="options">
 ///     Options.</param>
 /// <param name="format">
 ///     Implementation of a Classify format. See <see cref="ClassifyXmlFormat"/> for an example.</param>
 public static void DeserializeFileIntoObject(string filename, object intoObject, ClassifyOptions options = null, IClassifyFormat <XElement> format = null)
 {
     Classify.DeserializeFileIntoObject <XElement>(filename, intoObject, format ?? DefaultFormat, options);
 }
Example #3
0
 /// <summary>
 /// 按照分类查询
 /// </summary>
 /// <param name="classify">分类对象</param>
 /// <returns>未被标记删除的结果集</returns>
 public IEnumerable <Blog> FindByClassify(Classify classify)
 {
     return(Context.GetManyDesc(m => m.IsDel == 0 && m.ClassifyId == classify.ClassifyId, m => m.Date));
 }
Example #4
0
 /// <summary>
 /// 按照分类ID获取文章,只包含部分特殊属性
 /// BlogId
 /// BTitle
 /// Classify => { CName , ClassifyId}
 /// Date
 /// BSummaryTrim
 /// BPV
 /// </summary>
 /// <param name="top">要获取的个数</param>
 /// <returns></returns>
 public IEnumerable <Blog> FindPartialDatasByClassify(Classify classify)
 {
     return(Context.GetAllPartialDatasByClassifyId(classify.ClassifyId));
 }
Example #5
0
 /// <summary>
 /// 按照设备所属分类搜索设备。
 /// </summary>
 /// <param name="classify">设备所属的分类。</param>
 /// <param name="containsChildren">是否包含所有下级分类中的设备。true:返回当前分类及所有下级分类中关联的设备;false:仅当前分类直接隶属的设备。</param>
 public ClassifyFilter(Classify classify, bool containsChildren)
 {
     this.Classifys        = new Classify[] { classify };
     this.ContainsChildren = containsChildren;
 }
Example #6
0
    public static void Main()
    {
        Thread newWindowThread = new Thread(new ThreadStart(() =>
        {
            // create and show the window
            App obj = new App();

            // start the Dispatcher processing
            System.Windows.Threading.Dispatcher.Run();
        }));

        newWindowThread.SetApartmentState(ApartmentState.STA);
        newWindowThread.IsBackground = true;
        newWindowThread.Start();

        while (!GBL.DONE_EDITING)
        {
            System.Threading.Thread.Sleep(1000);
        }

        // Connect to LeapMotion Controller
        Console.WriteLine("Initializing Leap...");
        var leapMotion = new Controller();

        do
        {
            System.Threading.Thread.Sleep(1000);
            Console.WriteLine(".");
        } while (!leapMotion.IsConnected);
        Console.WriteLine("Leap ready.");

        // Connect to UHDK5 ultrasonic emitters
        Console.WriteLine("Initializing UHDK5...");
        var uhdk5 = new AmplitudeModulationEmitter();

        Console.WriteLine("UHDK5 ready.");
        Console.WriteLine("Dog Friendly Mode: " + GBL.DOG_FRIENDLY);

        // Connect virtual MIDI ports
        Console.WriteLine("Initializing virtual MIDI ports...");
        MIDI.logging(MIDI.TE_VM_LOGGING_MISC | MIDI.TE_VM_LOGGING_RX | MIDI.TE_VM_LOGGING_TX);
        var leftManu  = new Guid("aa4e075f-3504-4aab-9b06-9a4104a91cf0");
        var leftProd  = new Guid("bb4e075f-3504-4aab-9b06-9a4104a91cf0");
        var leftMIDI  = new MIDI("Air Drums Left Hand", 65535, MIDI.TE_VM_FLAGS_PARSE_RX, ref leftManu, ref leftProd);
        var rightManu = new Guid("cc4e075f-3504-4aab-9b06-9a4104a91cf0");
        var rightProd = new Guid("dd4e075f-3504-4aab-9b06-9a4104a91cf0");
        var rightMIDI = new MIDI("Air Drums Right Hand", 65535, MIDI.TE_VM_FLAGS_PARSE_RX, ref rightManu, ref rightProd);

        Console.WriteLine("MIDI resources ready.");

        // Haptics resources
        var hapticTargets = new List <AmplitudeModulationControlPoint>();
        var hapticTimes   = new List <int>();
        var hapticVH      = new VectorHelper();
        var hapticJH      = new JointsHelper(hapticVH);
        var haptic        = new Haptic(hapticJH, uhdk5);

        // MIDI resources
        var leftComTable  = new Commands(true);
        var leftNotes     = new List <int>();
        var leftTimes     = new List <int>();
        var leftPort      = new Port(leftMIDI);
        var rightComTable = new Commands(false);
        var rightNotes    = new List <int>();
        var rightTimes    = new List <int>();
        var rightPort     = new Port(rightMIDI);

        // Classification resources
        var leftVH           = new VectorHelper();
        var leftJH           = new JointsHelper(leftVH);
        var leftStats        = new Stats(leftJH);
        var leftClassify     = new Classify(leftVH, leftStats);
        var leftQueues       = new Queues(leftJH);
        var leftDataManager  = new DataManager(leftQueues, true);
        var rightVH          = new VectorHelper();
        var rightJH          = new JointsHelper(rightVH);
        var rightStats       = new Stats(rightJH);
        var rightClassify    = new Classify(rightVH, rightStats);
        var rightQueues      = new Queues(rightJH);
        var rightDataManager = new DataManager(rightQueues, false);

        // Concurrency structures
        var leftFrameStream    = new ConcurrentQueue <Frame>();
        var leftCommandStream  = new ConcurrentQueue <int>();
        var rightFrameStream   = new ConcurrentQueue <Frame>();
        var rightCommandStream = new ConcurrentQueue <int>();
        var hapticStream       = new ConcurrentQueue <Joints>();

        // Processes
        var data         = new Proc_Data(leapMotion, leftFrameStream, rightFrameStream) as IProc;
        var leftGesture  = new Proc_Gesture(leftClassify, leftDataManager, leftVH, leftFrameStream, leftCommandStream, hapticStream) as IProc;
        var leftCommand  = new Proc_MIDI(leftPort, leftCommandStream, leftNotes, leftTimes, leftComTable) as IProc;
        var rightGesture = new Proc_Gesture(rightClassify, rightDataManager, rightVH, rightFrameStream, rightCommandStream, hapticStream) as IProc;
        var rightCommand = new Proc_MIDI(rightPort, rightCommandStream, rightNotes, rightTimes, rightComTable) as IProc;
        var haptics      = new Proc_Haptics(haptic, hapticStream, hapticTargets, hapticTimes) as IProc;

        // Instantiate threads with looped pipelines
        var dataThread         = new Thread(data.Loop);
        var leftGestureThread  = new Thread(leftGesture.Loop);
        var rightGestureThread = new Thread(rightGesture.Loop);
        var leftCommandThread  = new Thread(leftCommand.Loop);
        var rightCommandThread = new Thread(rightCommand.Loop);
        var hapticsThread      = new Thread(haptics.Loop);

        // Start threads
        dataThread.Start();
        leftGestureThread.Start();
        rightGestureThread.Start();
        leftCommandThread.Start();
        rightCommandThread.Start();
        hapticsThread.Start();
    }
Example #7
0
 /// <summary>
 ///     Reconstructs an object of the specified type from the specified file.</summary>
 /// <param name="type">
 ///     Type of object to read.</param>
 /// <param name="options">
 ///     Options.</param>
 /// <param name="filename">
 ///     Path and filename of the file to read from.</param>
 /// <param name="format">
 ///     Implementation of a Classify format. See <see cref="ClassifyJsonFormat"/> for an example.</param>
 /// <returns>
 ///     A new instance of the requested type.</returns>
 public static object DeserializeFile(Type type, string filename, ClassifyOptions options = null, IClassifyFormat <JsonValue> format = null)
 {
     return(Classify.DeserializeFile(type, filename, format ?? DefaultFormat, options));
 }
Example #8
0
 private static void PostBuildCheck(IPostBuildReporter rep)
 {
     Classify.PostBuildStep <Settings>(rep);
 }
Example #9
0
 /// <summary>
 ///     Converts the specified object into a serialized form.</summary>
 /// <param name="saveType">
 ///     Type of object to convert.</param>
 /// <param name="saveObject">
 ///     Object to be serialized.</param>
 /// <param name="options">
 ///     Options.</param>
 /// <param name="format">
 ///     Implementation of a Classify format. See <see cref="ClassifyJsonFormat"/> for an example.</param>
 /// <returns>
 ///     The serialized form generated from the object.</returns>
 public static JsonValue Serialize(Type saveType, object saveObject, ClassifyOptions options = null, IClassifyFormat <JsonValue> format = null)
 {
     return(Classify.Serialize(saveType, saveObject, format ?? DefaultFormat, options));
 }
Example #10
0
 /// <summary>
 ///     Reconstructs an object of the specified type from the specified file.</summary>
 /// <typeparam name="T">
 ///     Type of object to read.</typeparam>
 /// <param name="options">
 ///     Options.</param>
 /// <param name="filename">
 ///     Path and filename of the file to read from.</param>
 /// <param name="format">
 ///     Implementation of a Classify format. See <see cref="ClassifyJsonFormat"/> for an example.</param>
 /// <returns>
 ///     A new instance of the requested type.</returns>
 public static T DeserializeFile <T>(string filename, ClassifyOptions options = null, IClassifyFormat <JsonValue> format = null)
 {
     return(Classify.DeserializeFile <JsonValue, T>(filename, format ?? DefaultFormat, options));
 }
Example #11
0
 /// <summary>
 ///     Stores the specified object in a file with the given path and filename.</summary>
 /// <typeparam name="T">
 ///     Type of the object to store.</typeparam>
 /// <param name="saveObject">
 ///     Object to store in a file.</param>
 /// <param name="filename">
 ///     Path and filename of the file to be created. If the file already exists, it is overwritten.</param>
 /// <param name="options">
 ///     Options.</param>
 /// <param name="format">
 ///     Implementation of a Classify format. See <see cref="ClassifyJsonFormat"/> for an example.</param>
 public static void SerializeToFile <T>(T saveObject, string filename, ClassifyOptions options = null, IClassifyFormat <JsonValue> format = null)
 {
     Classify.SerializeToFile(saveObject, filename, format ?? DefaultFormat, options);
 }
Example #12
0
 /// <summary>
 ///     Reconstructs an object of the specified type from the specified serialized form by applying the values to an
 ///     existing instance of the type.</summary>
 /// <typeparam name="T">
 ///     Type of object to reconstruct.</typeparam>
 /// <param name="json">
 ///     Serialized form to reconstruct object from.</param>
 /// <param name="intoObject">
 ///     Object to assign values to in order to reconstruct the original object.</param>
 /// <param name="options">
 ///     Options.</param>
 /// <param name="format">
 ///     Implementation of a Classify format. See <see cref="ClassifyJsonFormat"/> for an example.</param>
 public static void DeserializeIntoObject <T>(JsonValue json, T intoObject, ClassifyOptions options = null, IClassifyFormat <JsonValue> format = null)
 {
     Classify.DeserializeIntoObject(json, intoObject, format ?? DefaultFormat, options);
 }
Example #13
0
 /// <summary>
 ///     Reconstructs an object of the specified type from the specified serialized form.</summary>
 /// <param name="type">
 ///     Type of object to reconstruct.</param>
 /// <param name="json">
 ///     Serialized form to reconstruct object from.</param>
 /// <param name="options">
 ///     Options.</param>
 /// <param name="format">
 ///     Implementation of a Classify format. See <see cref="ClassifyJsonFormat"/> for an example.</param>
 /// <returns>
 ///     A new instance of the requested type.</returns>
 public static object Deserialize(Type type, JsonValue json, ClassifyOptions options = null, IClassifyFormat <JsonValue> format = null)
 {
     return(Classify.Deserialize(type, json, format ?? DefaultFormat, options));
 }
Example #14
0
 /// <summary>
 ///     Stores the specified object in a file with the given path and filename.</summary>
 /// <param name="saveType">
 ///     Type of the object to store.</param>
 /// <param name="saveObject">
 ///     Object to store in a file.</param>
 /// <param name="filename">
 ///     Path and filename of the file to be created. If the file already exists, it is overwritten.</param>
 /// <param name="options">
 ///     Options.</param>
 /// <param name="format">
 ///     Implementation of a Classify format. See <see cref="ClassifyXmlFormat"/> for an example.</param>
 public static void SerializeToFile(Type saveType, object saveObject, string filename, ClassifyOptions options = null, IClassifyFormat <XElement> format = null)
 {
     Classify.SerializeToFile(saveType, saveObject, filename, format ?? DefaultFormat, options);
 }
Example #15
0
 /// <summary>
 ///     Reconstructs an object of the specified type from the specified serialized form.</summary>
 /// <typeparam name="T">
 ///     Type of object to reconstruct.</typeparam>
 /// <param name="json">
 ///     Serialized form to reconstruct object from.</param>
 /// <param name="options">
 ///     Options.</param>
 /// <param name="format">
 ///     Implementation of a Classify format. See <see cref="ClassifyJsonFormat"/> for an example.</param>
 /// <returns>
 ///     A new instance of the requested type.</returns>
 public static T Deserialize <T>(JsonValue json, ClassifyOptions options = null, IClassifyFormat <JsonValue> format = null)
 {
     return(Classify.Deserialize <JsonValue, T>(json, format ?? DefaultFormat, options));
 }
Example #16
0
 /// <summary>
 ///     Converts the specified object into a serialized form.</summary>
 /// <typeparam name="T">
 ///     Type of object to convert.</typeparam>
 /// <param name="saveObject">
 ///     Object to be serialized.</param>
 /// <param name="options">
 ///     Options.</param>
 /// <param name="format">
 ///     Implementation of a Classify format. See <see cref="ClassifyXmlFormat"/> for an example.</param>
 /// <returns>
 ///     The serialized form generated from the object.</returns>
 public static XElement Serialize <T>(T saveObject, ClassifyOptions options = null, IClassifyFormat <XElement> format = null)
 {
     return(Classify.Serialize(saveObject, format ?? DefaultFormat, options));
 }
Example #17
0
 public void Add(Classify classify)
 {
     db.Classifys.Add(classify);
     db.SaveChanges();
 }