简单的跨平台流程来处理Mono中的通信?

我正在开发一个可在Linux,Mac和Windows上运行的Mono应用程序,并且需要应用程序(在单个操作系统上)才能相互发送简单的字符串消息。 具体来说,我想要一个单实例应用程序。 如果尝试启动第二个实例,它将向已经运行的单个实例发送消息。 DBus已经出局了,因为我不希望这是一个额外的要求。 套接字通信似乎很难,因为Windows似乎不允许连接权限。 Mono似乎不支持内存映射文件。 Mono似乎不支持命名管道。 似乎在Mono上不支持IPC。 那么,是否有一种简单的方法可以将单个计算机上的字符串消息发送到适用于每个操作系统的服务器应用程序,而无需权限或其他依赖项?

C# – 参数在静态方法中是否安全?

这个方法是线程安全的吗? 好像它不是…… public static void Foo(string _str, Guid _id) { _str = _str + _id.ToString(); /* Do Stuff */ return }

我可以从xaml过滤集合吗?

我有一个wpf-mvvm应用程序。 我的viewmodel中有一个可观察的集合 public ObservableCollection ImportMessageList { get; set; } “BatchImportResultMessageDto”包含两个属性.. 结果类型和消息。 结果类型可以是成功或失败。 我需要在一个列表框中显示成功..而在另一个列表框中显示失败。 我可以这样做..在viewmodel中有2个可观察的集合来保存成功/失败。 public ObservableCollection ImportFailureMessageList { get; set; } // To hold the failure messages. public ObservableCollection ImportSuccessMessageList { get; set; } // To hold the sucess messages. 但还有其他更好的方法,以便我可以过滤它(没有新的两个集合)?

Server.MapPath从root返回两个文件夹

我是这样做的: HttpContext.Current.Server.MapPath(@”~\~\~\Content\”) 我知道’。’ 是为了项目的根,但如何回几个文件夹?

如何在不调用构造函数的情况下反序列化类?

我在我的WCF数据服务中使用Json.NET。 这是我的课程(简化): [DataContract] public class Component { public Component() { // I’m doing some magic here. } } 如何在不使用JsonConvert.DeserializeObject调用构造函数的情况下反序列化该类? 对不起,如果不清楚,随时提问。

为什么使用匿名类型工作并使用不在GroupBy中的显式类型?

我有一个问题,我希望组类型强类型,但如果我这样做不正确分组。 看下面的代码…… using System; using System.Collections.Generic; using System.Linq; namespace ConsoleApplication35 { class Program { static void Main(string[] args) { List foos = new List(); foos.Add(new Foo() { Key = “Test” }); foos.Add(new Foo() { Key = “Test” }); foos.Add(new Foo() { Key = “Test” }); var groups = foos.GroupBy(entry => new { GroupKey = entry.Key […]

UWP Combobox绑定到SelectedItem属性

我正在尝试使用combobox来处理绑定,以便最终可以将其用于某些设置。 我可以从一个可观察的集合中获取要填充的项目,并将’SelectedItem’绑定到一个属性SelectedItem=”{x:Bind SelectedComboBoxOption}” 但是当我更改选择时,这不会反映在也绑定到此属性的文本框中。 在它背后的代码中,在启动时设置属性一次,但在更改combobox中的项目时则不设置。 我必须遗漏一些东西,但我不清楚是什么。 有任何想法吗? 这是XAML: 这就是背后的代码: using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.IO; using System.Linq; using System.Runtime.InteropServices.WindowsRuntime; using Windows.Foundation; using Windows.Foundation.Collections; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls.Primitives; using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Input; using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Navigation; namespace ComboBoxTest { public sealed partial class MainPage : Page, INotifyPropertyChanged { private ObservableCollection […]

需要帮助了解Ninject如何将Nhibernate SessionFactory实例添加到UnitOfWork中?

因此,使用教程中的一些帮助,我已经设法使用Ninject将Nhibernate会话连接到我的存储库和我的存储库到我的控制器。 然而,有一个设置,我没有理解Ninject正在做的“自动化”,并希望有人可以解释。 下面是我的Ninject ModuleRepository ,它inheritance自NinjectModule,它执行所有绑定。 public class ModuleRepository : NinjectModule { public override void Load() { var helper = new NHibernateHelper(ConfigurationManager.ConnectionStrings[Environment.MachineName].ConnectionString); Bind().ToConstant(helper.SessionFactory) .InSingletonScope(); Bind().To() .InRequestScope(); Bind().ToProvider() .InRequestScope(); Bind<IRepository>().To(); Bind<IRepository>().To(); } } 这是UnitOfWork类 : public class UnitOfWork : IUnitOfWork { private readonly ISessionFactory _sessionFactory; private readonly ITransaction _transaction; public ISession Session { get; private set; } […]

如何使用HttpWebRequest在POST中转义URL编码数据

我正在尝试将URL编码的post发送到用PHP实现的REST API。 POST数据包含两个用户提供的字符串: WebRequest request = HttpWebRequest.Create(new Uri(serverUri, “rest”)); request.Method = “POST”; request.ContentType = “application/x-www-form-urlencoded; charset=UTF-8”; request.Headers.Add(“Content-Transfer-Encoding”, “binary”); // Form the url-encoded credentials we’ll use to log in StringBuilder builder = new StringBuilder(); builder.Append(“user=”); builder.Append(user); builder.Append(“&password=”); builder.Append(password); byte[] credentials = Encoding.UTF8.GetBytes(builder.ToString()); // Write the url-encoded post data into the request stream. request.ContentLength = credentials.Length; using […]

如何使用WCF签署SOAP请求

我有第三方SOAP Web服务。 我需要调用其中一个方法。 请求需要签名。 我如何签署请求?