private static List <string> WriteExcelResultFiles([NotNull] ScenarioSliceParameters parameters,
                                                           [NotNull] Func <string, ScenarioSliceParameters, bool, string> makeAndRegisterFullFilename,
                                                           ProcessingMode processingMode,
                                                           [NotNull] ProfileGenerationRo pgRo)
        {
            List <string> excelFileNames = new List <string>();
            var           fn1            = makeAndRegisterFullFilename("AllGeneratedLoadProfilesAndEnergy." + processingMode + ".Tree.xlsx", parameters, true);

            excelFileNames.Add(fn1);
            pgRo.DumpToExcel(fn1, XlsResultOutputMode.Tree);
            var fn2 = makeAndRegisterFullFilename("AllGeneratedLoadProfilesAndEnergy." + processingMode + ".Full.xlsx", parameters, true);

            pgRo.DumpToExcel(fn2, XlsResultOutputMode.FullLine);
            excelFileNames.Add(fn2);
            var fn3 = makeAndRegisterFullFilename("AllGeneratedLoadProfilesAndEnergy." + processingMode + ".ByTrafoStationTree.xlsx",
                                                  parameters,
                                                  true);

            excelFileNames.Add(fn3);
            pgRo.DumpToExcel(fn3, XlsResultOutputMode.ByTrafoStationTree);

            var fn4 = makeAndRegisterFullFilename("AllGeneratedLoadProfilesAndEnergy." + processingMode + ".ByTrafoStationHausanschlussTree.xlsx",
                                                  parameters,
                                                  true);

            excelFileNames.Add(fn4);
            pgRo.DumpToExcel(fn4, XlsResultOutputMode.ByTrafoStationHausanschlussTree);
            return(excelFileNames);
        }
        private static void WriteBrokenLpgCalcCleanupBatch([NotNull] ScenarioSliceParameters parameters,
                                                           [NotNull] Func <string, ScenarioSliceParameters, bool, string> makeAndRegisterFullFilename,
                                                           ProcessingMode processingMode,
                                                           [NotNull][ItemNotNull] List <string> brokenLpgDirectories,
                                                           [NotNull][ItemNotNull] List <string> brokenLpgJsons)
        {
            var lpgCleaner = makeAndRegisterFullFilename("CleanBrokenLPGStuff." + processingMode + "." + parameters.GetFileName() + ".cmd",
                                                         parameters,
                                                         true);
            Encoding     utf8WithoutBom = new UTF8Encoding(false);
            FileStream   fs             = new FileStream(lpgCleaner, FileMode.Create);
            StreamWriter sw             = new StreamWriter(fs, utf8WithoutBom);

            sw.WriteLine("chcp 65001");
            foreach (string brokenLpgDirectory in brokenLpgDirectories)
            {
                sw.WriteLine("rmdir /S /Q \"" + brokenLpgDirectory + "\" ");
            }

            foreach (string brokenLpgJson in brokenLpgJsons)
            {
                sw.WriteLine("del \"" + brokenLpgJson + "\" ");
            }

            sw.Close();
        }
Beispiel #3
0
        /// <summary>
        /// Creates a FileContentResult object by using Report Viewer Web Control.
        /// </summary>
        /// <param name="controller">The Controller instance that this method extends.</param>
        /// <param name="reportFormat">Report Viewer Web Control supported format (Excel, Word, PDF or Image)</param>
        /// <param name="reportPath">The path to the report on the server.</param>
        /// <param name="reportServerUrl">The URL for the report server.</param>
        /// <param name="reportParameters">The report parameter properties for the report.</param>
        /// <param name="username">The report server username.</param>
        /// <param name="password">The report server password.</param>
        /// <param name="mode">Report processing mode: remote or local.</param>
        /// <param name="localReportDataSources">Local report data sources</param>
        /// <param name="filename">Output filename</param>
        /// <returns>The file-content result object.</returns>
        public static FileStreamResult Report(
            this Controller controller,
            ReportFormat reportFormat,
            string reportPath,
            string reportServerUrl,
            IEnumerable <KeyValuePair <string, object> > reportParameters,
            string username     = null,
            string password     = null,
            ProcessingMode mode = ProcessingMode.Remote,
            IDictionary <string, DataTable> localReportDataSources = null,
            string filename = null)
        {
            var reportRunner = new ReportRunner(
                reportFormat,
                reportPath,
                reportServerUrl,
                username,
                password,
                reportParameters,
                mode,
                localReportDataSources,
                filename);

            return(reportRunner.Run());
        }
Beispiel #4
0
        public ReportRunner(
            ReportFormat reportFormat,
            string reportPath,
            string reportServerUrl,
            string username,
            string password,
            IEnumerable <KeyValuePair <string, object> > reportParameters,
            ProcessingMode mode = ProcessingMode.Remote,
            IDictionary <string, DataTable> localReportDataSources = null,
            string filename = null)
        {
            ReportFormat = reportFormat;
            _filename    = filename;

            _viewerParameters.ProcessingMode = mode;
            if (mode == ProcessingMode.Local && localReportDataSources != null)
            {
                _viewerParameters.LocalReportDataSources = localReportDataSources;
            }

            _viewerParameters.ReportPath      = reportPath;
            _viewerParameters.ReportServerUrl = reportServerUrl ?? _viewerParameters.ReportServerUrl;
            if (username != null || password != null)
            {
                _viewerParameters.Username = username;
                _viewerParameters.Password = password;
            }

            ParseParameters(reportParameters);
        }
