Inheritance: MonoBehaviour
Example #1
0
        AgentService()
        {
            var xPos = NSScreen.MainScreen.Frame.Width / 2;
            var yPos = NSScreen.MainScreen.Frame.Height / 2;

            agentView = new AgentView();

            SetAgent(PropertySettings.AgentSelected ?? "clippy", false);

            window = new NSWindow(new CGRect(xPos, yPos, 100, 100), NSWindowStyle.Borderless, NSBackingStore.Buffered, false)
            {
                Title           = "ClippySharp",
                IsOpaque        = false,
                BackgroundColor = NSColor.FromRgba(red: 1, green: 1, blue: 1f, alpha: 0)
            };
            window.Level = NSWindowLevel.ModalPanel;
            window.MovableByWindowBackground = true;
            window.ContentView = agentView;

            window.IsVisible = true;

            Ide.MessageService.PlaceDialog(window, Ide.MessageService.RootWindow);

            IdeApp.Workbench.RootWindow.Hidden += RootWindow_Hidden;

            IdeApp.Workbench.RootWindow.Shown += RootWindow_Shown;

            IdeApp.ProjectOperations.StartClean += ProjectOperations_StartClean;
            IdeApp.ProjectOperations.EndBuild   += ProjectOperations_EndBuild;
            IdeApp.ProjectOperations.EndClean   += ProjectOperations_Finished;
            IdeApp.ProjectOperations.StartBuild += ProjectOperations_StartBuild;
        }
        private void btnAgent_Click(object sender, RoutedEventArgs e)
        {
            AgentView win = new AgentView();

            win.Height = 300;
            win.Width  = 600;
            win.ShowDialog();
        }
Example #3
0
        /// <summary>
        /// 跳转修改代理商
        /// 负责人:谢海荣
        /// </summary>
        /// <param name="model">修改model实例</param>
        /// <returns></returns>
        public ActionResult Edit(AgentView model)
        {
            ChannelGroupBll      chn       = new ChannelGroupBll();
            IList <ChannelGroup> modelList = chn.getList(LoginUser.UserBasic.EnterpriseID);

            ViewBag.ChannelGroupID = new SelectList(modelList, "ID", "GroupName");
            return(View(model));
        }
Example #4
0
        //EmptyTrash
        //Searching
        //Save
        public void Dispose()
        {
            Agent.Play("GoodBye");

            IdeApp.ProjectOperations.StartBuild += ProjectOperations_StartBuild;

            Agent.Dispose();
            window    = null;
            agentView = null;
        }
Example #5
0
        static void Main(string[] args)
        {
            NSApplication.Init();
            NSApplication.SharedApplication.ActivationPolicy = NSApplicationActivationPolicy.Regular;

            AgentEnvirontment.Current.Initialize(new AgentDelegate(), new SoundPlayer());

            var xPos = NSScreen.MainScreen.Frame.Width / 2;
            var yPos = NSScreen.MainScreen.Frame.Height / 2;

            var mainWindow = new NSWindow(new CGRect(xPos, yPos, 200, 150), NSWindowStyle.Borderless, NSBackingStore.Buffered, false)
            {
                Title = "ClippySharp",

                IsOpaque        = false,
                BackgroundColor = NSColor.FromRgba(red: 1, green: 1, blue: 1f, alpha: 0.5f)
            };

            mainWindow.MovableByWindowBackground = true;

            var stackView = new NSStackView()
            {
                Orientation  = NSUserInterfaceLayoutOrientation.Vertical,
                Distribution = NSStackViewDistribution.Fill
            };

            mainWindow.ContentView = stackView;

            agentPopupButton = new NSPopUpButton();
            stackView.AddArrangedSubview(agentPopupButton);

            foreach (var item in AgentEnvirontment.Current.GetAgents())
            {
                agentPopupButton.AddItem(item);
            }

            animationPopupButton = new NSPopUpButton();
            stackView.AddArrangedSubview(animationPopupButton);

            agentView = new AgentView();
            stackView.AddArrangedSubview(agentView);

            agentPopupButton.Activated += AgentPopupButton_Activated;

            animationPopupButton.Activated += AnimationPopupButton_Activated;

            AgentPopupButton_Activated(null, null);

            mainWindow.MakeKeyAndOrderFront(null);
            NSApplication.SharedApplication.ActivateIgnoringOtherApps(true);
            NSApplication.SharedApplication.Run();
        }
