当前位置: 首页>>代码示例>>C#>>正文


C# System.Operation类代码示例

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


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


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