Beispiel #5
0
        /// <summary>
        /// Creates a FileContentResult object by using Report Viewer Web Control.
        /// </summary>
        /// <param name="controller">The Controller instance that this method extends.</param>
        /// <param name="reportFormat">Report Viewer Web Control supported format (Excel, Word, PDF or Image)</param>
        /// <param name="reportPath">The path to the report on the server.</param>
        /// <param name="reportServerUrl">The URL for the report server.</param>
        /// <param name="username">The report server username.</param>
        /// <param name="password">The report server password.</param>
        /// <param name="reportParameters">The report parameter properties for the report.</param>
        /// <param name="mode">Report processing mode: remote or local.</param>
        /// <param name="localReportDataSources">Local report data sources</param>
        /// <param name="filename">Output filename</param>
        /// <returns>The file-content result object.</returns>
        public static FileStreamResult Report(
            this Controller controller,
            ReportFormat reportFormat,
            string reportPath,
            string reportServerUrl,
            string username         = null,
            string password         = null,
            object reportParameters = null,
            ProcessingMode mode     = ProcessingMode.Remote,
            IDictionary <string, DataTable> localReportDataSources = null,
            string filename = null)
        {
            var reportRunner = new ReportRunner(
                reportFormat,
                reportPath,
                reportServerUrl,
                username,
                password,
                HtmlHelper.AnonymousObjectToHtmlAttributes(reportParameters),
                mode,
                localReportDataSources,
                filename);

            return(reportRunner.Run());
        }
 public ReportRunner(
     ReportFormat reportFormat,
     string reportPath,
     ProcessingMode mode = ProcessingMode.Remote,
     IDictionary<string, DataTable> localReportDataSources = null)
     : this(reportFormat, reportPath, null, null, null, null, mode, localReportDataSources)
 {
 }
 private void ChangeMode(ProcessingMode mode)
 {
     if (State != mode)
     {
         _screen.WriteLine($"Mode {State}=>{mode}");
         State = mode;
     }
 }
Beispiel #8
0
 public override string ToString()
 {
     if (ProcessingMode == HL7Table.ProcessingMode.None)
     {
         return(ProcessingID.Value());
     }
     return(ProcessingID.Value() + "^" + ProcessingMode.Value());
 }
        public override void InitCamera()
        {
            _prevCamQuality = CamQuality;
            _prevCamMode = CamMode;
            ImageProcessing.SetOvrCamera((int)CamQuality, (int)CamMode);

            UpdateCameraProperties(true);
        }
 public void SetMode(ProcessingMode mode)
 {
     if (State != mode)
     {
         State = mode;
         _screen.WriteLine($"Mode changed to {mode}");
     }
 }
 public ReportRunner(
     ReportFormat reportFormat,
     string reportPath,
     ProcessingMode mode = ProcessingMode.Remote,
     IDictionary <string, DataTable> localReportDataSources = null)
     : this(reportFormat, reportPath, null, null, null, null, mode, localReportDataSources)
 {
 }
 public ReportRunner(
     ReportFormat reportFormat,
     string reportPath,
     IEnumerable<KeyValuePair<string, object>> reportParameters,
     ProcessingMode mode = ProcessingMode.Remote,
     IDictionary<string, DataTable> localReportDataSources = null)
     : this(reportFormat, reportPath, null, null, null, reportParameters, mode, localReportDataSources)
 {
 }
 public ReportRunner(
     ReportFormat reportFormat,
     string reportPath,
     IEnumerable <KeyValuePair <string, object> > reportParameters,
     ProcessingMode mode = ProcessingMode.Remote,
     IDictionary <string, DataTable> localReportDataSources = null)
     : this(reportFormat, reportPath, null, null, null, reportParameters, mode, localReportDataSources)
 {
 }
Beispiel #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Logger"/> class.
 /// </summary>
 /// <param name="name">The name of the logger.</param>
 /// <param name="level">The logging level of the logger.</param>
 /// <param name="logProviders">A collection of <see cref="ILogProvider"/> objects used by this logger.</param>
 /// <param name="isDisabled">A value indicating whether the logger is disabled.</param>
 /// <param name="processingMode">A value that indicates how the logger will process logs.</param>
 /// <param name="contextProviders">
 /// A collection of <see cref="IContextProvider"/> objects that customize outgoing log entries.
 /// </param>
 public Logger(
     string name    = DefaultName,
     LogLevel level = LogLevel.NotSet,
     [AlternateName("providers")] IReadOnlyCollection <ILogProvider> logProviders = null,
     bool isDisabled = false,
     ProcessingMode processingMode = ProcessingMode.Background,
     IReadOnlyCollection <IContextProvider> contextProviders = null)
     : this(GetLogProcessor(processingMode), name, level, logProviders, isDisabled, contextProviders)
 {
 }
 /// <summary>
 /// Creates a FileContentResult object by using Report Viewer Web Control.
 /// </summary>
 /// <param name="controller">The Controller instance that this method extends.</param>
 /// <param name="reportFormat">Report Viewer Web Control supported format (Excel, Word, PDF or Image)</param>
 /// <param name="reportPath">The path to the report on the server.</param>
 /// <param name="mode">Report processing mode: remote or local.</param>
 /// <param name="localReportDataSources">Local report data sources</param>
 /// <returns>The file-content result object.</returns>
 public static FileStreamResult Report(
     this Controller controller,
     ReportFormat reportFormat,
     string reportPath,
     ProcessingMode mode = ProcessingMode.Remote,
     IDictionary<string, DataTable> localReportDataSources = null)
 {
     var reportRunner = new ReportRunner(reportFormat, reportPath, mode, localReportDataSources);
     return reportRunner.Run();
 }
        // -------------------------------------------------------------------
        // Constructor
        // -------------------------------------------------------------------
        public ColladaMinecraft(IFactory factory)
            : base(factory)
        {
            this.arguments = factory.Resolve<ICommandLineArguments>();

            this.modelBoundingBox = new BoundingBox(new Vector3(0), new Vector3(0));

            this.blocks = new Dictionary<Block, Block>();

            this.mode = ProcessingMode.ColladaToSchematic;
        }
