Пример #1
0
        public static DataResponse Upload(FileUploadRequest request, string checkSum)
        {
            var dataResponse = new DataResponse(false, -1);

            try
            {
                using (var fileStream = new FileStream(request.VirtualPath, FileMode.Open, FileAccess.Read))
                {
                    request.DataStream = fileStream;
                    using (var sc = new MainUpdateSourceServiceClient("BasicHttpBinding_IMainUpdateSourceService", ApplicationContext.MainUpdateSourceUrl))
                    {
                        bool status;
                        //Return Task<MessageResult>
                        var strResult = sc.UploadFile(checkSum, request.Name, request.SecurityKey,
                                                      request.VirtualPath, request.DataStream, out status);
                        dataResponse = RequestResponseUtils.GetData <DataResponse>(strResult);
                    }
                }
            }
            catch (Exception ex)
            {
                dataResponse.Message = ex.Message;
                //Log
                _log.Error("ServiceManager.Upload Error", ex);
            }
            return(dataResponse);
        }
        private static DiscoveryDocument GetDocumentNoParse(ref string url, DiscoveryClientProtocol client)
        {
            DiscoveryDocument document2;
            DiscoveryDocument document = (DiscoveryDocument)client.Documents[url];

            if (document != null)
            {
                return(document);
            }
            string contentType = null;
            Stream stream      = client.Download(ref url, ref contentType);

            try
            {
                XmlTextReader xmlReader = new XmlTextReader(new StreamReader(stream, RequestResponseUtils.GetEncoding(contentType)))
                {
                    WhitespaceHandling = WhitespaceHandling.Significant,
                    XmlResolver        = null,
                    DtdProcessing      = DtdProcessing.Prohibit
                };
                if (!DiscoveryDocument.CanRead(xmlReader))
                {
                    ArgumentException innerException = new ArgumentException(System.Web.Services.Res.GetString("WebInvalidFormat"));
                    throw new InvalidOperationException(System.Web.Services.Res.GetString("WebMissingDocument", new object[] { url }), innerException);
                }
                document2 = DiscoveryDocument.Read(xmlReader);
            }
            finally
            {
                stream.Close();
            }
            return(document2);
        }
Пример #3
0
        /// <summary>
        ///     Get all discovery endpoints that its subnet mark is subnetMark
        /// </summary>
        /// <param name="subnetMark"></param>
        private List <NeighborhoodWatch> GetNeighborhoods(string subnetMark)
        {
            var requestObj = new StringAuthenticateObject
            {
                StringAuth  = "OK",
                StringValue = subnetMark
            };
            var resultDeserialize = ServiceManager.Invoke(sc => RequestResponseUtils.GetData <List <NeighborhoodWatch> >(
                                                              sc.GetAllNeighborhoodWatch,
                                                              requestObj));

            if (resultDeserialize == null)
            {
                PageNavigatorHelper._MainWindow.Dispatcher.BeginInvoke(DispatcherPriority.Normal,
                                                                       (Action)(() =>
                {
                    var messageDialog =
                        PageNavigatorHelper._MainWindow.MessageDialogContentControl.Content as MessageDialog;
                    messageDialog.ShowMessageDialog("Data is null", "Message");
                }));
                return(new List <NeighborhoodWatch>());
            }

            return(resultDeserialize);
        }
Пример #4
0
        private void OnExecuteImport_Dowork(object sender, DoWorkEventArgs e)
        {
            try
            {
                _view.Dispatcher.BeginInvoke(DispatcherPriority.SystemIdle, (Action)(() =>
                {
                    ApplicationContext.IsBusy = true;
                    CommandManager.InvalidateRequerySuggested();
                    var dataImport = _directoryComputerImporter.DirectoryComputerCollections.Where(c => c.Id == 0).ToList();
                    if (dataImport.Count > 0)
                    {
                        var result = ServiceManager.Invoke(sc => RequestResponseUtils.GetData <ImportFolderComputerResponse>(
                                                               sc.ImportFolderComputer,
                                                               dataImport));
                        if (result == null)
                        {
                            DialogHelper.Alert("Can not receive status data");
                            return;
                        }

                        _directoryComputerImporter = null;
                        FilePath = string.Empty;
                    }
                    else
                    {
                        DialogHelper.Alert("There is no data to insert.");
                    }
                }));
            }
            catch (Exception)
            {
                ApplicationContext.IsBusy = false;
            }
        }
