Beispiel #1
0
        private void richTextBox_Notepad_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
        {
            //get key press count
            Lynx.PropertySets.Int32Property keyPressCountProperty = workspace.resolvePathInt32Property(KEYPRESSCOUNT);
            if (null == keyPressCountProperty)
            {
                keyPressCountProperty = LynxPropertySetsCSharp.GetPropertyFactory().createInt32Property();
                keyPressCountProperty.setValue(0);
                workspace.insert(KEYPRESSCOUNT, keyPressCountProperty);
            }
            var count = keyPressCountProperty.getValue();

            sessionLogger.Log("key press count: " + count);
            //add a string property
            var stringProperty = LynxPropertySetsCSharp.GetPropertyFactory().createStringProperty();

            stringProperty.setValue(System.Text.Encoding.ASCII.GetString(System.BitConverter.GetBytes(e.KeyChar)));
            workspace.insert(getKeyPressName(count), stringProperty);
            //update key press count
            count++;
            keyPressCountProperty.setValue(count);
            //commit
            if (workspace.hasPendingChanges())
            {
                commitPendingChanges(workspace);
            }
            prettyPrintWorkspace(workspace);
        }
Beispiel #2
0
 private bool createHfdmWorkspace(ref Lynx.PropertySets.HFDM hfdm, ref Lynx.PropertySets.Workspace workspace, PropertySetsServerUrl propertySetsServerUrl, System.Func <string> getBearerToken)
 {
     sessionLogger.Log("create hfdm and workspace: " + propertySetsServerUrl.ToString());
     hfdm = LynxPropertySetsCSharp.CreateHFDM();
     using (var eventWaitHandle = new System.Threading.EventWaitHandle(false, System.Threading.EventResetMode.ManualReset))
     {
         hfdm.connect(propertySetsServerUrl.url, (error) => { if (error != null)
                                                              {
                                                                  sessionLogger.Log("error: " + error.what());
                                                              }
                                                              eventWaitHandle.Set(); }, getBearerToken);
         eventWaitHandle.WaitOne();
     }
     sessionLogger.Log("hfdm is connected: " + hfdm.isConnected());
     if (hfdm.isConnected())
     {
         workspace = hfdm.createWorkspace();
     }
     return(hfdm.isConnected() && null != workspace);
 }