Beispiel #17
0
        public MainWindow()
        {
            InitializeComponent();

            //Start with brightness as selection for mode
            BrightnessMode.IsChecked = true;
            _mode = ProcessingMode.Brightness;

            _player = new MediaPlayer();
            EnablePlaybackControls(_player.Loaded);
        }
        /// <summary>
        /// Creates a FileContentResult object by using Report Viewer Web Control.
        /// </summary>
        /// <param name="controller">The Controller instance that this method extends.</param>
        /// <param name="reportFormat">Report Viewer Web Control supported format (Excel, Word, PDF or Image)</param>
        /// <param name="reportPath">The path to the report on the server.</param>
        /// <param name="mode">Report processing mode: remote or local.</param>
        /// <param name="localReportDataSources">Local report data sources</param>
        /// <returns>The file-content result object.</returns>
        public static FileStreamResult Report(
            this Controller controller,
            ReportFormat reportFormat,
            string reportPath,
            ProcessingMode mode = ProcessingMode.Remote,
            IDictionary <string, DataTable> localReportDataSources = null)
        {
            var reportRunner = new ReportRunner(reportFormat, reportPath, mode, localReportDataSources);

            return(reportRunner.Run());
        }
        protected override bool RegisterCommandLineArguments()
        {
            ICommandLineSwitchDefinition definition = this.arguments.Define("s", "sourceFile", x => this.sourceFile = new CarbonFile(x));
            definition.Required = true;
            definition.RequireArgument = true;
            definition.Description = "The source file to process";

            definition = this.arguments.Define("m", "mode", x => this.mode = (ProcessingMode)Enum.Parse(typeof(ProcessingMode), x));
            definition.RequireArgument = true;
            definition.Description = "The processing mode";

            return true;
        }
 public ReportRunner(
     ReportFormat reportFormat,
     string reportPath,
     IDictionary<string, object> reportParameters,
     ProcessingMode mode = ProcessingMode.Remote,
     IDictionary<string, DataTable> localReportDataSources = null)
     : this(reportFormat, 
         reportPath, 
         reportParameters != null ? reportParameters.ToList() : null,
         mode,
         localReportDataSources)
 {
 }
 //--- Constructors ---
 public Element(string[] names, ProcessingMode mode, params Attribute[] attributes)
 {
     if (ArrayUtil.IsNullOrEmpty(names))
     {
         throw new ArgumentNullException("names");
     }
     this.Names = names;
     this.Mode  = mode;
     foreach (Attribute attribute in attributes)
     {
         this.Attributes[attribute.Name] = attribute;
     }
 }
Beispiel #22
0
        private void AddChunkToCache(JobChunkUid chunkUid, ProcessingMode mode)
        {
            var chunkKey    = GetJobChunkKey(chunkUid, mode);
            var chunkStatus = new JobChunkStatus()
            {
                LastUpdate = DateTime.Now,
                Status     = mode == ProcessingMode.Map ? ChunkStatus.NewMap : ChunkStatus.NewReduce
            };

            chunkStatus.ChunkUid.JobId   = chunkUid.JobId;
            chunkStatus.ChunkUid.ChunkId = chunkUid.ChunkId;

            AzureClient.Instance.CacheClient.Add(chunkKey, chunkStatus);
        }
 public ReportRunner(
     ReportFormat reportFormat,
     string reportPath,
     IDictionary <string, object> reportParameters,
     ProcessingMode mode = ProcessingMode.Remote,
     IDictionary <string, DataTable> localReportDataSources = null)
     : this(
         reportFormat,
         reportPath,
         reportParameters != null ? reportParameters.ToList() : null,
         mode,
         localReportDataSources)
 {
 }