Пример #5
0
 private void OnSave_Completed(object sender, RunWorkerCompletedEventArgs e)
 {
     //DialogHelper.HideLoading();
     if (_isInheritClick)
     {
         _isInheritClick = false;
         var dataRequest = new TaskProgressRequest
         {
             TaskId = Id,
             DirectoryEndpointId = ApplicationContext.NodesSelected[0].NodeId,
             IsFolder            = ApplicationContext.NodesSelected[0].IsFolder
         };
         var taskSoftwareInfo =
             ServiceManager.Invoke(sc => RequestResponseUtils.GetData <TaskDataResponse>(sc.GetTaskAndSoftwareInfo, dataRequest));
         if (taskSoftwareInfo != null)
         {
             //Update task model
             UpdateModel(taskSoftwareInfo.Result.PocTasks.FirstOrDefault());
             //Remove old software selected stated
             for (int i = ApplicationContext.TaskSoftwareSelectedList.Count - 1; i >= 0; i--)
             {
                 var currentTask = ApplicationContext.TaskSoftwareSelectedList[i];
                 if (currentTask.TaskId == Id)
                 {
                     ApplicationContext.TaskSoftwareSelectedList.RemoveAt(i);
                 }
             }
             ApplicationContext.TaskSoftwareSelectedList.AddRange(taskSoftwareInfo.Result.SoftwareTasks);
             //Refresh software package list
             InstallationPackagesViewModel.Refresh();
         }
     }
 }
Пример #6
0
 private void SyncDataBk_DoWork(object sender, DoWorkEventArgs e)
 {
     try
     {
         var ldap = new LDAP
         {
             IsSecureLDAP = IsSecure,
             Domain       = DomainName,
             Server       = Server,
             Port         = Port,
             User         = User,
             Password     = Password,
             Id           = Id
         };
         var resultDeserialize = ServiceManager.Invoke(sc => RequestResponseUtils.GetData <List <LDAPDirectory> >(
                                                           sc.GetLDAPLv1,
                                                           ldap));
         if (resultDeserialize != null)
         {
             _ldapDirectories = resultDeserialize;
         }
     }
     catch (Exception)
     {
         ApplicationContext.IsBusy = false;
     }
 }
        /// <include file='doc\DiscoveryDocumentReference.uex' path='docs/doc[@for="DiscoveryDocumentReference.GetDocumentNoParse"]/*' />
        /// <devdoc>
        /// Retrieves a discovery document from Url, either out of the ClientProtocol
        /// or from a stream. Does not
        /// </devdoc>
        private static DiscoveryDocument GetDocumentNoParse(ref string url, DiscoveryClientProtocol client)
        {
            DiscoveryDocument d = (DiscoveryDocument)client.Documents[url];

            if (d != null)
            {
                return(d);
            }

            string contentType = null;

            Stream stream = client.Download(ref url, ref contentType);

            try {
                XmlTextReader reader = new XmlTextReader(new StreamReader(stream, RequestResponseUtils.GetEncoding(contentType)));
                reader.WhitespaceHandling = WhitespaceHandling.Significant;
                reader.XmlResolver        = null;
                reader.DtdProcessing      = DtdProcessing.Prohibit;
                if (!DiscoveryDocument.CanRead(reader))
                {
                    // there is no discovery document at this location
                    ArgumentException exception = new ArgumentException(Res.GetString(Res.WebInvalidFormat));
                    throw new InvalidOperationException(Res.GetString(Res.WebMissingDocument, url), exception);
                }
                return(DiscoveryDocument.Read(reader));
            }
            finally {
                stream.Close();
            }
        }
