Ejemplo n.º 1
0
        protected override MyImageD GetImageDInternal()
        {
            MyImageD imgd   = new MyImageD(imgd_provider.GetImageD());
            var      points = points_provider.GetPoints();

            LogPanel.Log($"[PlotPoints] {points.Count} points.");
            if (points.Count > 0)
            {
                MyImageD cross_img = new MyImageD(new double[imgd.data.Length], imgd);
                double
                    mn = points.Min(p => p.importance),
                    mx = points.Max(p => p.importance);
                foreach (var p in points.Reverse <ImagePoint>())
                {
                    Utils.GetHeatColor((p.importance - mn) / (mx - mn), out double r, out double g, out double b);
                    plot_cross(cross_img, p.x, p.y, r, g, b);
                }
                Parallel.For(0, imgd.height, i =>
                {
                    for (int j = 0; j < imgd.width; j++)
                    {
                        int k            = i * imgd.stride + j * 4;
                        double ratio     = cross_img.data[k + 3];
                        imgd.data[k + 0] = (1 - ratio) * imgd.data[k + 0] + cross_img.data[k + 0];
                        imgd.data[k + 1] = (1 - ratio) * imgd.data[k + 1] + cross_img.data[k + 1];
                        imgd.data[k + 2] = (1 - ratio) * imgd.data[k + 2] + cross_img.data[k + 2];
                    }
                });
            }
            return(imgd);
        }
Ejemplo n.º 2
0
 void Step4CheckVersion(string updatedFileName)
 {
     if (CancelUpdate)
     {
         return;
     }
     if (CheckVersionCheckBox.Checked)
     {
         var processFi      = System.Diagnostics.FileVersionInfo.GetVersionInfo(processFileName);
         var updatedFi      = System.Diagnostics.FileVersionInfo.GetVersionInfo(updatedFileName);
         var processVersion = new Version(processFi.FileVersion);
         var updatedVersion = new Version(updatedFi.FileVersion);
         LogPanel.Add("Current version: {0}", processVersion);
         LogPanel.Add("Updated version: {0}", updatedVersion);
         if (processVersion == updatedVersion)
         {
             LogPanel.Add("Versions are the same. Skip Update");
             return;
         }
         if (processVersion > updatedVersion)
         {
             LogPanel.Add("Remote version is older. Skip Update.");
             return;
         }
     }
     Step5ReplaceFiles(updatedFileName);
 }
Ejemplo n.º 3
0
        void Step6Restart(string fileName)
        {
            var process = System.Diagnostics.Process.GetCurrentProcess();

            CurrentLogItem = LogPanel.Add("Restarting...");
            Application.Restart();
        }
Ejemplo n.º 4
0
        void Step5ReplaceFiles(string updateFileName)
        {
            if (CancelUpdate)
            {
                return;
            }
            // Change the currently running executable so it can be overwritten.
            string bak = processFileName + ".bak";

            CurrentLogItem = LogPanel.Add("Renaming running process...");
            try
            {
                if (System.IO.File.Exists(bak))
                {
                    System.IO.File.Delete(bak);
                }
            }
            catch (Exception ex)
            {
                CurrentLogItem.Message += " Failed: " + ex.Message;
                return;
            }
            System.IO.File.Move(processFileName, bak);
            System.IO.File.Copy(updateFileName, processFileName);
            CurrentLogItem.Message += " Done";
            Step6Restart(processFileName);
        }
Ejemplo n.º 5
0
        private void p_BtnUrgentClicked(object sender, EventArgs e)
        {
            LogPanel logPanel = sender as LogPanel;
            var      log      = db.DepartmentLog.FirstOrDefault(x => x.id == logPanel.id);

            if (MConvert <bool> .ToTypeOrDefault(log.done, false))
            {
                if (BathClass.printAskMsg("事件已完成,加急将会把事件改成未完成状态,确定继续?") != DialogResult.Yes)
                {
                    return;
                }

                log.done = false;
                logPanel.set_btnDone_text("已完成");
            }

            if (!MConvert <bool> .ToTypeOrDefault(log.urgent, false))
            {
                log.urgent     = true;
                log.urgentDate = DateTime.Now;
            }
            else
            {
                log.urgent = false;
            }
            db.SubmitChanges();

            bool done = MConvert <bool> .ToTypeOrDefault(log.done, false);

            bool urgent = MConvert <bool> .ToTypeOrDefault(log.urgent, false);

            logPanel.set_panel_status(done, urgent, log.doneDate, log.urgentDate, log.dueTime);
        }