Beispiel #24
0
 /// <summary>
 /// All buttons clicked
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void AllButtonsClick(object sender, EventArgs e)
 {
     try
     {
         if (sender == this.MainForm.ButtonBeginDump)
         {
             if (Controller.IsStartButton(this.MainForm.ButtonBeginDump) == true)
             {
                 this.DumpController_.Validate();
                 this.MainForm.SaveUIState();
                 this.KeepFilesMode = ProcessingMode.DumpMode;
                 StaticMethods.ReInitializeThread(ref this.ThreadRunOperations,
                                                  true,
                                                  new ThreadStart(this.DoProcessing));
             }
             else
             {
                 StaticMethods.ReInitializeThread(ref this.ThreadRunOperations,
                                                  false,
                                                  new ThreadStart(this.DoProcessing));
             }
         }
         else
         if (sender == this.MainForm.ButtonBeginImport)
         {
             if (Controller.IsStartButton(this.MainForm.ButtonBeginImport) == true)
             {
                 this.ImportController_.Validate();
                 this.MainForm.SaveUIState();
                 this.KeepFilesMode = ProcessingMode.ImportMode;
                 StaticMethods.ReInitializeThread(ref this.ThreadRunOperations,
                                                  true,
                                                  new ThreadStart(this.DoProcessing));
             }
             else
             {
                 StaticMethods.ReInitializeThread(ref this.ThreadRunOperations,
                                                  false,
                                                  new ThreadStart(this.DoProcessing));
             }
         }
     }
     catch (Exception em)
     {
         StaticMethods.DisplayErrorMessage(this.MainForm,
                                           null,
                                           false,
                                           em.Message);
     }
 }
        /// <summary>
        /// Calculates the corresponding amplitude and frequency of a pixel from _image.
        /// </summary>
        /// <param name="x">x-coordinate of pixel</param>
        /// <param name="y">y-coordinate of pixel</param>
        /// <param name="mode"></param>
        /// <returns>Data object with amplitude and frequency</returns>
        private AudioData ProcessPixel(int x, int y, ProcessingMode mode)
        {
            var   pixelColor      = _image.GetPixel(x, y);
            float amplitudeFactor = GetAmplitudeForColorAndMode(pixelColor, mode);

            //Use frequency table
            int frequency = (int)_frequencies[y];

            return(new AudioData()
            {
                Frequency = frequency,
                Amplitude = amplitudeFactor
            });
        }
 private void button3_Click(object sender, EventArgs e)
 {
     if (textInput.Text != "" && textOutput.Text != "")
     {
         processingMode = new ProcessingMode(outputMode, inputDirectory, outputDirectory);
         thread         = new Thread(new ThreadStart(BackgroundConvert));
         Lockdown(false);
         convState = 1;
         thread.Start();
     }
     else
     {
         MessageBox.Show("Please specify input/output files/directories.");
     }
 }
Beispiel #27
0
        public void AddMessageQueue <TRequest, TResponse>(object service, ProcessingMode messageProcessingMode)
        {
            var messageQueue = queueCache.GetOrAdd(service, messageProcessingMode);

            var messageSignature = GetMessageSignature <TRequest, TResponse>();

            var handlersForThisMessageSignature = messageQueues.GetOrAdd(messageSignature, t => new ConcurrentBag <IMessageQueue>());

            if (handlersForThisMessageSignature.Contains(messageQueue))
            {
                throw new InvalidOperationException(string.Format("This service has already been registered as a handler for message type {0}", messageSignature));
            }

            handlersForThisMessageSignature.Add(messageQueue);
        }
 /// <summary>
 /// Creates a FileContentResult object by using Report Viewer Web Control.
 /// </summary>
 /// <param name="controller">The Controller instance that this method extends.</param>
 /// <param name="reportFormat">Report Viewer Web Control supported format (Excel, Word, PDF or Image)</param>
 /// <param name="reportPath">The path to the report on the server.</param>
 /// <param name="mode">Report processing mode: remote or local.</param>
 /// <param name="localReportDataSources">Local report data sources</param>
 /// <returns>The file-content result object.</returns>
 public static FileStreamResult Report(
     this Controller controller,
     ReportFormat reportFormat,
     IReportLoader reportLoader,
     ProcessingMode mode,
     IEnumerable<IDataSource> reportDataSources = null,
     IEnumerable<ISubReportDataSource> subReportDataSources = null)
 {
     var reportRunner = new ReportRunner(
         reportFormat,
         reportLoader,
         mode,
         reportDataSources,
         subReportDataSources);
     return reportRunner.Run();
 }
        /// <summary>
        /// Creates a FileContentResult object by using Report Viewer Web Control.
        /// </summary>
        /// <param name="controller">The Controller instance that this method extends.</param>
        /// <param name="reportFormat">Report Viewer Web Control supported format (Excel, Word, PDF or Image)</param>
        /// <param name="reportPath">The path to the report on the server.</param>
        /// <param name="reportParameters">The report parameter properties for the report.</param>
        /// <param name="mode">Report processing mode: remote or local.</param>
        /// <param name="localReportDataSources">Local report data sources</param>
        /// <returns>The file-content result object.</returns>
        public static FileStreamResult Report(
            this Controller controller,
            ReportFormat reportFormat,
            string reportPath,
            IEnumerable<KeyValuePair<string, object>> reportParameters,
            ProcessingMode mode = ProcessingMode.Remote,
            IDictionary<string, DataTable> localReportDataSources = null)
        {
            var reportRunner = new ReportRunner(
                reportFormat,
                reportPath,
                reportParameters,
                mode,
                localReportDataSources);

            return reportRunner.Run();
        }
        /// <summary>
        /// Creates a FileContentResult object by using Report Viewer Web Control.
        /// </summary>
        /// <param name="controller">The Controller instance that this method extends.</param>
        /// <param name="reportFormat">Report Viewer Web Control supported format (Excel, Word, PDF or Image)</param>
        /// <param name="reportPath">The path to the report on the server.</param>
        /// <param name="reportParameters">The report parameter properties for the report.</param>
        /// <param name="mode">Report processing mode: remote or local.</param>
        /// <param name="localReportDataSources">Local report data sources</param>
        /// <returns>The file-content result object.</returns>
        public static FileStreamResult Report(
            this Controller controller,
            ReportFormat reportFormat,
            string reportPath,
            object reportParameters,
            ProcessingMode mode = ProcessingMode.Remote,
            IDictionary<string, DataTable> localReportDataSources = null)
        {
            var reportRunner = new ReportRunner(
                reportFormat,
                reportPath,
                HtmlHelper.AnonymousObjectToHtmlAttributes(reportParameters),
                mode,
                localReportDataSources);

            return reportRunner.Run();
        }