Пример #8
0
        private int AddPocAgentToDb(POCAgent pocAgent)
        {
            var resultDeserialize = ServiceManager.Invoke(sc => RequestResponseUtils.GetData <DataResponse>(
                                                              sc.AddPolicy, pocAgent));

            return(resultDeserialize.Result);
        }
Пример #9
0
 private void OnPieChartRefresh(object sender, EventArgs e)
 {
     try
     {
         _timer.Stop();
         var dataRequest  = new StringAuthenticateObject("OK");
         var dataResponse =
             ServiceManager.Invoke(sc => RequestResponseUtils.GetData <LastUpdated>(sc.GetLastUpdateTaskProgress, dataRequest));
         if (dataResponse != null && dataResponse.LastSync > _lastSync)
         {
             //First load
             if (_lastSync == DateTime.MinValue)
             {
                 _lastSync = dataResponse.LastSync;
             }
             else
             {
                 _lastSync = dataResponse.LastSync;
                 RefreshAllPieChart();
             }
         }
     }
     catch (Exception ex)
     {
         Logger.Error("OnPieChartRefresh Error", ex);
     }
     finally
     {
         _timer.Start();
     }
 }
Пример #10
0
        /// <summary>
        /// Called when click [import data execute].
        /// </summary>
        /// <param name="pars">The pars.</param>
        private void OnImportDataExecute(object pars)
        {
            var dataImport = _directoryComputerImporter.DirectoryComputerCollections.Where(c => c.Id == 0).ToList();

            if (dataImport.Count > 0)
            {
                var result = ServiceManager.Invoke(sc => RequestResponseUtils.GetData <ImportFolderComputerResponse>(
                                                       sc.ImportFolderComputer,
                                                       dataImport));
                if (result == null)
                {
                    DialogHelper.Alert("Can not receive status data");
                    return;
                }
                DialogHelper.Alert(result.Message);

                if (_folderId.HasValue)
                {
                    MakeTree(_folderId.Value, !string.IsNullOrWhiteSpace(ApplicationContext.SearchText), ApplicationContext.SearchText);
                }
                _directoryComputerImporter = null;
                FilePath = string.Empty;
                _view.Close();
            }
            else
            {
                DialogHelper.Alert("There is no data to insert.");
            }
        }
        public Stream Download(ref string url, ref string contentType)
        {
            WebRequest request = GetWebRequest(new Uri(url));

            request.Method = "GET";
            HttpWebRequest httpRequest = request as HttpWebRequest;
            WebResponse    response    = null;

            try {
                response = GetWebResponse(request);
            }
            catch (Exception e) {
                throw new WebException(Res.GetString(Res.ThereWasAnErrorDownloading0, url), e);
            }
            HttpWebResponse httpResponse = response as HttpWebResponse;

            if (httpResponse != null)
            {
                if (httpResponse.StatusCode != HttpStatusCode.OK)
                {
                    string errorMessage = RequestResponseUtils.CreateResponseExceptionString(httpResponse);
                    throw new WebException(Res.GetString(Res.ThereWasAnErrorDownloading0, url), new WebException(errorMessage, null, WebExceptionStatus.ProtocolError, response));
                }
            }
            Stream responseStream = response.GetResponseStream();

            try {
                // Uri.ToString() returns the unescaped version
                url         = response.ResponseUri.ToString();
                contentType = response.ContentType;

                if (response.ResponseUri.Scheme == Uri.UriSchemeFtp ||
                    response.ResponseUri.Scheme == Uri.UriSchemeFile)
                {
                    int dotIndex = response.ResponseUri.AbsolutePath.LastIndexOf('.');
                    if (dotIndex != -1)
                    {
                        switch (response.ResponseUri.AbsolutePath.Substring(dotIndex + 1).ToLower(CultureInfo.InvariantCulture))
                        {
                        case "xml":
                        case "wsdl":
                        case "xsd":
                        case "disco":
                            contentType = ContentType.TextXml;
                            break;

                        default:
                            break;
                        }
                    }
                }

                // need to return a buffered stream (one that supports CanSeek)
                return(RequestResponseUtils.StreamToMemoryStream(responseStream));
            }
            finally {
                responseStream.Close();
            }
        }
