• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# System.Operation类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Operation的典型用法代码示例。如果您正苦于以下问题:C# Operation类的具体用法?C# Operation怎么用?C# Operation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Operation类属于System命名空间,在下文中一共展示了Operation类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: CalcOperation

        public CalcOperation(double a, double b, Operation op)
        {
            A = a;
            B = b;
            Operation = op;

            double result;
            switch (op) {
                case Operation.Addition:
                    result = a + b;
                    break;
                case Operation.Subtraction:
                    result = a - b;
                    break;
                case Operation.Multiplication:
                    result = a * b;
                    break;
                case Operation.Division:
                    result = b == 0
                        ? 0
                        : a / b;
                    break;
                case Operation.Modulo:
                    result = a % b;
                    break;
                default:
                    result = 0;
                    break;
            }
            Result = result;
        }
开发者ID:TheTonttu,项目名称:Reddit-DailyProgrammer,代码行数:31,代码来源:CalcOperation.cs


示例2: LoadOperationRouteImage

        private void LoadOperationRouteImage(Operation operation)
        {
            string fileUrl = string.Format("~/Cache/RouteImages/{0}.png", Regex.Replace(operation.OperationNumber, "[^a-zA-Z0-9]", "").ToString());
            string filePath = MapPath(fileUrl);

            if (!File.Exists(filePath))
            {
                string directory = Path.GetDirectoryName(filePath);
                if (!Directory.Exists(directory))
                {
                    Directory.CreateDirectory(directory);
                }

                // Write the route image
                if (operation.RouteImage != null && operation.RouteImage.Length > 0)
                {
                    File.WriteAllBytes(filePath, operation.RouteImage);
                }
                else
                {
                    // Write empty file to designate that no image is available
                    File.WriteAllText(filePath, "");
                }
            }

            // If it is a zero-sized file, then no route image existed (see above).
            FileInfo fileInfo = new FileInfo(filePath);
            if (fileInfo.Length == 0L)
            {
                return;
            }

            this.imgRouteImage.ImageUrl = fileUrl;
        }
开发者ID:Knatter33,项目名称:AlarmWorkflow,代码行数:34,代码来源:Default.aspx.cs


示例3: PrintDialog

        void IUIJob.OnNewOperation(IOperationViewer operationViewer, Operation operation)
        {
            // Only print if we don't have already (verrrrrrrrrrrry helpful during debugging, but also a sanity-check)
            if (CheckIsOperationAlreadyPrinted(operation, true))
            {
                return;
            }

            PrintQueue printQueue = _printQueue.Value;
            // If printing is not possible (an error occurred because the print server is not available etc.).
            if (printQueue == null)
            {
                Logger.Instance.LogFormat(LogType.Warning, this, "Cannot print job because the configured printer seems not available! Check log entries.");
                return;
            }

            // We need to wait for a bit to let the UI "catch a breath".
            // Otherwise, if printing immediately, it may have side-effects that parts of the visual aren't visible (bindings not updated etc.).
            Thread.Sleep(_configuration.WaitInterval);

            PrintDialog dialog = new PrintDialog();
            dialog.PrintQueue = printQueue;
            dialog.PrintTicket = dialog.PrintQueue.DefaultPrintTicket;
            dialog.PrintTicket.PageOrientation = PageOrientation.Landscape;
            dialog.PrintTicket.CopyCount = _configuration.CopyCount;

            FrameworkElement visual = operationViewer.Visual;
            // Measure and arrange the visual before printing otherwise it looks unpredictably weird and may not fit on the page
            visual.Measure(new Size(dialog.PrintableAreaWidth, dialog.PrintableAreaHeight));
            visual.Arrange(new Rect(new Point(0, 0), visual.DesiredSize));

            dialog.PrintVisual(visual, "New alarm " + operation.OperationNumber);
        }
开发者ID:Knatter33,项目名称:AlarmWorkflow,代码行数:33,代码来源:PrintingUIJob.cs


