예제 #1
0
 private void SendFreeCommand()
 {
     if (IsConnected && !string.IsNullOrEmpty(FreeCommandText))
     {
         BackgroundThreadManager.RunBackgroundFunction((s, e) => _ellDevice.SendFreeCommand(FreeCommandText));
     }
 }
예제 #2
0
 /// <summary> Gets the device status. </summary>
 private void GetDeviceStatus()
 {
     if (IsConnected)
     {
         BackgroundThreadManager.RunBackgroundFunction((s, e) => _ellDevice.SelectedDevice.GetDeviceStatus());
     }
 }
예제 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SharePointOutlookConnector"/> class.
 /// </summary>
 public SharePointOutlookConnector()
 {
     if (!addedEventHandler)
     {
         eventUploadFailedHandler    = new EventHandler(SharePointOutlookConnector_UploadFailed);
         eventUploadSucceededHandler = new EventHandler(SharePointOutlookConnector_UploadSucceeded);
         BackgroundThreadManager.GetInstance().UploadSucceeded += eventUploadSucceededHandler;
         addedEventHandler = true;
     }
 }
예제 #4
0
 /// <summary> Sets the address. </summary>
 private void SetAddress()
 {
     if (IsConnected && CanReaddress)
     {
         BackgroundThreadManager.RunBackgroundFunction((s, e) => _ellDevice.ReaddressDevice(OldAddress, NewAddress),
                                                       e =>
         {
             ELLDeviceBaseViewModel vm = _deviceViewModels[OldAddress];
             vm.UpdateAddress();
             _deviceViewModels.Remove(OldAddress);
             _deviceViewModels[NewAddress] = vm;
             _sequenceViewModel.ReaddressSequence(OldAddress, NewAddress);
             UpdateUI();
         });
     }
 }
예제 #5
0
 private void Connect()
 {
     if (ELLDevicePort.IsConnected)
     {
         OutputUpdate("Disconnecting...", OutputItem.OutputItemType.Normal);
         BackgroundThreadManager.RunBackgroundFunction((s, e) => DisconnectEx(), delegate
         {
             UpdateUI();
             OutputUpdate("Disconnected", OutputItem.OutputItemType.Normal);
         });
     }
     else
     {
         _commsLogStore.Clear();
         CommsLog.Clear();
         OutputUpdate("Connecting...", OutputItem.OutputItemType.Normal);
         BackgroundThreadManager.RunBackgroundFunction((s, e) => ConnectEx(), (e) => UpdateUI());
     }
 }
예제 #6
0
        public void UploadFiles(ISPCFolder folder, List <EUEmailUploadFile> uploadFiles, List <EUField> fields, EUFieldInformations fieldInformations, SharePointListViewControl sharePointListViewControl)
        {
            EUFolder _folder = folder as EUFolder;
            string   destinationFolderUrl = _folder.WebUrl.TrimEnd(new char[] { '/' }) + "/" + _folder.FolderPath.TrimStart(new char[] { '/' });

            BackgroundThreadManager.GetInstance().QueueUploadItems(_folder, destinationFolderUrl, uploadFiles, fields, fieldInformations, sharePointListViewControl);

            /*
             * List<EUField> fields = SharePointManager.GetFields(_folder.SiteSetting, _folder.WebUrl, _folder.ListName);
             * foreach (EUEmailUploadFile uploadFile in uploadFiles)
             * {
             *  string copySource = new FileInfo(uploadFile.FilePath).Name;
             *  string[] copyDest = new string[1] { destinationFolderUrl + "/" + copySource };
             *  byte[] itemByteArray = SharePointManager.ReadByteArrayFromFile(uploadFile.FilePath);
             *
             *  EUUploadItem uploadItem = new EUUploadItem(_folder.SiteSetting, _folder.ListName, _folder.RootFolderPath, _folder.WebUrl, copySource, copyDest, itemByteArray, fields, uploadFile.MailItem, fieldInformations);
             *  BackgroundThreadManager.GetInstance().QueueUploadItems(uploadItem);
             * }
             */
        }
예제 #7
0
 /// <summary> Default constructor. </summary>
 public ELLDevicesViewModel()
 {
     MaxSearchLimit   = 'F';
     MinSearchLimit   = '0';
     SelectedPort     = CommonUserSettings.ReadUserSetting("DevicePort", "Com1");
     ShowTxLoggedCmds = CommonUserSettings.ReadUserSetting("ShowTxOutput", true);
     ShowRxLoggedCmds = CommonUserSettings.ReadUserSetting("ShowRxOutput", true);
     ValidAddress     = _ellDevice.ValidAddress;
     AvailablePorts   = SerialPort.GetPortNames().ToList();
     if (!AvailablePorts.Contains(SelectedPort))
     {
         SelectedPort = AvailablePorts.Count > 0 ? AvailablePorts[0] : "";
     }
     IsConnected             = false;
     _commsLogStore          = new List <OutputItem>();
     CommsLog                = new ObservableCollection <OutputItem>(_commsLogStore);
     BackgroundThreadManager = new BackgroundThreadManager();
     _ellDevice.MessageUpdates.OutputUpdate    += OutputUpdate;
     _ellDevice.MessageUpdates.ParameterUpdate += ParameterUpdate;
     _sequenceViewModel = new ELLSequenceViewModel(this, _ellDevice);
     UpdateUI();
 }
예제 #8
0
        // ReSharper disable once UnusedMember.Local
        public static void Main()
        {
            string nowString = DateTime.UtcNow.ToString("yyyy-MM-dd hh:mm:ss");

            Console.WriteLine(nowString + ": Module OnLoad executing...");

            using (new Profiler(nameof(mod_on_load) + ":DatabaseMigrator"))
            {
                DatabaseMigrationRunner.Start();
            }

            using (new Profiler(nameof(mod_on_load) + ":DBBackgroundThread"))
            {
                Console.WriteLine("Starting background thread manager...");
                BackgroundThreadManager.Start();
            }

            using (new Profiler(nameof(mod_on_load) + ":SetEventScripts"))
            {
                NWNXChat.RegisterChatScript("mod_on_nwnxchat");
                SetModuleEventScripts();
                SetAreaEventScripts();
                SetWeaponSettings();
            }
            // Bioware default
            _.ExecuteScript("x2_mod_def_load", _.OBJECT_SELF);

            using (new Profiler(nameof(mod_on_load) + ":RegisterSubscribeEvents"))
            {
                RegisterServiceSubscribeEvents();
            }

            ScriptService.Initialize();
            MessageHub.Instance.Publish(new OnModuleLoad());

            nowString = DateTime.UtcNow.ToString("yyyy-MM-dd hh:mm:ss");
            Console.WriteLine(nowString + ": Module OnLoad finished!");
        }