Ejemplo n.º 6
0
        private void Image_MouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            if (!is_mouse_in)
            {
                return;
            }
            Point mouse_position = e.GetPosition(image);

            mouse_position.X /= image.ActualWidth;
            mouse_position.Y /= image.ActualHeight;
            selected_x        = mouse_position.X * image_width;
            selected_y        = mouse_position.Y * image_height;
            //LogPanel.Log(mouse_position.ToString());
            try
            {
                if (points == null)
                {
                    LogPanel.Log("no points selected.");
                }
                ImagePoint nearest_point = points[0];
                foreach (var p in points)
                {
                    if (Math.Pow(p.x - selected_x, 2) + Math.Pow(p.y - selected_y, 2) < Math.Pow(nearest_point.x - selected_x, 2) + Math.Pow(nearest_point.y - selected_y, 2))
                    {
                        nearest_point = p;
                    }
                }
                selected_x = nearest_point.x;
                selected_y = nearest_point.y;
                LogPanel.Log($"selected: x = {nearest_point.x}, y = {nearest_point.y}, importance = {nearest_point.importance}.");
                PointSelected?.Invoke(nearest_point);
            }
            finally { DrawDashLines(); }
        }
Ejemplo n.º 7
0
        private void button1_Click(object sender, EventArgs e)
        {
            //login
            string HashPass;

            using (MD5 md5Hash = MD5.Create())
            {
                HashPass = GetMd5Hash(md5Hash, txtPass.Text);
            }

            UsersBLL _usersobj = new UsersBLL();

            DataTable dt = _usersobj.LOGIN(textBox1.Text, HashPass);

            if (dt.Rows.Count > 0)
            {
                LogPanel.Hide();

                Guid _G = new Guid(dt.Rows[0]["ID"].ToString());
                LogedIN.Current_USER = _G;

                label1.Text = "Welcome " + dt.Rows[0]["FirstName"];
            }
            else
            {
                label5.Text = "Username or Password is incorrect";
            }
        }
Ejemplo n.º 8
0
 private void Awake()
 {
     Instance   = this;
     displaying = new List <string>();
     timers     = new List <float>();
     text       = GetComponent <TMP_Text>();
     gameObject.SetActive(false);
     deactivated = false;
 }
Ejemplo n.º 9
0
            public static void AddSpring(PlaneImage me, PlaneImage other, double from_x, double from_y, double to_x, double to_y)
            {
                double dx = (to_x - 0.5 * other.image_provider.GetImageD().width) - (from_x - 0.5 * me.image_provider.GetImageD().width);
                double dy = (to_y - 0.5 * other.image_provider.GetImageD().height) - (from_y - 0.5 * me.image_provider.GetImageD().height);

                LogPanel.Log($"dx={dx}, dy={dy}");
                me.springs.Add(new Spring(me, other, -dx, -dy));
                other.springs.Add(new Spring(other, me, dx, dy));
            }
Ejemplo n.º 10
0
 private void FailWithLog()
 {
     // If the tab hasn't been initialized, yet, make sure we show at least the log.
     if (controlPanel == null)
     {
         var logPanel = new LogPanel(_container);
         logPanel.Dock = DockStyle.Fill;
         tabPage.Controls.Add(logPanel);
     }
 }
Ejemplo n.º 11
0
    private void Awake()
    {
        panelList = new List <DebugBasePanel>();

        panelRect = this.transform.Find("Panel").GetComponent <RectTransform>();

        contentPanel = this.transform.Find("Panel/Content").gameObject;
        togglePanel  = this.transform.Find("Panel/TogglePanel").gameObject;

        logPanel     = new LogPanel(this.transform.Find("Panel/Content/LogPanel").gameObject, this);
        commandPanel = new CommandPanel(this.transform.Find("Panel/Content/CommandPanel").gameObject, this);
        netPanel     = new NetPanel(this.transform.Find("Panel/Content/NetPanel").gameObject, this);


        panelList.Add(logPanel);
        panelList.Add(commandPanel);
        panelList.Add(netPanel);



        for (int i = 1; i <= 3; i++)
        {
            var btnObj = this.transform.Find("Panel/TogglePanel/Toggle" + i);
            if (btnObj)
            {
                int index = i;
                btnObj.GetComponent <Button>().onClick.AddListener(() =>
                {
                    this.curSelect = index;
                    HideAllPanels();
                    ShowPanel(index);
                });
            }
        }


        btnClick = this.transform.Find("Panel/Button").GetComponent <Button>();
        btnClick.onClick.AddListener(() =>
        {
            if (isHide)
            {
                ShowWindow();
            }
            else
            {
                HideWindow();
            }
        });


        txtArrow = btnClick.gameObject.transform.Find("Text").GetComponent <Text>();

        HideWindow();
    }