Пример #12
0
        public static int AddDirectoryAssignmentRuleCriteria(AssignmentRuleCriteriaEnt lc)
        {
            var resultDeserialize = ServiceManager.Invoke(sc => RequestResponseUtils.GetData <DataResponse>(
                                                              sc.AddAssignmentRuleCriteria,
                                                              lc));

            return(resultDeserialize.Result);
        }
Пример #13
0
        /// <summary>
        /// Gets the directory tree.
        /// </summary>
        /// <returns>List&lt;DirectoryComputerItem&gt;.</returns>
        private List <DirectoryComputerItem> GetDirectoryTree()
        {
            var listDirectoryComputerItem = ServiceManager.Invoke(sc => RequestResponseUtils.GetData <List <DirectoryComputerItem> >(
                                                                      sc.GetAllDirectoryComputer, new DirectoryComputerRequest(_currentDirectoryNode.NodeId)));

            //listDirectoryComputerItem = listDirectoryComputerItem.Where(li => li.IsDirectory).ToList();
            return(listDirectoryComputerItem);
        }
Пример #14
0
        public static double TransferToServerAgent(TransferToAgentDataRequest request)
        {
            var dataResponse = Invoke(sc => RequestResponseUtils.GetData <TransferToAgentDataResponse>(
                                          sc.TransferToServerAgent,
                                          request));

            return(dataResponse.TotalSize);
        }
        public Stream Download(ref string url, ref string contentType)
        {
            Stream     stream2;
            WebRequest webRequest = this.GetWebRequest(new Uri(url));

            webRequest.Method = "GET";
            WebResponse webResponse = null;

            try
            {
                webResponse = this.GetWebResponse(webRequest);
            }
            catch (Exception exception)
            {
                if (((exception is ThreadAbortException) || (exception is StackOverflowException)) || (exception is OutOfMemoryException))
                {
                    throw;
                }
                throw new WebException(Res.GetString("ThereWasAnErrorDownloading0", new object[] { url }), exception);
            }
            HttpWebResponse response2 = webResponse as HttpWebResponse;

            if ((response2 != null) && (response2.StatusCode != HttpStatusCode.OK))
            {
                string message = RequestResponseUtils.CreateResponseExceptionString(response2);
                throw new WebException(Res.GetString("ThereWasAnErrorDownloading0", new object[] { url }), new WebException(message, null, WebExceptionStatus.ProtocolError, webResponse));
            }
            Stream responseStream = webResponse.GetResponseStream();

            try
            {
                url         = webResponse.ResponseUri.ToString();
                contentType = webResponse.ContentType;
                if ((webResponse.ResponseUri.Scheme == Uri.UriSchemeFtp) || (webResponse.ResponseUri.Scheme == Uri.UriSchemeFile))
                {
                    string str2;
                    int    num = webResponse.ResponseUri.AbsolutePath.LastIndexOf('.');
                    if (((num != -1) && ((str2 = webResponse.ResponseUri.AbsolutePath.Substring(num + 1).ToLower(CultureInfo.InvariantCulture)) != null)) && (((str2 == "xml") || (str2 == "wsdl")) || ((str2 == "xsd") || (str2 == "disco"))))
                    {
                        contentType = "text/xml";
                    }
                }
                stream2 = RequestResponseUtils.StreamToMemoryStream(responseStream);
            }
            finally
            {
                responseStream.Close();
            }
            return(stream2);
        }
Пример #16
0
        private void AddBkg_DoWork(object sender, DoWorkEventArgs e)
        {
            Thread.Sleep(10);
            var listDir = e.Argument as List <DirectoryNode>;

            if (listDir != null && listDir.Count > 0)
            {
                Dispatcher.BeginInvoke(DispatcherPriority.Normal,
                                       (Action)(() =>
                {
                    ServiceManager.Invoke(sc => RequestResponseUtils.GetData <StringAuthenticateObject>(
                                              sc.AddFolderComputerFromLDAP,
                                              listDir));
                }));
            }
        }