Beispiel #31
0
        private static ILogProcessor GetLogProcessor(ProcessingMode processingMode)
        {
            switch (processingMode)
            {
            case ProcessingMode.Background:
                return(_backgroundLogProcessor.Value);

            case ProcessingMode.Synchronous:
                return(new SynchronousLogProcessor());

            case ProcessingMode.FireAndForget:
                return(new FireAndForgetLogProcessor());

            default:
                throw new ArgumentException($"Processing mode is not defined: {processingMode}.", nameof(processingMode));
            }
        }
            /// <summary>Initializes the scheduler.</summary>
            /// <param name="pair">The parent pair.</param>
            /// <param name="maxConcurrencyLevel">The maximum degree of concurrency this scheduler may use.</param>
            /// <param name="processingMode">The processing mode of this scheduler.</param>
            internal ConcurrentExclusiveTaskScheduler(ConcurrentExclusiveSchedulerPair pair, int maxConcurrencyLevel, ProcessingMode processingMode)
            {
                Contract.Requires(pair != null, "Scheduler must be associated with a valid pair.");
                Contract.Requires(processingMode == ProcessingMode.ProcessingConcurrentTasks || processingMode == ProcessingMode.ProcessingExclusiveTask,
                                  "Scheduler must be for concurrent or exclusive processing.");
                Contract.Requires(
                    (processingMode == ProcessingMode.ProcessingConcurrentTasks && (maxConcurrencyLevel >= 1 || maxConcurrencyLevel == UNLIMITED_PROCESSING)) ||
                    (processingMode == ProcessingMode.ProcessingExclusiveTask && maxConcurrencyLevel == 1),
                    "If we're in concurrent mode, our concurrency level should be positive or unlimited.  If exclusive, it should be 1.");

                m_pair = pair;
                m_maxConcurrencyLevel = maxConcurrencyLevel;
                m_processingMode      = processingMode;
                m_tasks = (processingMode == ProcessingMode.ProcessingExclusiveTask) ?
                          (IProducerConsumerQueue <Task>) new SingleProducerSingleConsumerQueue <Task>() :
                          (IProducerConsumerQueue <Task>) new MultiProducerMultiConsumerQueue <Task>();
            }
        /// <summary>
        /// Add a single rule to the instance.
        /// </summary>
        /// <param name="rule">Rule to add.</param>
        public void AddRule(string rule)
        {
            if (string.IsNullOrEmpty(rule))
            {
                return;
            }
            rule = rule.Trim();
            if (rule.StartsWith("#"))
            {
                return;
            }
            ProcessingMode mode = ProcessingMode.Default;

            switch (rule[0])
            {
            case '-':
                mode = ProcessingMode.RemoveEmpty;
                rule = rule.Substring(1);
                break;

            case '+':
                mode = ProcessingMode.PadEmpty;
                rule = rule.Substring(1);
                break;
            }
            int square = rule.IndexOf('[');

            if (square >= 0)
            {
                string[]         names      = rule.Substring(0, square).Split('/');
                List <Attribute> attributes = new List <Attribute>();
                foreach (string attr in rule.Substring(square + 1).TrimEnd(']').Split('|'))
                {
                    // TODO (steveb): we should support '=' and '<' for default and valid values set
                    int sep = attr.IndexOfAny(new char[] { '=', '<' });

                    attributes.Add(new Attribute((sep >= 0) ? attr.Substring(0, sep) : attr, null));
                }
                Add(new Element(names, mode, attributes.ToArray()));
            }
            else
            {
                Add(rule);
            }
        }
        /// <summary>
        /// Gets the percentage of the maximum amplitude a color should output
        /// </summary>
        /// <param name="pixelColor"></param>
        /// <param name="mode"></param>
        /// <returns></returns>
        private float GetAmplitudeForColorAndMode(Color pixelColor, ProcessingMode mode)
        {
            switch (mode)
            {
            case ProcessingMode.Brightness:
                return(pixelColor.GetBrightness());

            case ProcessingMode.Darkness:
                return(1 - pixelColor.GetBrightness());

            case ProcessingMode.Mode3:
                break;

            case ProcessingMode.Mode4:
                break;
            }
            return(0);
        }
Beispiel #35
0
 /// <summary>
 /// Sets the processing mode to the mode represented by the radio button that triggered this event.
 /// </summary>
 /// <param name="sender">Mode radio button</param>
 /// <param name="e"></param>
 private void ModeSelection_Click(object sender, RoutedEventArgs e)
 {
     if (sender.Equals(BrightnessMode))
     {
         _mode = ProcessingMode.Brightness;
     }
     else if (sender.Equals(DarknessMode))
     {
         _mode = ProcessingMode.Darkness;
     }
     else if (sender.Equals(Mode3))
     {
         _mode = ProcessingMode.Mode3;
     }
     else if (sender.Equals(Mode4))
     {
         _mode = ProcessingMode.Mode4;
     }
 }