Ejemplo n.º 12
0
        void Step6Restart()
        {
            if (CancelUpdate)
            {
                return;
            }
            var process = System.Diagnostics.Process.GetCurrentProcess();

            CurrentLogItem = LogPanel.Add("Restarting...");
            System.Windows.Forms.Application.Restart();
        }
Ejemplo n.º 13
0
        public void TestGetMd5Hash()
        {
            MD5    hash = MD5.Create();
            string pass = "******";

            string result = LogPanel.GetMd5Hash(hash, pass);

            string Expected = "ed076287532e86365e841e92bfc50d8c";

            Assert.AreEqual(Expected, result, "nie sa rowne");
        }
Ejemplo n.º 14
0
        void AddLog(string str)
        {
            Label l = new Label();

            l.Location = new Point(6, 4 + 12 * LogPanel.Controls.Count);
            l.AutoSize = true;
            l.Name     = "L" + LogPanel.Controls.Count;
            l.Size     = new System.Drawing.Size(0, 12);
            l.TabIndex = 0;
            l.Text     = str;
            LogPanel.Controls.Add(l);
            LogPanel.ScrollControlIntoView(l);
        }
Ejemplo n.º 15
0
        public void TestVerifyMd5Hash()
        {
            MD5    md5Hash = MD5.Create();
            string pass    = "******";

            string hash = LogPanel.GetMd5Hash(md5Hash, pass);

            bool result = LogPanel.VerifyMd5Hash(md5Hash, pass, hash);

            bool Expected = true;

            Assert.AreEqual(Expected, result, "nie sa rowne");
        }
Ejemplo n.º 16
0
    private static void Log2UI(string text)
    {
        if (logPanel == null)
        {
            logPanel = MyGUIManager.GetInstance().GetOrCreatePanel <LogPanel>();
        }
        if (!logPanel.IsVisible)
        {
            logPanel.Display(true);
        }

        logPanel.UpdatePanel(text);
    }
Ejemplo n.º 17
0
        private async Task OpenFiles(String[] paths)
        {
            logTabs.Visible = true;
            foreach (var filename in paths)
            {
                /*if log already watched select relative tab*/

                FileInfo file = new FileInfo(filename);

                var values             = fullPathTabAssociation.Where(x => x.Key == file.FullName);
                int indexOfExistingTab = (!values.Any()) ? -1 : values.FirstOrDefault().Value;

                if (indexOfExistingTab != -1)
                {
                    logTabs.SelectedIndex = indexOfExistingTab;
                    return;
                }

                /*else it creates it and associates the fullName with tab index, for uniqueness*/
                fullPathTabAssociation.Add(file.FullName, logTabs.TabCount);
                LogPanel logPanel = null;
                try
                {
                    logTabs.TabPages.Add(new TabPage(file.Name));
                    logTabs.SelectedIndex = logTabs.TabCount - 1;

                    logPanel = new LogPanel(file.FullName);

                    logTabs.SelectedTab.Controls.Add(logPanel);
                }
                catch (Exception ex)
                {
                    fullPathTabAssociation.Remove(file.FullName);

                    MessageBox.Show(ex.Message);

                    if (logTabs.TabCount == 0)
                    {
                        logTabs.Visible = false;
                    }

                    return;
                }

                /*read the file in the specified direction*/
                await logPanel.LoadAsync();
            }
        }
Ejemplo n.º 18
0
        public void Step2ProcessUpdateResults(CloudMessage results)
        {
            var url = results.Values.GetValue <string>(CloudKey.UpdateUrl);

            if (string.IsNullOrEmpty(url))
            {
                CurrentLogItem.Message += " No new updates.";
                return;
            }
            CurrentLogItem.Message += " Update URL retrieved.";
            LogPanel.Add("{0}", url);
            CurrentLogItem        = LogPanel.Add("Download...");
            _downloader           = new Downloader();
            _downloader.Progress += _downloader_Progress;
            _downloader.LoadAsync(url);
        }
Ejemplo n.º 19
0
        protected override List <ImagePoint> GetPointsInternal()
        {
            List <ImagePoint <T> > ans = new List <ImagePoint <T> >();
            double        scale        = 1;
            StringBuilder sb           = new StringBuilder();

            for (int i = 0; i < points_providers.Count; i++, scale *= scale_factor)
            {
                var points = points_providers[i].GetPoints().Cast <ImagePoint <T> >()
                             .Select(p => new ImagePoint <T>(p.x / scale, p.y / scale, p.importance, p.content));
                sb.AppendLine($"{points.Count()} points from scale {scale}");
                ans.AddRange(points);
            }
            LogPanel.Log(sb.ToString());
            return(ans.Cast <ImagePoint>().ToList());
        }
Ejemplo n.º 20
0
 void Step3CheckSignature(string updateFileName)
 {
     if (CheckDigitalSignatureCheckBox.Checked)
     {
         CurrentLogItem = LogPanel.Add("Check Digital Signature...");
         X509Certificate2 certificate;
         Exception        error;
         if (!CertificateHelper.IsSignedAndTrusted(updateFileName, out certificate, out error))
         {
             var errMessage = error == null
                 ? " Failed" : string.Format(" Failed: {0}", error.Message);
             CurrentLogItem.Message += errMessage;
             return;
         }
     }
     Step4CheckVersion(updateFileName);
 }
Ejemplo n.º 21
0
    void Start()
    {
        this.returnBuffer = new List <Fighter>();

        this.fighters = GameObject.FindObjectsOfType <Fighter>();

        this.SortFightersBySpeed();
        this.MakeTeams();

        LogPanel.Write("Battle initiated.");

        this.combatStatus = CombatStatus.NEXT_TURN;

        this.fighterIndex   = -1;
        this.isCombatActive = true;
        StartCoroutine(this.CombatLoop());
    }
Ejemplo n.º 22
0
        void Step1ChekOnline()
        {
            CurrentLogItem = LogPanel.Add("Check Online...");
            var message = new CloudMessage(Engine.CloudAction.CheckUpdates);

            message.Values.Add(CloudKey.ClientVersion, Application.ProductVersion);
            var item = new CloudItem()
            {
                Date    = DateTime.Now,
                Message = message,
                State   = CloudState.None,
                Retries = 4,
            };

            CheckUpateItem = item;
            MainForm.Current.CloudPanel.Add(item);
        }