Пример #17
0
 private void ExecuteEditTask(object obj)
 {
     try
     {
         ServiceManager.Invoke(sc => RequestResponseUtils.GetData <DataResponse>(
                                   sc.AddTask,
                                   new PocTask
         {
             Id   = Id,
             Name = Name
         }));
     }
     catch (Exception ex)
     {
         Logger.Error("Edit Task Error: " + ex.Message, ex);
     }
 }
Пример #18
0
 public static DeleteSoftwareDataResponse DeleteSoftwareFile(List <string> filesToDelete)
 {
     try
     {
         var request = new FilesToDeleteRequest
         {
             SecurityKey   = RequestResponseUtils.EncryptString(AppSettings.GetConfig <string>(CommonConstants.MESSAGE_KEY)),
             FilesToDelete = filesToDelete
         };
         return(Invoke(sc => RequestResponseUtils.GetData <DeleteSoftwareDataResponse>(sc.DeleteSoftwareFiles, request)));
     }
     catch (Exception ex)
     {
         _log.Error("DeleteSoftwareFile Error", ex);
         return(new DeleteSoftwareDataResponse(false, new DeleteSoftwareResult()));
     }
 }
        private void SyncLDAPBg_DoWork(object sender, DoWorkEventArgs e)
        {
            //  _view.Dispatcher.BeginInvoke(DispatcherPriority.Render, (Action) (() =>
            //  {

            LDAP ldap    = (LDAP)e.Argument;
            var  ldapLv1 = ServiceManager.Invoke(sc => RequestResponseUtils.GetData <List <LDAPDirectory> >(
                                                     sc.GetLDAPLv1,
                                                     ldap));

            if (ldapLv1 == null)
            {
                return;
            }
            if (!ApplicationContext.LdapDirectoriesEndpointsDictionary.ContainsKey(ldap.Id))
            {
                ApplicationContext.LdapDirectoriesEndpointsDictionary[ldap.Id] = new LDAPDirectoriesEndpoints();
            }
            var ldapEndpointDictionary = ApplicationContext.LdapDirectoriesEndpointsDictionary[ldap.Id];

            ldapEndpointDictionary.Directories = new List <LDAPDirectory>();
            ldapEndpointDictionary.Directories.AddRange(ldapLv1);
            ldapEndpointDictionary.Endpoints = new List <LDAPEndpoint>();
            foreach (var ldapDirectory in ldapLv1)
            {
                if (ldapDirectory.ParentId == null)
                {
                    continue;
                }
                ldap.DistinguishedName = ldapDirectory.DistinguishedName;
                var ldapChild = ServiceManager.Invoke(sc => RequestResponseUtils.GetData <LDAPDirectoriesEndpoints>(
                                                          sc.GetLDAPByDistinguishedName,
                                                          ldap));
                if (ldapChild.Directories.Count > 0)
                {
                    ldapEndpointDictionary.Directories.AddRange(
                        ldapChild.Directories);
                }
                if (ldapChild.Endpoints.Count > 0)
                {
                    ldapEndpointDictionary.Endpoints.AddRange(ldapChild.Endpoints);
                }
            }
            // }));
        }
 private TransferSchedule GetTransferSchedule()
 {
     try
     {
         var requestObj = new StringAuthenticateObject
         {
             StringAuth = "OK"
         };
         var resultDeserialize = ServiceManager.Invoke(sc => RequestResponseUtils.GetData <TransferSchedule>(
                                                           sc.GetTransferScheduling,
                                                           requestObj));
         return(resultDeserialize);
     }
     catch (Exception ex)
     {
         Logger.Error(ex.Message, ex);
         return(null);
     }
 }
        private void AutoTransferNewContent()
        {
            var bgHelper = new BackgroundWorkerHelper();

            bgHelper.AddDoWork((o, args) =>
            {
                var dataRequest = new NewSoftwareTransferRequest
                {
                    Id       = Id,
                    Name     = Name,
                    FileName = Executable,
                    Params   = Parameters,
                    Checksum = Checksum
                };

                ServiceManager.Invoke(
                    sc => RequestResponseUtils.GetData <DataResponse>(sc.NewSoftwareTransfer, dataRequest));
            }).DoWork();
        }