Beispiel #36
0
        private void ReloadSettings()
        {
            // load new settings
            ImageProcessing.GetCamJsonProperties(GetPropertyCallback);

            // make sure settings are synced, in case a value was out of range
            CamMode                     = (ProcessingMode)_sourceSettings.Mode;
            Gain                        = _sourceSettings.Gain;
            Exposure                    = _sourceSettings.Exposure;
            BLC                         = _sourceSettings.BLC;
            AutoWhiteBalance            = _sourceSettings.AutoWhiteBalance;
            WhiteBalanceR               = _sourceSettings.WhiteBalanceR;
            WhiteBalanceG               = _sourceSettings.WhiteBalanceG;
            WhiteBalanceB               = _sourceSettings.WhiteBalanceB;
            AutoContrast                = _sourceSettings.AutoContrast;
            AutoContrastAutoGain        = _sourceSettings.AutoContrastAutoGain;
            AutoContrastClipHistPercent = _sourceSettings.AutoContrastClipHistPercent;
            AutoContrastMax             = _sourceSettings.AutoContrastMax;
        }
        /// <summary>
        /// Creates a FileContentResult object by using Report Viewer Web Control.
        /// </summary>
        /// <param name="controller">The Controller instance that this method extends.</param>
        /// <param name="reportFormat">Report Viewer Web Control supported format (Excel, Word, PDF or Image)</param>
        /// <param name="reportPath">The path to the report on the server.</param>
        /// <param name="reportParameters">The report parameter properties for the report.</param>
        /// <param name="mode">Report processing mode: remote or local.</param>
        /// <param name="localReportDataSources">Local report data sources</param>
        /// <returns>The file-content result object.</returns>
        public static FileStreamResult Report(
            this Controller controller,
            ReportFormat reportFormat,
            IReportLoader reportLoader,
            IEnumerable<KeyValuePair<string, object>> reportParameters,
            ProcessingMode mode,
            IEnumerable<IDataSource> reportDataSources = null,
            IEnumerable<ISubReportDataSource> subReportDataSources = null)
        {
            var reportRunner = new ReportRunner(
                reportFormat,
                reportLoader,
                reportParameters,
                mode,
                reportDataSources,
                subReportDataSources);

            return reportRunner.Run();
        }
Beispiel #38
0
        public static string GetString(ProcessingMode mode)
        {
            string ret = "";

            switch (mode)
            {
            case ProcessingMode.Activity:
                ret = "appointment_only";
                break;

            case ProcessingMode.Inventory:
                ret = "inventory_only";
                break;

            default:
                break;
            }
            return(ret);
        }
        /// <summary>
        /// Creates a FileContentResult object by using Report Viewer Web Control.
        /// </summary>
        /// <param name="controller">The Controller instance that this method extends.</param>
        /// <param name="reportFormat">Report Viewer Web Control supported format (Excel, Word, PDF or Image)</param>
        /// <param name="reportPath">The path to the report on the server.</param>
        /// <param name="reportParameters">The report parameter properties for the report.</param>
        /// <param name="mode">Report processing mode: remote or local.</param>
        /// <param name="localReportDataSources">Local report data sources</param>
        /// <returns>The file-content result object.</returns>
        public static FileStreamResult Report(
            this Controller controller,
            ReportFormat reportFormat,
            IReportLoader reportLoader,
            object reportParameters,
            ProcessingMode mode,
            IEnumerable<IDataSource> reportDataSources = null,
            IEnumerable<ISubReportDataSource> subReportDataSources = null)
        {
            var reportRunner = new ReportRunner(
                reportFormat,
                reportLoader,
                HtmlHelper.AnonymousObjectToHtmlAttributes(reportParameters),
                mode,
                reportDataSources,
                subReportDataSources);

            return reportRunner.Run();
        }
        /// <summary>
        /// Iterates through each pixel and processes the data into a map of the resulting frequency and amplitude for each pixel
        /// </summary>
        /// <param name="mode"></param>
        /// <returns>2D array of audio data that matches the image pixels</returns>
        public AudioData[,] Process(ProcessingMode mode)
        {
            _progressBar.Value   = 0;
            _progressBar.Maximum = ImageWidth;

            var data = new AudioData[ImageWidth, ImageHeight];

            for (int i = 0; i < ImageWidth; i++)
            {
                for (int j = 0; j < ImageHeight; j++)
                {
                    //Data from each pixel mapped to output
                    data[i, j] = ProcessPixel(i, j, mode);
                }
                _progressBar.Value++;
            }

            return(data);
        }