示例4: InitialCondition

        /// <summary>
        /// Konstruktor okna warunków początkowych
        /// </summary>
        internal InitialCondition(int _mode=SPDAssets.MAX,InitialConditions condition=null)
        {
            _tooltip = -1;
            InitializeComponent();

            Mode = _mode;
            _selectedOperation = Operation.None;
            ComboBox.ItemsSource = SPDAssets.GetBrushRectangles(Mode,InitialConditions.GetTransformation(Mode));
            ComboBox.SelectedIndex = 0;
            DataContext = this;
            _conditionNames = new List<Tuple<string,Tuple<string,bool> > >();
            _conditions = new Dictionary<Tuple<string, bool>, Func<bool, int, int, bool, InitialConditions>>();
            foreach (var T in new[] {false, true})
            {
                _conditions.Add(new Tuple<string, bool>("Donut", T), InitialConditions.DonutFactory);
                _conditions.Add(new Tuple<string, bool>("Circle", T), InitialConditions.CircleFactory);
                _conditions.Add(new Tuple<string,bool>("Diagonal",T),InitialConditions.DiagonalFactory);
                _conditions.Add(new Tuple<string, bool>("NowakMay", T), InitialConditions.NowakMayFactory);
            }
            _conditionNames.AddRange(
                _conditions.Select(
                    k =>
                        new Tuple<string, Tuple<string, bool>>(k.Value(k.Key.Item2, 1,10,false).Name,
                            new Tuple<string, bool>(k.Key.Item1, k.Key.Item2))));
            ComboBoxCopy.ItemsSource = _conditionNames.Select(s=>s.Item1);
            var D = SPDAssets.GenerateLegend(Legend.Height, Mode, InitialConditions.GetTransformation(Mode));
            D.Stretch = Stretch.Fill;

            Legend.Children.Add(D);
            if (condition != null) Condition = condition;
        }
开发者ID:kujawskip,项目名称:SPD,代码行数:34,代码来源:InitialCondition.xaml.cs


示例5: ProwlNotification

        void IJob.Execute(IJobContext context, Operation operation)
        {
            // Construct Notification text
            string body = "Einsatz:\r\n";
            body += "Zeitstempel: " + operation.Timestamp.ToString() + "\r\n";
            body += "Stichwort: " + operation.Keywords.Keyword + "\r\n";
            body += "Meldebild: " + operation.Picture + "\r\n";
            body += "Einsatznr: " + operation.OperationNumber + "\r\n";
            body += "Hinweis: " + operation.Comment + "\r\n";
            body += "Mitteiler: " + operation.Messenger + "\r\n";
            body += "Einsatzort: " + operation.Einsatzort.Location + "\r\n";
            body += "Straße: " + operation.Einsatzort.Street + " " + operation.Einsatzort.StreetNumber + "\r\n";
            body += "Ort: " + operation.Einsatzort.ZipCode + " " + operation.Einsatzort.City + "\r\n";
            body += "Objekt: " + operation.Einsatzort.Property + "\r\n";

            ProwlNotification notifi = new ProwlNotification();
            notifi.Priority = ProwlNotificationPriority.Emergency;
            notifi.Event = "Feuerwehr Einsatz";
            notifi.Description = body;

            //Send the Message
            try
            {
                _client.PostNotification(notifi);
            }
            catch (Exception ex)
            {
                Logger.Instance.LogFormat(LogType.Error, this, "An error occurred while sending the Prowl Messages.", ex);
            }
        }
开发者ID:Knatter33,项目名称:AlarmWorkflow,代码行数:30,代码来源:ProwlJob.cs


示例6: Parse

        public static new Inform Parse(XmlElement inform)
        {
            if (inform == null)
            {
                throw new Exception("parameter can't be null!");
            }

            string type = string.Empty;
            string operation = string.Empty;

            if (inform.HasAttribute("Type"))
            {
                type = inform.GetAttribute("Type");
            }
            else
            {
                throw new Exception("load hasn't type attribute!");
            }

            if (inform.HasAttribute("Operation"))
            {
                operation = inform.GetAttribute("Operation");
            }
            else
            {
                throw new Exception("parameter hasn't Operation attribute!");
            }

            Operation enumOperation = (Operation)Enum.Parse(typeof(Operation), operation);

            Inform result = new Inform(enumOperation, inform.Name, type, inform.InnerText);

            return result;

        }
开发者ID:SiteView,项目名称:ECC8.13,代码行数:35,代码来源:Inform.cs


示例7: ValueMutationQueueEventProcessor

 public ValueMutationQueueEventProcessor(BlockingCollection<long> blockingQueue, Operation operation, long iterations)
 {
     _blockingQueue = blockingQueue;
     _operation = operation;
     _iterations = iterations;
     _done = false;
 }
开发者ID:Xamarui,项目名称:Disruptor-net,代码行数:7,代码来源:ValueMutationQueueEventProcessor.cs