Пример #22
0
        public static void LoadEndpointPolicy()
        {
            var requestObj = new StringAuthenticateObject
            {
                StringAuth = "OK"
            };
            var resultDeserialize = ServiceManager.Invoke(sc => RequestResponseUtils.GetData <List <PolicyAssign> >(
                                                              sc.GetEndpointPolicies,
                                                              requestObj));

            if (resultDeserialize == null)
            {
                ApplicationContext.EndpointPolicyList = new List <PolicyAssign>();
            }
            else
            {
                ApplicationContext.EndpointPolicyList = resultDeserialize;
            }
        }
Пример #23
0
        public static void GetAllPolicies()
        {
            var requestObj = new StringAuthenticateObject
            {
                StringAuth = "OK"
            };
            var resultDeserialize = ServiceManager.Invoke(sc => RequestResponseUtils.GetData <List <POCAgent> >(
                                                              sc.GetAllPolicies,
                                                              requestObj));

            if (resultDeserialize == null)
            {
                ApplicationContext.POCAgentList = new List <POCAgent>();
            }
            else
            {
                ApplicationContext.POCAgentList = resultDeserialize;
            }
        }
Пример #24
0
        private void OnSave_Dowork(object sender, DoWorkEventArgs e)
        {
            //Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)DialogHelper.ShowLoading);
            var taskModel = e.Argument as PocTaskSyncData;

            if (taskModel != null)
            {
                if (ApplicationContext.NodesSelected[0].IsFolder)
                {
                    taskModel.DirectoryId = ApplicationContext.NodesSelected[0].NodeId;
                    ServiceManager.Invoke(sc => sc.AssignTaskToDirectory(RequestResponseUtils.SendData(taskModel)));
                }
                else
                {
                    taskModel.EndPointId = ApplicationContext.NodesSelected[0].NodeId;
                    ServiceManager.Invoke(sc => sc.AssignTaskToEndpoint(RequestResponseUtils.SendData(taskModel)));
                }
            }
        }
Пример #25
0
        public static void GetAllUpdateSourceSoftware()
        {
            var requestObj = new StringAuthenticateObject
            {
                StringAuth = "OK"
            };
            var resultDeserialize = ServiceManager.Invoke(sc => RequestResponseUtils.GetData <List <UpdateSourceSoftware> >(
                                                              sc.GetAllUpdateSourceSoftware,
                                                              requestObj));

            if (resultDeserialize == null)
            {
                ApplicationContext.UpdateSourceSoftwareList = new List <UpdateSourceSoftware>();
            }
            else
            {
                ApplicationContext.UpdateSourceSoftwareList = resultDeserialize;
            }
        }
        private static List <QuarantineExtended> getQuarantineItems(IEnumerable <int> endpointIDs)
        {
            var resultDeserialize = ServiceManager.Invoke(sc => RequestResponseUtils.GetData <List <QuarantineExtended> >(
                                                              sc.GetQuarantine,
                                                              endpointIDs));

            if (resultDeserialize == null)
            {
                PageNavigatorHelper._MainWindow.Dispatcher.BeginInvoke(DispatcherPriority.Normal,
                                                                       (Action)(() =>
                {
                    var messageDialog =
                        PageNavigatorHelper._MainWindow.MessageDialogContentControl.Content as MessageDialog;
                    messageDialog.ShowMessageDialog("Data is null", "Message");
                }));
                return(new List <QuarantineExtended>());
            }

            return(resultDeserialize);
        }