Ejemplo n.º 23
0
        private void p_BtnSetTimeClicked(object sender, EventArgs e)
        {
            LogPanel logPanel = sender as LogPanel;
            var      log      = db.DepartmentLog.FirstOrDefault(x => x.id == logPanel.id);

            var form = new DaysLimitForm();

            if (form.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            log.dueTime = form.dt;
            db.SubmitChanges();

            logPanel.set_Due_text(log.dueTime);
        }
Ejemplo n.º 24
0
        void Step1ChekOnline()
        {
            CurrentLogItem = LogPanel.Add("Check Online...");
            var message = new CloudMessage(Engine.CloudAction.CheckUpdates);
            var ai      = new JocysCom.ClassLibrary.Configuration.AssemblyInfo();

            message.Values.Add(CloudKey.ClientVersion, ai.Version);
            var item = new CloudItem()
            {
                Date    = DateTime.Now,
                Message = message,
                State   = CloudState.None,
                Retries = 4,
            };

            CheckUpateItem = item;
            Global.CloudClient.TasksTimer.DoActionNow(item);
        }
Ejemplo n.º 25
0
 async void StartSimulation()
 {
     int kase_self = System.Threading.Interlocked.Increment(ref kase);
     await Task.Run(() =>
     {
         List <IPointsProvider> points_providers = source_image_panel.GetImages().Select(i => new ImageD_Providers.ImageD_Cache(i.ToImageD()) as IImageD_Provider).Select(i => new PointsProviders.MSOP_DescriptorVector(new PointsProviders.HarrisCornerDetector(i), new MatrixProviders.GrayScale(i)) as IPointsProvider).ToList();
         List <IImageD_Provider> image_providers = source_image_panel.GetImages().Select((i, idx) => new ImageD_Providers.PlotPoints(new ImageD_Providers.ImageD_Cache(i.ToImageD()), points_providers[idx]) as IImageD_Provider).ToList();
         var provider = new PlaneImages(image_providers, 1000, 600);
         image_container.Dispatcher.Invoke(() => image_container.Content = new ImageViewer(provider, false));
         LogPanel.Log("searching features...");
         provider.GetImageD();
         LogPanel.Log("matching...");
         var points = points_providers.Select(pp => pp.GetPoints().Select(ps => (ps as ImagePoint <PointsProviders.MSOP_DescriptorVector.Descriptor>)).ToList()).ToList();
         for (int i = 0; i < points.Count; i++)
         {
             for (int j = i + 1; j < points.Count; j++)
             {
                 List <ImagePoint <PointsProviders.MSOP_DescriptorVector.Descriptor> > p1s = points[i], p2s = points[j];
                 List <Tuple <double, double, double, double, double> > candidates         = new List <Tuple <double, double, double, double, double> >();
                 foreach (var p1 in p1s)
                 {
                     if (p1.content.try_match(p2s, out ImagePoint p2))
                     {
                         candidates.Add(Tuple.Create(p1.content.difference((p2 as ImagePoint <PointsProviders.MSOP_DescriptorVector.Descriptor>).content), p1.x, p1.y, p2.x, p2.y));
                     }
                 }
                 candidates.Sort((p1, p2) => p1.Item1.CompareTo(p2.Item1));
                 for (int k = 0; k < candidates.Count; k++)
                 {
                     var c = candidates[k];
                     PlaneImage.AddSpring(provider.images[i], provider.images[j], c.Item2, c.Item3, c.Item4, c.Item5);
                 }
             }
         }
         LogPanel.Log("ok");
         while (kase_self == kase)
         {
             provider.update_speed(0.1);
             provider.update_position();
             provider.ResetSelf();
             provider.GetImageD();
         }
     });
 }
Ejemplo n.º 26
0
 public CorrectiveCylinderImages(List <IImageD_Provider> image_providers, int width, int height) : base(
         image_providers,
         //image_providers.Select(i=>new ImageD_Providers.PlotPoints(i, get_features_provider(i)) as IImageD_Provider).ToList(),
         width, height)
 {
     points_providers = image_providers.Select(img => get_features_provider(img)).ToList();
     {
         var    provider = image_providers[0];
         double scale    = 1;
         for (int i = 0; i < 7; i++, scale *= 0.5)
         {
             MyImageD img = provider.GetImageD();
             LogPanel.Log($"scale={scale}, width={img.width}, height={img.height}, stride={img.stride}, avg={img.data.Sum() / img.data.Length}");
             LogPanel.Log(img);
             provider = new ImageD_Providers.GaussianBlur(provider, 1);
             provider = new ImageD_Providers.Scale(provider, 0.5);
         }
     }
 }
            protected override MyImageD GetImageDInternal()
            {
                MyImageD image = new MyMatrix(new double[height, width]).ToGrayImageD();
                double   min_h = cylinder_images.Min(i => (i.displace_y - 0.5 * i.height) / i.focal_length),
                         max_h = cylinder_images.Max(i => (i.displace_y + 0.5 * i.height) / i.focal_length);

                LogPanel.Log($"min_h: {min_h}, max_h: {max_h}");
                System.Threading.Tasks.Parallel.For(0, height, i =>
                {
                    for (int j = 0; j < width; j++)
                    {
                        double r          = 0, g = 0, b = 0;
                        double weight_sum = 0;
                        foreach (var img in cylinder_images)
                        {
                            if (img.sample_pixel(((double)j / width) * 2.0 * Math.PI, (i * max_h + (height - 1 - i) * min_h) / (height - 1), out double _r, out double _g, out double _b, out double distance_to_corner))
                            {
                                r          += distance_to_corner * _r; g += distance_to_corner * _g; b += distance_to_corner * _b;
                                weight_sum += distance_to_corner;
                            }
                        }
Ejemplo n.º 28
0
        private static void Log(object message, LogType logType)
        {
            string log = message?.ToString() ?? "";

            LogPanel.Log(log, logType);

            switch (logType)
            {
            case LogType.Assert:
            case LogType.Log:
                Loader.OnLogMessage(log);
                break;

            case LogType.Warning:
                Loader.OnLogWarning(log);
                break;

            case LogType.Error:
            case LogType.Exception:
                Loader.OnLogError(log);
                break;
            }
        }
Ejemplo n.º 29
0
        private void p_BtnDoneClicked(object sender, EventArgs e)
        {
            LogPanel logPanel = sender as LogPanel;
            var      log      = db.DepartmentLog.FirstOrDefault(x => x.id == logPanel.id);

            if (MConvert <bool> .ToTypeOrDefault(log.done, false))
            {
                log.done = false;
            }
            else
            {
                log.done     = true;
                log.urgent   = false;
                log.doneDate = DateTime.Now;
                logPanel.set_btnUrgent_text("加急");
            }
            db.SubmitChanges();

            bool done = MConvert <bool> .ToTypeOrDefault(log.done, false);

            bool urgent = MConvert <bool> .ToTypeOrDefault(log.urgent, false);

            logPanel.set_panel_status(done, urgent, log.doneDate, log.urgentDate, log.dueTime);
        }
Ejemplo n.º 30
0
 public LogMessageEvent(LogPanel enclosingInstance, MessageEvent event_Renamed)
     : this(enclosingInstance, event_Renamed.Type, event_Renamed.Message, event_Renamed.ChannelId)
 {
     InitBlock(enclosingInstance);
 }
Ejemplo n.º 31
0
 // Use this for initialization
 void Start()
 {
     guilog = GetComponent<LogPanel>();
 }
Ejemplo n.º 32
0
 public AnonymousClassThread(LogPanel enclosingInstance)
 {
     InitBlock(enclosingInstance);
 }
Ejemplo n.º 33
0
 private void InitializeControls()
 {
     //this.Width = 1600;
     //this.Height = 900;
     {
         GDmain = new MyGrid();
         GDmain.RowDefinitions.Add(new RowDefinition {
             Height = new GridLength(1, GridUnitType.Star)
         });
         GDmain.RowDefinitions.Add(new RowDefinition {
             Height = new GridLength(1, GridUnitType.Auto)
         });
         GDmain.RowDefinitions.Add(new RowDefinition {
             Height = new GridLength(1, GridUnitType.Auto)
         });
         GDmain.RowDefinitions.Add(new RowDefinition {
             Height = new GridLength(1, GridUnitType.Auto)
         });
         GDmain.RowDefinitions.Add(new RowDefinition {
             Height = new GridLength(20, GridUnitType.Absolute)
         });
         {
             //EDlog = new MyTextBox();
             EDlog = new LogPanel();
             GDmain.Children.Add(new Frame {
                 OutlineColor = Color.Accent, Padding = new Thickness(5), Content = EDlog
             }, 0, 0);
         }
         {
             GDstatus = new Grid();
             GDstatus.ColumnDefinitions.Add(new ColumnDefinition {
                 Width = new GridLength(1, GridUnitType.Star)
             });
             GDstatus.ColumnDefinitions.Add(new ColumnDefinition {
                 Width = new GridLength(1, GridUnitType.Auto)
             });
             GDstatus.ColumnDefinitions.Add(new ColumnDefinition {
                 Width = new GridLength(1, GridUnitType.Auto)
             });
             //GDstatus.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Auto) });
             int columnNumber = 0;
             {
                 LBstatus = new Label {
                     Text = "Initializing..."
                 };
                 GDstatus.Children.Add(new ScrollView {
                     Orientation = ScrollOrientation.Horizontal, Content = LBstatus
                 }, columnNumber++, 0);
             }
             //{
             //    var lbl = new MyLabel("Auto Scroll") { IsVisible = false, Opacity = 0, FontAttributes = FontAttributes.Bold, VerticalTextAlignment = TextAlignment.Center };
             //    SWautoScroll = new MySwitch("Auto Scroll", "Manual Scroll") { IsToggled = true };
             //    System.Threading.SemaphoreSlim semaphoreSlim = new System.Threading.SemaphoreSlim(1, 1);
             //    bool animationCompletedWith = true;
             //    SWautoScroll.Toggled += async delegate
             //    {
             //        bool backUp = SWautoScroll.IsToggled;
             //        try
             //        {
             //            await semaphoreSlim.WaitAsync();
             //            lbl.Text = (SWautoScroll.IsToggled ? "Auto Scroll" : "Manual Scroll");
             //            if (backUp != SWautoScroll.IsToggled || animationCompletedWith == backUp) return;
             //            lbl.IsVisible = true;
             //            await lbl.FadeTo(1);
             //            await Task.Delay(1000);
             //            await lbl.FadeTo(0);
             //            lbl.IsVisible = false;
             //            animationCompletedWith = backUp;
             //        }
             //        finally
             //        {
             //            lock (semaphoreSlim)semaphoreSlim.Release();
             //        }
             //    };
             //    GDstatus.Children.Add(lbl, columnNumber++, 0);
             //}
             {
                 //SwitchCell SWautoScroll = new SwitchCell();
                 //GDstatus.Children.Add(new TableView {Root=new TableRoot {Content=new TableSection { Content = { SWautoScroll} } } }, 1, 0);
                 //new TableRoot().
                 SWautoScroll = new MySwitch("Auto Scroll", "Manual Scroll")
                 {
                     IsToggled = true
                 };
                 GDstatus.Children.Add(SWautoScroll, columnNumber++, 0);
             }
             {
                 BTNclear = new Button {
                     Text = "Clear"
                 };
                 GDstatus.Children.Add(BTNclear, columnNumber++, 0);
             }
             GDmain.Children.Add(GDstatus, 0, 1);
         }
         this.Content = new UnwipableContentView {
             Content = GDmain
         };
     }
 }
Ejemplo n.º 34
0
 // Use this for initialization
 void Start()
 {
     guilog = GetComponent<LogPanel>();
     myid = System.Guid.NewGuid().ToString ();
 }
Ejemplo n.º 35
0
 private void InitBlock(LogPanel enclosingInstance)
 {
     this.enclosingInstance = enclosingInstance;
 }
Ejemplo n.º 36
0
 private void InitBlock(LogPanel enclosingInstance)
 {
     this.enclosingInstance = enclosingInstance;
     events = new LinkedList();
 }
Ejemplo n.º 37
0
 public LogTableModel(LogPanel enclosingInstance)
 {
     InitBlock(enclosingInstance);
 }
Ejemplo n.º 38
0
 private void InitBlock(LogPanel enclosingInstance)
 {
     this.enclosingInstance = enclosingInstance;
     colorError = System.Drawing.Color.RED;
     colorWarning = System.Drawing.Color.ORANGE;
     colorEvent = System.Drawing.Color.BLUE;
 }
Ejemplo n.º 39
0
 public LogTableCellRenderer(LogPanel enclosingInstance)
 {
     InitBlock(enclosingInstance);
 }
Ejemplo n.º 40
0
        /// <summary> Create a GUI-Instance for Jamocha.
        /// 
        /// </summary>
        /// <param name="">engine
        /// The Jamocha-engine that will be used in the GUI.
        /// 
        /// </param>
        public JamochaGui(Rete engine)
        {
            InitBlock();

            // set up the frame
            //UPGRADE_ISSUE: Constructor 'java.awt.BorderLayout.BorderLayout' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtBorderLayout"'
            this.ContentPane.setLayout(new BorderLayout());
            this.setTitle("Jamocha");
            setSizeAndLocation();

            // show logo
            //UPGRADE_ISSUE: Constructor 'java.awt.BorderLayout.BorderLayout' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtBorderLayout"'
            JPanel logoPanel = new JPanel(new BorderLayout());
            //UPGRADE_ISSUE: Field 'java.awt.BorderLayout.EAST' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtBorderLayout"'
            logoPanel.add(new JLabel(IconLoader.getImageIcon("jamocha")), BorderLayout.EAST);
            //UPGRADE_ISSUE: Field 'java.awt.BorderLayout.NORTH' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtBorderLayout"'
            this.ContentPane.add(logoPanel, BorderLayout.NORTH);

            // create a tabbed pane
            tabbedPane = new JTabbedPane();
            //UPGRADE_ISSUE: Field 'java.awt.BorderLayout.CENTER' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtBorderLayout"'
            this.ContentPane.add(tabbedPane, BorderLayout.CENTER);

            // add MenuBar
            menuBar = new JamochaMenuBar(this);
            this.setJMenuBar(menuBar);

            // create a rete engine
            this.engine = engine;

            // create a shell tab and add it to the tabbed pane
            ShellPanel shellPanel = new ShellPanel(this);
            tabbedPane.addTab("Shell", IconLoader.getImageIcon("application_osx_terminal"), shellPanel, "Jamocha Shell");
            panels.add(shellPanel);
            FactsPanel factsPanel = new FactsPanel(this);
            tabbedPane.addTab("Facts", IconLoader.getImageIcon("database"), factsPanel, "View or modify Facts");
            panels.add(factsPanel);
            TemplatesPanel templatesPanel = new TemplatesPanel(this);
            tabbedPane.addTab("Templates", IconLoader.getImageIcon("brick"), templatesPanel, "View or modify Templates");
            panels.add(templatesPanel);
            FunctionsPanel functionsPanel = new FunctionsPanel(this);
            tabbedPane.addTab("Functions", IconLoader.getImageIcon("cog"), functionsPanel, "View Functions");
            panels.add(functionsPanel);
            RetePanel retePanel = new RetePanel(this);
            tabbedPane.addTab("Rete", IconLoader.getImageIcon("eye"), retePanel, "View the Rete-network");
            panels.add(retePanel);
            LogPanel logPanel = new LogPanel(this);
            tabbedPane.addTab("Log", IconLoader.getImageIcon("monitor"), logPanel, "View alle messages from or to the Rete-engine");
            panels.add(logPanel);
            SettingsPanel settingsPanel = new SettingsPanel(this);
            tabbedPane.addTab("Settings", IconLoader.getImageIcon("wrench"), settingsPanel, "Settings for Jamocha");
            panels.add(settingsPanel);

            // add the tab pane to the frame
            //UPGRADE_ISSUE: Field 'java.awt.BorderLayout.CENTER' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtBorderLayout"'
            this.ContentPane.add(tabbedPane, BorderLayout.CENTER);

            tabbedPane.addChangeListener(this);
            // add a listener to the frame to kill the engine when the GUI is closed
            addWindowListener(new AnonymousClassWindowAdapter(this));
        }
Ejemplo n.º 41
0
            public LogMessageEvent(LogPanel enclosingInstance, int type, System.Object message, System.String channelId)
                : base(type, message, channelId)
            {
                InitBlock(enclosingInstance);
                switch (type)
                {

                    case MessageEvent.ADD_NODE_ERROR:
                        typeFormatted = "ERROR: Error adding node";
                        superType = 3;
                        break;

                    case MessageEvent.ADD_RULE_EVENT:
                        typeFormatted = "EVENT: added Rule";
                        superType = 1;
                        break;

                    case MessageEvent.CLIPSPARSER_ERROR:
                        typeFormatted = "ERROR: Error in CLIPSParser";
                        superType = 3;
                        break;

                    case MessageEvent.CLIPSPARSER_REINIT:
                        typeFormatted = "EVENT: CLIPSParser reinitialized";
                        superType = 1;
                        break;

                    case MessageEvent.CLIPSPARSER_WARNING:
                        typeFormatted = "WARNING: CLIPSParser-Warning";
                        superType = 2;
                        break;

                    case MessageEvent.COMMAND:
                        typeFormatted = "EVENT: incoming Command";
                        superType = 1;
                        break;

                    case MessageEvent.ENGINE:
                        typeFormatted = "EVENT: Engine-Message";
                        superType = 1;
                        break;

                    case MessageEvent.ERROR:
                        typeFormatted = "ERROR: unspecified Error";
                        superType = 3;
                        break;

                    case MessageEvent.FUNCTION_INVALID:
                        typeFormatted = "WARNING: invalid Function";
                        superType = 2;
                        break;

                    case MessageEvent.FUNCTION_NOT_FOUND:
                        typeFormatted = "WARNING: Function not found";
                        superType = 2;
                        break;

                    case MessageEvent.INVALID_RULE:
                        typeFormatted = "WARNING: invalid Rule";
                        superType = 2;
                        break;

                    case MessageEvent.PARSE_ERROR:
                        typeFormatted = "ERROR: Parse-Error";
                        superType = 3;
                        break;

                    case MessageEvent.REMOVE_RULE_EVENT:
                        typeFormatted = "EVENT: Rule removed";
                        superType = 1;
                        break;

                    case MessageEvent.RESULT:
                        typeFormatted = "EVENT: returned result";
                        superType = 1;
                        break;

                    case MessageEvent.RULE_EXISTS:
                        typeFormatted = "EVENT: Rule exists";
                        superType = 1;
                        break;

                    case MessageEvent.TEMPLATE_NOTFOUND:
                        typeFormatted = "WARNING: Template not found";
                        superType = 2;
                        break;

                    default:
                        typeFormatted = "Unknown Messagetype";
                        superType = 1;
                        break;

                }
            }
Ejemplo n.º 42
0
 private void InitBlock(LogPanel enclosingInstance)
 {
     this.enclosingInstance = enclosingInstance;
     datetime = new System.Globalization.GregorianCalendar();
 }
Ejemplo n.º 43
0
 public AnonymousClassJTable(LogPanel enclosingInstance)
 {
     InitBlock(enclosingInstance);
 }
Ejemplo n.º 44
0
 // Use this for initialization
 void Start()
 {
     pathControl = GetComponent<PathFindingController>();
     guilog = GetComponent<LogPanel>();
 }