示例8: CommandLineOptions

 public CommandLineOptions(
     Operation operation,
     ImmutableArray<string[]> preprocessorConfigurations,
     ImmutableArray<string> copyrightHeader,
     ImmutableDictionary<string, bool> ruleMap,
     ImmutableArray<string> formatTargets,
     ImmutableArray<string> fileNames,
     string language,
     bool allowTables,
     bool verbose,
     bool formatFiles,
     bool verifyFiles)
 {
     Operation = operation;
     PreprocessorConfigurations = preprocessorConfigurations;
     CopyrightHeader = copyrightHeader;
     RuleMap = ruleMap;
     FileNames = fileNames;
     FormatTargets = formatTargets;
     Language = language;
     AllowTables = allowTables;
     Verbose = verbose;
     FormatFiles = formatFiles;
     VerifyFiles = verifyFiles;
 }
开发者ID:jimdeselms,项目名称:codeformatter,代码行数:25,代码来源:CommandLineParser.cs


示例9: Process

        public void Process(int sender, int receiver, Operation operation, object data)
        {
            IFrontCommand command = this.GetCommand(receiver);

            command.Initialize(sender, data, operation);
            command.Process();
        }
开发者ID:evelasco85,项目名称:TimeTracker,代码行数:7,代码来源:FrontController.cs


示例10: foreach

 void IJob.DoJob(Operation einsatz)
 {
     // TODO: This string contains CustomData. When actually using this job this should be revised to NOT use any custom data (or make it extensible)!
     string text = "Einsatz:%20" + SmsJob.PrepareString(einsatz.City.Substring(0, einsatz.City.IndexOf(" ", StringComparison.Ordinal))) + "%20" + SmsJob.PrepareString((string)einsatz.CustomData["Picture"]) + "%20" + SmsJob.PrepareString(einsatz.Comment) + "%20Strasse:%20" + SmsJob.PrepareString(einsatz.Street);
     foreach (string number in this.numbers)
     {
         try
         {
             HttpWebRequest msg = (HttpWebRequest)System.Net.WebRequest.Create(new Uri("http://gateway.sms77.de/?u=" + this.username + "&p=" + this.password + "&to=" + number + "&text=" + text + "&type=basicplus"));
             HttpWebResponse resp = (HttpWebResponse)msg.GetResponse();
             Stream resp_steam = resp.GetResponseStream();
             using (StreamReader streamreader = new StreamReader(resp_steam, Encoding.UTF8))
             {
                 string response = streamreader.ReadToEnd();
                 if (response != "100")
                 {
                     Logger.Instance.LogFormat(LogType.Warning, this, "Error from sms77! Status code = {0}.", response);
                 }
             }
         }
         catch (Exception ex)
         {
             Logger.Instance.LogFormat(LogType.Error, this, "An error occurred while sending a Sms to '{0}'.", number);
             Logger.Instance.LogException(this, ex);
         }
     }
 }
开发者ID:Mitch123,项目名称:AlarmWorkflow,代码行数:27,代码来源:SMSJob.cs


示例11: foreach

 void IOperationViewer.OnNewOperation(Operation operation)
 {
     foreach (IUIWidget uiWidget in _WidgetManager.Widgets)
     {
         uiWidget.OnOperationChange(operation);
     }
 }
开发者ID:Knatter33,项目名称:AlarmWorkflow,代码行数:7,代码来源:CustomOperationView.xaml.cs


示例12: PrintFaxes

        private void PrintFaxes(IJobContext context, Operation operation)
        {
            if (!context.Parameters.ContainsKey("ArchivedFilePath") || !context.Parameters.ContainsKey("ImagePath"))
            {
                Logger.Instance.LogFormat(LogType.Trace, this, Resources.NoPrintingPossible);
                return;
            }

            System.IO.FileInfo sourceImageFile = new System.IO.FileInfo((string)context.Parameters["ImagePath"]);
            if (!sourceImageFile.Exists)
            {
                Logger.Instance.LogFormat(LogType.Error, this, Resources.FileNotFound, sourceImageFile.FullName);
                return;
            }

            // Grab all created files to print
            string imagePath = (string)context.Parameters["ImagePath"];

            foreach (string queueName in _settings.GetSetting("AlarmSourcePrinterJob", "PrintingQueueNames").GetStringArray())
            {
                var queues = _settings.GetSetting(SettingKeys.PrintingQueuesConfiguration).GetValue<PrintingQueuesConfiguration>();
                PrintingQueue pq = queues.GetPrintingQueue(queueName);
                if (pq == null || !pq.IsEnabled)
                {
                    continue;
                }

                PrintFaxTask task = new PrintFaxTask();
                task.ImagePath = imagePath;
                task.Print(pq);
            }
        }