Пример #27
0
        private void ExecuteDelete(object obj)
        {
            try
            {
                if (DialogHelper.Confirm("Are you sure you want to delete selected task?", "Confirm Delete Task"))
                {
                    var dataRequest = new DataRequest(Id);
                    ServiceManager.Invoke(sc => sc.DeleteTask(RequestResponseUtils.SendData(dataRequest)));

                    var taskListViewModel = PageNavigatorHelper.GetMainContentViewModel <TaskListViewModel>();
                    if (taskListViewModel != null)
                    {
                        taskListViewModel.RemoveTask(this);
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error("Delete Task Error: " + ex.Message, ex);
            }
        }
Пример #28
0
        public static void UpdateMainUpdateSourceConfig()
        {
            try
            {
                using (var sc = new POCServiceClient("NetTcpBinding_IPOCService"))
                {
                    var sourceUrl = RequestResponseUtils.DecryptString(
                        sc.GetMainUpdateSourceUrl()
                        );

                    if (!string.IsNullOrWhiteSpace(sourceUrl))
                    {
                        ApplicationContext.MainUpdateSourceUrl = sourceUrl;
                    }
                    else
                    {
                        var config = ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath);
                        var systemServiceModalSectionGroups = config.SectionGroups["system.serviceModel"];

                        var servicesSectionInformation = systemServiceModalSectionGroups.Sections["client"].SectionInformation;
                        var xmlText = servicesSectionInformation.GetRawXml();
                        var xmlDoc  = new XmlDocument();
                        xmlDoc.LoadXml(xmlText);

                        var endpointNode =
                            xmlDoc.SelectSingleNode(
                                "/client/endpoint[@name='BasicHttpBinding_IMainUpdateSourceService']");
                        if (endpointNode != null)
                        {
                            ApplicationContext.MainUpdateSourceUrl = endpointNode.Attributes["address"].Value;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                _log.Error("UpdateMainUpdateSourceConfig: {0}" + ex.Message, ex);
                DialogHelper.Error("Unable get MainUpdateSource service url");
            }
        }
Пример #29
0
 private void ExecuteAddTask(object obj)
 {
     try
     {
         //Add task item
         var newTaskModel = new PocTask
         {
             Name = "New Task"
         };
         //var request = new DataRequest();
         var dataResponse = ServiceManager.Invoke(sc => RequestResponseUtils.GetData <DataResponse>(sc.AddTask, newTaskModel));
         if (dataResponse != null && dataResponse.Result > 0)
         {
             newTaskModel.Id = dataResponse.Result;
             TaskItemElements.Insert(0, CreateNewTaskItem(newTaskModel));
         }
     }
     catch (Exception ex)
     {
         Logger.Error("Add Task Error: " + ex.Message, ex);
     }
 }
Пример #30
0
        void bgSave_DoWork(object sender, DoWorkEventArgs e)
        {
            _canSave = false;
            var data = e.Argument as UpdateColumnColorRequest;

            if (data != null)
            {
                if (!string.IsNullOrWhiteSpace(data.ColumnName))
                {
                    ServiceManager.Invoke(sc =>
                                          RequestResponseUtils.GetData <UpdateColumnColorResponse>(
                                              sc.UpdateColumnColor, data));
                }
                else
                {
                    var result = ServiceManager.Invoke(sc =>
                                                       RequestResponseUtils.GetData <UpdateColumnColorResponse>(
                                                           sc.UpdateColorByParent, data));
                    if (result != null && result.Status)
                    {
                        AgentNotInstalled = result.AgentNotInstalled;
                        LastSyncDay       = result.LastSyncDay;
                    }
                }
                var respone = new EndpointSearch
                {
                    FolderId = FolderId
                };
                var endpList = ServiceManager.Invoke(sc =>
                                                     RequestResponseUtils.GetData <List <EndPointData> >(
                                                         sc.GetDirectoryEndpointColor, respone));
                _endpointList = new List <EndPoint>();
                foreach (var endd in endpList)
                {
                    var end = new EndPoint(endd);
                    _endpointList.Add(end);
                }
            }
        }