Beispiel #41
0
        private bool AllJobChunksCompleted(string jobId, ProcessingMode mode)
        {
            Logger.Log.Instance.Info(string.Format("CacheJobChunkRegistrator. Check for competion of phase {1}. JobId '{0}'",
                                                   jobId, mode));

            var sumKey          = GetJobSummeryKey(jobId);
            var jobSplitDetails = AzureClient.Instance.CacheClient[sumKey] as JobSplitDetails;
            var completedStatus = mode == ProcessingMode.Map ? ChunkStatus.MapCompleted : ChunkStatus.ReduceCompleted;

            foreach (var chunkId in jobSplitDetails.JobChunkIds)
            {
                var chunkKey = GetJobChunkKey(new JobChunkUid()
                {
                    JobId = jobId, ChunkId = chunkId
                }, mode);
                var chunkStatus = AzureClient.Instance.CacheClient[chunkKey] as JobChunkStatus;
                Logger.Log.Instance.Info(string.Format("   ==> Chunk {0}. Status: {1}",
                                                       chunkId, chunkStatus.Status));
                if (chunkStatus.Status != completedStatus)
                {
                    Logger.Log.Instance.Info(string.Format("     ==> Not completed yet"));
                    return(false);
                }
            }
            Logger.Log.Instance.Info(string.Format("   ==> Phase completed. Clear cache"));

            // Clear cache
            foreach (var chunkId in jobSplitDetails.JobChunkIds)
            {
                var chunkKey = GetJobChunkKey(new JobChunkUid()
                {
                    JobId = jobId, ChunkId = chunkId
                }, mode);
                AzureClient.Instance.CacheClient.Remove(chunkKey);
                Logger.Log.Instance.Info(string.Format("     ==> Clear cache for chunk {0}", chunkId));
            }

            AzureClient.Instance.CacheClient.Remove(sumKey);
            Logger.Log.Instance.Info(string.Format("     ==> Clear cache for sum of job {0}", jobId));

            return(true);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="QueuedBackgroundWorker"/> class.
        /// </summary>
        public QueuedBackgroundWorker()
        {
            lockObject = new object();
            stopping = false;
            started = false;
            disposed = false;

            // Threads
            threadCount = 5;
            CreateThreads();

            // Work items
            processingMode = ProcessingMode.FIFO;
            priorityQueues = 5;
            BuildWorkQueue();
            cancelledItems = new Dictionary<object, bool>();

            // The loader complete callback
            workCompletedCallback = new SendOrPostCallback(this.RunWorkerCompletedCallback);
        }
Beispiel #43
0
        /// <summary>
        /// Initializes a new instance of the <see cref="QueuedBackgroundWorker"/> class.
        /// </summary>
        public QueuedBackgroundWorker()
        {
            lockObject = new object();
            stopping   = false;
            started    = false;
            disposed   = false;

            // Threads
            threadCount = 5;
            CreateThreads();

            // Work items
            processingMode = ProcessingMode.FIFO;
            priorityQueues = 5;
            BuildWorkQueue();
            cancelledItems = new Dictionary <object, bool>();

            // The loader complete callback
            workCompletedCallback = new SendOrPostCallback(this.RunWorkerCompletedCallback);
        }
Beispiel #44
0
 public ReportRunner(
     ReportFormat reportFormat,
     string reportPath,
     string reportServerUrl,
     string username,
     string password,
     IDictionary<string, object> reportParameters,
     ProcessingMode mode = ProcessingMode.Remote,
     IDictionary<string, DataTable> localReportDataSources = null,
     string filename = null)
     : this(reportFormat, 
         reportPath, 
         reportServerUrl, 
         username, 
         password, 
         reportParameters?.ToList(),
         mode,
         localReportDataSources,
         filename)
 {
 }
Beispiel #45
0
 public void SetMode(ProcessingMode mode)
 {
     _clients.All.SetMode(mode);
 }
Beispiel #46
0
        public ReportRunner(
            ReportFormat reportFormat,
            string reportPath,
            string reportServerUrl,
            string username,
            string password,
            IEnumerable<KeyValuePair<string, object>> reportParameters,
            ProcessingMode mode = ProcessingMode.Remote,
            IDictionary<string, DataTable> localReportDataSources = null,
            string filename = null)
        {
            _viewerParameters = new ReportViewerParameters
            {
                ReportServerUrl = _config.ReportServerUrl,
                Username = _config.Username,
                Password = _config.Password,
                IsReportRunnerExecution = true
            };

            ReportFormat = reportFormat;
            _filename = filename;

            _viewerParameters.ProcessingMode = mode;
            if (mode == ProcessingMode.Local && localReportDataSources != null)
            {
                _viewerParameters.LocalReportDataSources = localReportDataSources;
            }

            _viewerParameters.ReportPath = reportPath;
            _viewerParameters.ReportServerUrl = reportServerUrl ?? _viewerParameters.ReportServerUrl;
            if (username != null || password != null)
            {
                _viewerParameters.Username = username;
                _viewerParameters.Password = password;
            }

            ParseParameters(reportParameters);
        }
        private void AddChunkToCache(JobChunkUid chunkUid, ProcessingMode mode)
        {
            var chunkKey = GetJobChunkKey(chunkUid, mode);
            var chunkStatus = new JobChunkStatus()
            {
                LastUpdate = DateTime.Now,
                Status = mode == ProcessingMode.Map ? ChunkStatus.NewMap : ChunkStatus.NewReduce
            };
            
            chunkStatus.ChunkUid.JobId = chunkUid.JobId;
            chunkStatus.ChunkUid.ChunkId = chunkUid.ChunkId;

            AzureClient.Instance.CacheClient.Add(chunkKey, chunkStatus);
        }
Beispiel #48
0
 private void Add(string[] names, ProcessingMode mode, params Attribute[] attributes)
 {
     Element result = new Element(names, mode, attributes);
     Add(result);
 }
Beispiel #49
0
 public DuplicateFilter(string fieldName, KeepMode keepMode, ProcessingMode processingMode)
 {
     this.fieldName = fieldName;
     this.keepMode = keepMode;
     this.processingMode = processingMode;
 }
 private string GetJobChunkKey(JobChunkUid chunkUid, ProcessingMode mode)
 {
     return string.Format("{3}_{0}{1}_{2}", JobChunkKeyPrefix, chunkUid.JobId, chunkUid.ChunkId, mode);
 }
 private void UpdateChunkStatusInCache(JobChunkUid chunkUid, ChunkStatus status, ProcessingMode mode)
 {
     var chunkKey = GetJobChunkKey(chunkUid, mode);
     var chunkStatus = AzureClient.Instance.CacheClient.Get(chunkKey) as JobChunkStatus;
     if (chunkStatus == null)
         throw new UnknownChunkException("Unrestered chunk") { ChunkUid = chunkUid };
     
     chunkStatus.Status = status;
     chunkStatus.LastUpdate = DateTime.Now;
     AzureClient.Instance.CacheClient.Add(chunkKey, chunkStatus);
 }
 public static string GetString(ProcessingMode mode)
 {
     string ret = "";
     switch (mode)
     {
         case ProcessingMode.Activity:
             ret = "appointment_only";
             break;
         case ProcessingMode.Inventory:
             ret = "inventory_only";
             break;
         default:
             break;
     }
     return ret;
 }
Beispiel #53
0
 private void Add(string names, ProcessingMode mode)
 {
     Add(names.Split('/'), mode, new Attribute[0]);
 }
        private bool AllJobChunksCompleted(string jobId, ProcessingMode mode)
        {
            Logger.Log.Instance.Info(string.Format("CacheJobChunkRegistrator. Check for competion of phase {1}. JobId '{0}'",
                        jobId, mode));

            var sumKey = GetJobSummeryKey(jobId);
            var jobSplitDetails = AzureClient.Instance.CacheClient[sumKey] as JobSplitDetails;
            var completedStatus = mode == ProcessingMode.Map ? ChunkStatus.MapCompleted : ChunkStatus.ReduceCompleted;
            foreach (var chunkId in jobSplitDetails.JobChunkIds)
            {
                var chunkKey = GetJobChunkKey(new JobChunkUid() { JobId = jobId, ChunkId = chunkId }, mode);
                var chunkStatus = AzureClient.Instance.CacheClient[chunkKey] as JobChunkStatus;
                Logger.Log.Instance.Info(string.Format("   ==> Chunk {0}. Status: {1}",
                            chunkId, chunkStatus.Status));
                if (chunkStatus.Status != completedStatus)
                {
                    Logger.Log.Instance.Info(string.Format("     ==> Not completed yet"));
                    return false;
                }
            }
            Logger.Log.Instance.Info(string.Format("   ==> Phase completed. Clear cache"));

            // Clear cache
            foreach (var chunkId in jobSplitDetails.JobChunkIds)
            {
                var chunkKey = GetJobChunkKey(new JobChunkUid() { JobId = jobId, ChunkId = chunkId }, mode);
                AzureClient.Instance.CacheClient.Remove(chunkKey);
                Logger.Log.Instance.Info(string.Format("     ==> Clear cache for chunk {0}", chunkId));
            }

            AzureClient.Instance.CacheClient.Remove(sumKey);
            Logger.Log.Instance.Info(string.Format("     ==> Clear cache for sum of job {0}", jobId));

            return true;
        }
 /// <summary>
 /// Sets ReportViewer report processing mode.
 /// </summary>
 /// <param name="mode">Processing Mode (Local or Remote).</param>
 /// <returns>An instance of MvcViewerOptions class.</returns>
 public IMvcReportViewerOptions ProcessingMode(ProcessingMode mode)
 {
     _processingMode = mode;
     return this;
 }
Beispiel #56
0
 //--- Constructors ---
 public Element(string[] names, ProcessingMode mode, params Attribute[] attributes)
 {
     if(ArrayUtil.IsNullOrEmpty(names)) {
         throw new ArgumentNullException("names");
     }
     this.Names = names;
     this.Mode = mode;
     foreach(Attribute attribute in attributes) {
         this.Attributes[attribute.Name] = attribute;
     }
 }
Beispiel #57
0
 public void SetMode(ProcessingMode mode)
 {
     Camera.SetMode(mode);
     Browsers.Toast($"Changing mode to {mode}");
 }
        /// <summary>
        /// Creates an instance of MvcReportViewerIframe class.
        /// </summary>
        /// <param name="reportPath">The path to the report on the server.</param>
        /// <param name="reportServerUrl">The URL for the report server.</param>
        /// <param name="username">The report server username.</param>
        /// <param name="password">The report server password.</param>
        /// <param name="reportParameters">The report parameter properties for the report.</param>
        /// <param name="controlSettings">The Report Viewer control's UI settings.</param>
        /// <param name="htmlAttributes">An object that contains the HTML attributes to set for the element.</param>
        /// <param name="method">Method for sending parameters to the iframe, either GET or POST.</param>
        public MvcReportViewerIframe(
            IReportLoader reportLoader,
            IDictionary<string, object> reportParameters,
            ControlSettings controlSettings,
            IDictionary<string, object> htmlAttributes,
            FormMethod method)
        {
            var javaScriptApi = ConfigurationManager.AppSettings[WebConfigSettings.JavaScriptApi];
            if (string.IsNullOrEmpty(javaScriptApi))
            {
                throw new MvcReportViewerException("MvcReportViewer.js location is not found. Make sure you have MvcReportViewer.AspxViewerJavaScript in your Web.config.");
            }

            _reportLoader = reportLoader;

            _processingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;

            _controlSettings = controlSettings;
            _reportParameters = reportParameters != null ? reportParameters.ToList() : null;
            _htmlAttributes = htmlAttributes;
            _method = method;
            _aspxViewer = ConfigurationManager.AppSettings[WebConfigSettings.AspxViewer];
            if (string.IsNullOrEmpty(_aspxViewer))
            {
                throw new MvcReportViewerException("ASP.NET Web Forms viewer is not set. Make sure you have MvcReportViewer.AspxViewer in your Web.config.");
            }

            _aspxViewer = _aspxViewer.Trim();
            if (_aspxViewer.StartsWith("~"))
            {
                _aspxViewer = VirtualPathUtility.ToAbsolute(_aspxViewer);
            }

            var encryptParametesConfig = ConfigurationManager.AppSettings[WebConfigSettings.EncryptParameters];
            if (!bool.TryParse(encryptParametesConfig, out _encryptParameters))
            {
                _encryptParameters = false;
            }

            ControlId = Guid.NewGuid();
        }