开发者ID:Bolde,项目名称:AlarmWorkflow,代码行数:32,代码来源:AlarmSourcePrinterJob.cs


示例13: Calculate

 public static Interval Calculate(Operation operation, Interval a, Interval b)
 {
     Interval result = new Interval();
     switch (operation)
     {
         case Operation.Add:
             result.UpperBound = a.UpperBound + b.UpperBound;
             result.LowerBound = a.LowerBound + b.LowerBound;
             break;
         case Operation.Sub:
             result.UpperBound = a.UpperBound - b.LowerBound;
             result.LowerBound = a.LowerBound - b.UpperBound;
             break;
         case Operation.Mul:
             result.UpperBound = Math.Max(Math.Max(a.UpperBound * b.UpperBound, a.UpperBound * b.LowerBound), Math.Max(a.LowerBound * b.UpperBound, a.LowerBound * b.LowerBound));
             result.LowerBound = Math.Min(Math.Min(a.UpperBound * b.UpperBound, a.UpperBound * b.LowerBound), Math.Min(a.LowerBound * b.UpperBound, a.LowerBound * b.LowerBound));
             break;
         case Operation.Div:
             if (b.UpperBound != 0 && b.LowerBound != 0)
             {
                 result.UpperBound = Math.Max(Math.Max(a.UpperBound / b.UpperBound, a.UpperBound / b.LowerBound), Math.Max(a.LowerBound / b.UpperBound, a.LowerBound / b.LowerBound));
                 result.LowerBound = Math.Min(Math.Min(a.UpperBound / b.UpperBound, a.UpperBound / b.LowerBound), Math.Min(a.LowerBound / b.UpperBound, a.LowerBound / b.LowerBound));
             }
             break;
         default:
             break;
     }
     return result;
 }
开发者ID:bs135,项目名称:FuzzyNumberCalc,代码行数:29,代码来源:Utils.cs


示例14: PropertyFilter

        /// <summary>
        /// Creates a new <see cref="PropertyFilter"/>
        /// </summary>
        /// <param name="targetValue">The value against which log events are compared</param>
        /// <param name="operation">The operation used by this <see cref="PropertyFilter" /></param>
        /// <param name="propertyReader">The <see cref="PropertyReader"/> used by this <see cref="PropertyFilter"/></param>
        /// <param name="defaultEvaluation">The default evaluation of the filter in the event of a failure to read the property</param>
        public PropertyFilter(string targetValue, Operation operation, PropertyReader propertyReader, bool defaultEvaluation)
        {
            if (null == propertyReader)
                throw new ArgumentNullException("propertyReader");

            Initialize(targetValue, operation, propertyReader, defaultEvaluation);
        }
开发者ID:Zoumaho,项目名称:Backload,代码行数:14,代码来源:PropertyFilter.cs


示例15: AddFunction

 void AddFunction(Operation op, Func<IEnumerable<Int32>> f)
 {
     //Just add it to the dictionary of operations
     functions.Add(op, f);
     //And to the combobox
     operation.Items.Add(op);
 }
开发者ID:koson,项目名称:Exercises.Day5,代码行数:7,代码来源:Form1.cs


示例16: MazeImagePoint

		public MazeImagePoint(string line)
		{
			string[] parameters = line.Split(' ');
			X = int.Parse(parameters[0]);
			Y = int.Parse(parameters[1]);
			Operation = (Operation)int.Parse(parameters[2]);
		}
开发者ID:bchalek,项目名称:AUMMaze,代码行数:7,代码来源:MazeImagePoint.cs


示例17: Compare

        /// <summary>
        /// Compares to values using the specified operations (this should be one of the <see cref="SupportedOperations"/>)
        /// </summary>
        /// <param name="operation">The type of <see cref="Operation" /> used for the comparison</param>
        /// <param name="value1">The first value in the comparison</param>
        /// <param name="value2">The second value in the comparison</param>
        /// <returns>true or false</returns>
        public bool Compare(Operation operation, object value1, object value2)
        {
            string string1 = (string)value1;
            string string2 = (string)value2;

            switch (operation)
            {
                case Operation.Equals:
                    return string1 == string2;
                case Operation.NotEquals:
                    return string1 != string2;
                case Operation.IsNull:
                    return string1 == null;
                case Operation.IsNotNull:
                    return string1 != null;
                case Operation.Contains:
                    return string1 != null && string2 != null && string1.Contains(string2);
                case Operation.StartsWith:
                    return
                        string1 != null && string2 != null &&
                        string1.StartsWith(string2, StringComparison.CurrentCulture);
                case Operation.EndsWith:
                    return
                        string1 != null && string2 != null && string1.EndsWith(string2, StringComparison.CurrentCulture);
                case Operation.RegexMatch:
                    return GetRegex(string2).IsMatch(string1);
                default:
                    throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture,
                                                                      Resources.OperationNotSupported,
                                                                      operation,
                                                                      typeof(StringComparator).FullName,
                                                                      SupportedOperations));
            }
        }