Example #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="objLiveChatInfo"></param>
        /// <param name="objAgentView"></param>
        /// <param name="sendToVisitor"></param>
        /// <param name="sendToAgent"></param>
        private void AgentHasJoin(LiveChatInfo objLiveChatInfo, AgentView objAgentView, bool sendToVisitor, bool sendToAgent)
        {
            var agent = new LiveChatAgentViewModel()
            {
                AgentID     = objAgentView.AgentID,
                UserID      = objAgentView.UserID,
                DisplayName = objAgentView.DisplayName,
                Email       = objAgentView.Email,
                Avatar      = DotNetNuke.Common.Globals.ResolveUrl("~/dnnimagehandler.ashx?mode=profilepic&userid=" + objAgentView.UserID),
                IsOnline    = VisitorsOnlineApi.Instance.IsVisitorOnline(objLiveChatInfo.PortalID, objAgentView.UserID),
                JoinDate    = DateTime.Now
            };

            LiveChatAgentManager.Instance.AddLiveChatAgent(new LiveChatAgentInfo()
            {
                AgentID = agent.AgentID, UserID = agent.UserID, LiveChatID = objLiveChatInfo.LiveChatID, JoinDate = DateTime.Now
            });

            var objLiveChatMessageInfo = new LiveChatMessageInfo()
            {
                LiveChatID  = objLiveChatInfo.LiveChatID,
                SentBy      = MessageSentBy.System,
                CreateDate  = DateTime.Now,
                MessageType = MessageType.Text,
                Message     = objAgentView.DisplayName + " join chat"
            };
            int messageID = LiveChatMessageManager.Instance.AddMessage(objLiveChatMessageInfo);

            objLiveChatMessageInfo.MessageID = messageID;

            if (sendToVisitor)
            {
                Clients.Group(objLiveChatInfo.PortalID + "-" + objLiveChatInfo.VisitorGUID).agentHasJoin(objLiveChatInfo.LiveChatID, agent);
                Clients.Group(objLiveChatInfo.PortalID + "-" + objLiveChatInfo.VisitorGUID).reciveMessage(objLiveChatMessageInfo);
            }

            if (sendToAgent)
            {
                foreach (var item in LiveChatAgentManager.Instance.GetLiveChatAgents(objLiveChatInfo.LiveChatID))
                {
                    Clients.Group(AgentGroupName + item.UserID).agentHasJoin(objLiveChatInfo.LiveChatID, agent);
                    Clients.Group(AgentGroupName + item.UserID).reciveMessage(objLiveChatMessageInfo);
                }
            }
        }
Example #7
0
        public MainPage()
        {
            InitializeComponent();
            var soundPlayer   = DependencyService.Get <ISoundPlayer> ();
            var agentDelegate = DependencyService.Get <IAgentDelegate> ();

            AgentEnvirontment.Current.Initialize(agentDelegate, soundPlayer);

            var agentView = new AgentView();

            agentView.WidthRequest  = 200;
            agentView.HeightRequest = 200;

            var agent = new Agent("clippy");

            agentView.ConfigureAgent(agent);

            agent.Animate();

            container.Children.Add(agentView);
        }
Example #8
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            AgentEnvirontment.Current.Initialize(new AgentDelegate(), new SoundPlayer());

            // Perform any additional setup after loading the view, typically from a nib.

            var container = View;

            var screen = UIScreen.Screens[0].Bounds;

            segmentedControl = new UISegmentedControl(AgentEnvirontment.Current.GetAgents());
            View.AddSubview(segmentedControl);
            segmentedControl.Frame = new CoreGraphics.CGRect(0, 0, screen.Width, 50);

            pickerView = new UIPickerView(new CoreGraphics.CGRect(0, 53, screen.Width, 200));
            View.AddSubview(pickerView);

            var size = 140;

            var positionX = (screen.Width / 2) - (size / 2);
            var positionY = 260;              //(screen.Height / 2) - (size / 2);

            agentView = new AgentView(new CoreGraphics.CGRect(positionX, positionY, size, size));
            View.AddSubview(agentView);

            agentView.TapPressed += (sender, e) => {
                ((AgentView)sender).Agent.Animate();
            };

            segmentedControl.ValueChanged += (sender, e) => {
                ItemChanged();
            };

            segmentedControl.SelectedSegment = 0;
            ItemChanged();
        }
Example #9
0
 /// <summary>
 /// 跳转修改代理商
 /// 负责人:谢海荣
 /// </summary>
 /// <param name="model">修改model实例</param>
 /// <returns></returns>
 public ActionResult Edit(AgentView model)
 {
     ChannelGroupBll chn = new ChannelGroupBll();
     IList<ChannelGroup> modelList = chn.getList(LoginUser.UserBasic.EnterpriseID);
     ViewBag.ChannelGroupID = new SelectList(modelList, "ID", "GroupName");
     return View(model);
 }
Example #10
0
        public async Task <ActionResult> Manage([Bind(Include = "AgentId,RealName,ContactName,AgencyName,PhoneNo,Email,Address,State,PAN,GST,RCbook,BkAccNo,BkName,BkIFSC,BkAddress,CreditAmt")] AgentView model)
        {
            using (var transaction = db.GetTransaction())
            {
                try
                {
                    if (model.AgentId?.Length > 0)
                    {
                        db.Execute($"Update AspNetUsers Set RealName='{model.RealName}' Where Id='{model.AgentId}'");
                        db.Update(new Agent
                        {
                            Address     = model.Address,
                            State       = model.State,
                            AgentId     = model.AgentId,
                            BkAccNo     = model.BkAccNo,
                            BkAddress   = model.BkAddress,
                            BkIFSC      = model.BkIFSC,
                            BkName      = model.BkName,
                            ContactName = model.ContactName,
                            Email       = model.Email,
                            GST         = model.GST,
                            PAN         = model.PAN,
                            PhoneNo     = model.PhoneNo,
                            RCbook      = model.RCbook,
                            CreditAmt   = model.CreditAmt
                        });
                    }
                    else
                    {
                        var user = new ApplicationUser {
                            UserName = model.Email, Email = model.Email
                        };

                        var result = await UserManager.CreateAsync(user, "Agent1Pwd!");

                        if (result.Succeeded)
                        {
                            db.Execute($"Update AspNetUsers Set UserType='{(int)UserTypeEnum.Agent}' , RealName='{model.RealName}' Where Id='{user.Id}'");
                            db.Insert(new Agent
                            {
                                Address     = model.Address,
                                State       = model.State,
                                AgentId     = user.Id,
                                BkAccNo     = model.BkAccNo,
                                BkAddress   = model.BkAddress,
                                BkIFSC      = model.BkIFSC,
                                BkName      = model.BkName,
                                ContactName = model.ContactName,
                                Email       = model.Email,
                                GST         = model.GST,
                                PAN         = model.PAN,
                                PhoneNo     = model.PhoneNo,
                                RCbook      = model.RCbook,
                                CreditAmt   = model.CreditAmt
                            });
                            var item = new AgentDiscount {
                                UserID = user.Id
                            };
                            db.Insert(item);
                        }
                    }
                    transaction.Complete();
                }
                catch (Exception e)
                {
                    transaction.Dispose();
                    throw e;
                }
            }
            return(RedirectToAction("Index", "Agent"));
        }
Example #11
0
        //float plustheta = 0;//無駄コード
        public void calcAgentViews()
        {
            //エージェント数からレイヤー数を決めるべき

            //ノードの数
            int N = Environment.Network.Nodes.Count();

            int layerNum = (int)Math.Ceiling((double)N/90);//層の分割数

            //画面幅
            int ActualWidth = this.ClientSize.Width;
            int ActualHeight = this.ClientSize.Height;
            //小さい方 = 使うサイズ
            int ActualSize = Math.Min(ActualWidth, ActualHeight);

            //View
            agentViews = new Dictionary<AgentIO, AgentView>();

            //レイヤーにどう割り振るかの配列

            var divideArray = Enumerable.Range(1, layerNum);// 1, 2, 3, 4=layerNum
            var cumDivideArray = cum(divideArray);// 1, 3, 6, 10=divideNum

            int divideNum = divideArray.Sum();// 1+2+3+4

            //それぞれのレイヤーの数
            int[] Ns = new int[layerNum];
            for (int i = 0; i < layerNum; i++)
            {
                Ns[i] = (int)(Math.Ceiling( (float)N * (layerNum - i) / divideNum));//layerNum=4 = divideArray.Last
            }

            //エージェントを均等に配置したときの角度
            float[] dthetas = new float[layerNum];
            for (int i = 0; i < layerNum; i++)
            {
                dthetas[i] = (float)1 / Ns[i] * 2*  (float)Math.PI;//小
            }

            //集団の丸
            float R = (float)ActualSize / 2F * 0.95F;
            float R2 = R/2;

            //エージェントの半径
            float r = dthetas[0] * R / 4;//
            float w = r / 4;

            float[] thetas = new float[layerNum];

            int agent_i = 0;
            foreach (AgentIO agent in Environment.Network.Nodes)
            {
                IAATBasedAgent aat = agent.Algorithm as IAATBasedAgent;
                float theta = 0;

                float newR = R;

                //どう移動するか、図的には決まってるのでアルゴリズム的に考えなくては。
                //まずは、divideNumで%する。出てきた数字を4444333221となめていく。
                //変数使わずにできるか?

                int mod = agent_i++ % divideNum;
                mod += 1;

                for (int i = 0; i < layerNum; i++)
                {
                    if (mod <= cumDivideArray.ElementAt(i)){
                        newR *= (i + 1f)/layerNum;
                        thetas[layerNum - 1 - i] += dthetas[layerNum - 1 - i];
                        theta = thetas[layerNum - 1 - i];
                        break;
                    }
                }

                float x = (float)Math.Sin(theta) * newR + ActualWidth / 2;
                float y = (float)Math.Cos(theta) * newR + ActualHeight / 2;

                agentViews[agent] = new AgentView(x, y, r, w);

            }
        }
Example #12
0
        //float plustheta = 0;//無駄コード
        public void calcAgentViews()
        {
            //エージェント数からレイヤー数を決めるべき

            //ノードの数
            int N = Environment.Network.Nodes.Count();

            int layerNum = (int)Math.Ceiling((double)N / 90);//層の分割数

            //画面幅
            int ActualWidth  = this.ClientSize.Width;
            int ActualHeight = this.ClientSize.Height;
            //小さい方 = 使うサイズ
            int ActualSize = Math.Min(ActualWidth, ActualHeight);

            //View
            agentViews = new Dictionary <AgentIO, AgentView>();



            //レイヤーにどう割り振るかの配列

            var divideArray    = Enumerable.Range(1, layerNum); // 1, 2, 3, 4=layerNum
            var cumDivideArray = cum(divideArray);              // 1, 3, 6, 10=divideNum

            int divideNum = divideArray.Sum();                  // 1+2+3+4


            //それぞれのレイヤーの数
            int[] Ns = new int[layerNum];
            for (int i = 0; i < layerNum; i++)
            {
                Ns[i] = (int)(Math.Ceiling((float)N * (layerNum - i) / divideNum)); //layerNum=4 = divideArray.Last
            }

            //エージェントを均等に配置したときの角度
            float[] dthetas = new float[layerNum];
            for (int i = 0; i < layerNum; i++)
            {
                dthetas[i] = (float)1 / Ns[i] * 2 * (float)Math.PI;//小
            }

            //集団の丸
            float R  = (float)ActualSize / 2F * 0.95F;
            float R2 = R / 2;

            //エージェントの半径
            float r = dthetas[0] * R / 4;//
            float w = r / 4;


            float[] thetas = new float[layerNum];

            int agent_i = 0;

            foreach (AgentIO agent in Environment.Network.Nodes)
            {
                IAATBasedAgent aat   = agent.Algorithm as IAATBasedAgent;
                float          theta = 0;

                float newR = R;

                //どう移動するか、図的には決まってるのでアルゴリズム的に考えなくては。
                //まずは、divideNumで%する。出てきた数字を4444333221となめていく。
                //変数使わずにできるか?

                int mod = agent_i++ % divideNum;
                mod += 1;

                for (int i = 0; i < layerNum; i++)
                {
                    if (mod <= cumDivideArray.ElementAt(i))
                    {
                        newR *= (i + 1f) / layerNum;
                        thetas[layerNum - 1 - i] += dthetas[layerNum - 1 - i];
                        theta = thetas[layerNum - 1 - i];
                        break;
                    }
                }

                float x = (float)Math.Sin(theta) * newR + ActualWidth / 2;
                float y = (float)Math.Cos(theta) * newR + ActualHeight / 2;

                agentViews[agent] = new AgentView(x, y, r, w);
            }
        }