开发者ID:Zoumaho,项目名称:Backload,代码行数:41,代码来源:StringComparator.cs


示例18: foreach

        void IJob.Execute(IJobContext context, Operation operation)
        {
            //Gets the mail-addresses with googlemail.com or gmail.com
            foreach (MailAddressEntryObject recipient in _recipientsEntry)
            {
                if (recipient.Address.Address.EndsWith("@gmail.com") ||
                    recipient.Address.Address.EndsWith("@googlemail.com"))
                {
                    _recipients.Add(recipient.Address.Address);
                }
            }
            string to = String.Join(",", _recipients.ToArray());

            //TODO Fetching Longitude and Latitude!
            Dictionary<String, String> geoCode =
                Helpers.GetGeocodes(operation.Einsatzort.Location + " " + operation.Einsatzort.Street + " " + operation.Einsatzort.StreetNumber);
            String longitude = "0";
            String latitude = "0";
            if (geoCode != null)
            {
                longitude = geoCode[Resources.LONGITUDE];
                latitude = geoCode[Resources.LATITUDE];
            }
            String body = operation.ToString(SettingsManager.Instance.GetSetting("eAlarm", "text").GetString());
            String header = operation.ToString(SettingsManager.Instance.GetSetting("eAlarm", "header").GetString());
            var postParameters = new Dictionary<string, string>
                                     {
                                         {"email", to},
                                         {"header", header},
                                         {"text", body},
                                         {"long", longitude},
                                         {"lat", latitude}
                                     };
            string postData = postParameters.Keys.Aggregate("",
                                                            (current, key) =>
                                                            current +
                                                            (HttpUtility.UrlEncode(key) + "=" +
                                                             HttpUtility.UrlEncode(postParameters[key]) + "&"));

            byte[] data = Encoding.UTF8.GetBytes(postData);
            webRequest.ContentLength = data.Length;

            Stream requestStream = webRequest.GetRequestStream();
            var webResponse = (HttpWebResponse)webRequest.GetResponse();
            Stream responseStream = webResponse.GetResponseStream();

            requestStream.Write(data, 0, data.Length);
            requestStream.Close();

            if (responseStream != null)
            {
                var reader = new StreamReader(responseStream, Encoding.Default);
                string pageContent = reader.ReadToEnd();
                reader.Close();
                responseStream.Close();
                webResponse.Close();

                //TODO Analyzing Response
            }
        }
开发者ID:pineiro,项目名称:AlarmWorkflow,代码行数:60,代码来源:eAlarm.cs


示例19: OperationRow

 public OperationRow(int key, String description, Operation op, Boolean on)
 {
     this.Key = key;
     this.Description = description;
     this.Op = op;
     this.On = on;
 }
开发者ID:HongSeokHwan,项目名称:legacy,代码行数:7,代码来源:OperationSet.cs


示例20: ProcessArithmetic

        private void ProcessArithmetic(Operation op)
        {
            var first = Process.EvalStack.Pop();
            var second = Process.EvalStack.Pop();

            var type = first.Type == second.Type ? first.Type : typeof(float);

            var result = new Symbol { Name = Guid.NewGuid().ToString(), Type = type};

            switch (op)
            {
                case Operation.Add:
                    result.Value = first.Value + second.Value;
                    break;
                case Operation.Sub:
                    result.Value = first.Value - second.Value;
                    break;
                case Operation.Mul:
                    result.Value = first.Value * second.Value;
                    break;
                case Operation.Div:
                    result.Value = first.Value / second.Value;
                    break;
            }

            Process.EvalStack.Push(result);
        }
开发者ID:santosh-mnrec,项目名称:NPortugol2,代码行数:27,代码来源:Engine.Proc.cs



注:本文中的System.Operation类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# System.PageData类代码示例发布时间:2022-05-26
下一篇:
C# System.OperatingSystem类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap