Exemplo n.º 1
0
 public MainVM()
 {
     Data           = new ContextData();
     CreateTB       = new CreateTypeBiereVM(this);
     EditTB         = new EditTypeBiereVM(this);
     DetailTB       = new DetailTypeBiereVM(this);
     CreateBiere    = new CreateBiereVM(this);
     EditBiere      = new EditBiereVM(this);
     DetailBiere    = new DetailBiereVM(this);
     EditBrasserie  = new EditBrasserieVM(this);
     CreateClient   = new CreateClientVM(this);
     DetailClient   = new DetailClientVM(this);
     CreateCom      = new CreateCommandeVM(this);
     EditCom        = new EditCommandeVM(this);
     DetailCom      = new DetailCommandeVM(this);
     CreateContact  = new CreateContact(this);
     EditContact    = new EditContact(this);
     DetailContact  = new DetailContact(this);
     CreateEmploi   = new CreateEmploi(this);
     EditEmploi     = new EditEmploi(this);
     DetailEmploi   = new DetailEmploi(this);
     CreateEven     = new CreateEvent(this);
     EditEvent      = new EditEvent(this);
     DetailEvent    = new DetailEvent(this);
     CreateHorraire = new CreateHorraire(this);
     EditHorraire   = new EditHorraire(this);
     DetailHorraire = new DetailHorraire(this);
     CreateMessage  = new CreateMessage(this);
     EditMessage    = new EditMessage(this);
     DetailMessage  = new DetailMessage(this);
     CreateRecomp   = new CreateRecompense(this);
     EditRecomp     = new EditRecompense(this);
     DetailRecomp   = new DetailRecompense(this);
 }
Exemplo n.º 2
0
        /// <summary>
        /// Редактировать сообщение
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public async Task <BaseApiResponse> EditMessage(EditMessage model)
        {
            var validation = ValidateModel(model);

            if (!validation.IsSucceeded)
            {
                return(new BaseApiResponse <int>(validation));
            }

            var messageAndValidation = await GetMessageAndValidate(model.Id);

            if (!messageAndValidation.IsSucceeded)
            {
                return(messageAndValidation);
            }

            var message = messageAndValidation.ResponseObject;

            message.Changed = true;
            message.LastUpdateOnUtcTicks = DateTime.UtcNow.Ticks;
            message.Message = model.Message;

            UpdateHandled(message);

            return(await TrySaveChangesAndReturnResultAsync("Сообщение изменено"));
        }
Exemplo n.º 3
0
 /// <summary>
 /// Initialize a new instance of this class with the provided values
 /// </summary>
 /// <param name="hWnd"></param>
 /// <param name="msg"></param>
 /// <param name="wParam"></param>
 /// <param name="lParam"></param>
 public FormEditMessage(IntPtr hWnd, NativeMethods.Msgs msg, IntPtr wParam, IntPtr lParam)
     : this()
 {
     lblHeader.Text = string.Format(CultureInfo.InvariantCulture, lblHeader.Text, hWnd.ToInt32());
     _EditMessage   = new EditMessage(msg, wParam, lParam);
     propertyGrid.SelectedObject = _EditMessage;
     propertyGrid.ExpandAllGridItems();
 }
Exemplo n.º 4
0
 public void OnEditing(EditMessage message)
 {
     if (message.ViewModel == DataContext)
     {
         TextBoxUserName.Focus();
         Keyboard.Focus(TextBoxUserName);
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// takes string contents and column and row number,
        /// converts col and row to a cell value, adds cell
        /// to backing sheet and update gui accordingly
        /// </summary>
        /// <param name="col"></param>
        /// <param name="row"></param>
        /// <param name="contents"></param>
        private void SendEdit(int col, int row, string contents)
        {
            string name = GetCellName(col, row);

            isChanged = sheet.Changed;

            EditMessage newEdit = new EditMessage();

            newEdit.cell = name;
            if (contents.Length > 0 && contents[0] == '=')
            {
                try
                {
                    Formula newFormula = new Formula(contents.Substring(1, contents.Length - 1), s => s.ToUpper(), isValid);
                }
                catch (FormulaFormatException ffe)
                {
                    MessageBox.Show(ffe.Message, "Formula Format Error");
                    string s = ffe.Message;
                }
                string pattern = @"[A-Za-z]{1}[\d]{1,2}";

                ArrayList dependencies = new ArrayList();

                foreach (Match m in Regex.Matches(contents, pattern))
                {
                    dependencies.Add(m.ToString());
                }

                newEdit.dependencies = dependencies;
            }
            else
            {
                double cellDouble;
                if (Double.TryParse(contents, out cellDouble))
                {
                    EditMessageDoubleType actualMessage = new EditMessageDoubleType();
                    actualMessage.value        = cellDouble;
                    actualMessage.dependencies = new ArrayList();
                    actualMessage.cell         = name;
                    controller.SendMessage(actualMessage);
                    return;
                }

                newEdit.dependencies = new ArrayList();
            }
            newEdit.value = contents;

            if (contentsChanged)
            {
                controller.SendMessage(newEdit);
            }

            cellTextBox.Text = cellContentsField.Text;
            contentsChanged  = false;
        }
Exemplo n.º 6
0
        private void EditMessageOnPublished(EditMessage message)
        {
            switch (message)
            {
            case EditMessage.AcceptEdits:
                EndEdit();
                break;

            case EditMessage.CancelEdits:
                CancelEdit();
                break;
            }
        }
Exemplo n.º 7
0
    public MainWindow() : base(Gtk.WindowType.Toplevel)
    {
        Build();
        currentFilePath = "";
        MW   = this;
        egrp = new EditGroup();
        egrp.ShowAll();
        eprj = new EditProject();
        eprj.ShowAll();
        eunt = new EditUnit();
        eunt.ShowAll();
        ecpmd = new EditCompuMethod();
        ecpmd.ShowAll();
        emsg = new EditMessage();
        emsg.ShowAll();
        eprc = new EditProcess();
        eprc.ShowAll();
        etsk = new EditTask();
        etsk.ShowAll();
        esm = new EditStateMachine();
        esm.ShowAll();

        ts = new Gtk.TreeStore(typeof(string));
        this.treeviewGlobal.Model = ts;

        Gtk.TreeViewColumn prjColumn = new Gtk.TreeViewColumn();
        prjColumn.Title = "EasyOS";

        Gtk.CellRendererText projectCell = new Gtk.CellRendererText();
        prjColumn.PackStart(projectCell, true);
        prjColumn.AddAttribute(projectCell, "text", 0);
        treeviewGlobal.AppendColumn(prjColumn);

        treeviewGlobal.Visible    = false;
        this.alignFrmEditor.Child = eprj;
        this.frmEditor.ShowAll();
        this.frmEditor.Visible = false;

        this.addAction.Sensitive      = false;
        this.deleteAction.Sensitive   = false;
        this.generateAction.Sensitive = false;
        this.GenerateAction.Sensitive = false;
        this.saveAction.Sensitive     = false;
        this.SaveAction.Sensitive     = false;
        this.saveAsAction.Sensitive   = false;
        this.SaveAsAction.Sensitive   = false;
        this.refreshAction.Sensitive  = false;
    }
Exemplo n.º 8
0
 public static async void EditMessageAsync(string chnid, string msgid, string content)
 {
     try
     {
         await Task.Run(() =>
         {
             EditMessage editmessage        = new EditMessage();
             editmessage.Content            = content;
             IChannelService channelservice = AuthenticatedRestFactory.GetChannelService();
             channelservice.EditMessage(chnid, msgid, editmessage);
         });
     }
     catch (Exception exception)
     {
         App.NavigateToBugReport(exception);
     }
 }
        public async Task <IActionResult> PutMessage([FromBody] EditMessage editedMessage)
        {
            var user = await _userManager.GetCurrentUserAsync(HttpContext);

            var message = await _context.Messages.FirstAsync(m => m.Id == editedMessage.Id);

            if (message == null || message.SenderId != user.Id)
            {
                return(BadRequest());
            }

            message.Text       = editedMessage.Text;
            message.IsModified = true;

            await _context.SaveChangesAsync();

            return(NoContent());
        }
Exemplo n.º 10
0
        public async Task Edited(DiscordClient client, MessageUpdateEventArgs messageEvent)
        {
            if (messageEvent.Channel.Id == ChannelId)
            {
                // Build new message object
                EditMessage message = new EditMessage(messageEvent.Message);

                // Forward to SignalR
                Task <HttpResponseMessage> apiTask  = commsHandler.EditObject(message);
                HttpResponseMessage        response = null;
                try
                {
                    response = await apiTask;
                }
                catch (Exception e)
                {
                    throw new ApplicationException("Couldn't send message to SignalR.", e);
                }

                // Edit history
                config.Client.HistoryStore.EditMessage(messageEvent.Message);
            }
        }
Exemplo n.º 11
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseRouting();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapGet("/", async context =>
                {
                    await context.Response.WriteAsync("I'm alive");
                });
                endpoints.MapPost("/addmessage", async context =>
                {
                    MyDbContext _context = new MyDbContext();
                    var add = new AddMessage();

                    var dto = await context.Request.ReadFromJsonAsync <NewMessageDTO>();
                    var jwt = DecodeHeader.GetJwtToken(context.Request.Headers);

                    var result = await add.Add(dto, jwt.id, _context);
                    await context.Response.WriteAsJsonAsync(result);
                });
                endpoints.MapPost("/addroom", async context =>
                {
                    MyDbContext _context = new MyDbContext();
                    var add = new AddRoom();

                    var dto = await context.Request.ReadFromJsonAsync <NewRoomDTO>();
                    var jwt = DecodeHeader.GetJwtToken(context.Request.Headers);

                    if (jwt.admin == 0)
                    {
                        throw new Exception("You are not allowed to add a new room");
                    }

                    var result = await add.Add(dto, jwt.id, _context);
                });
                endpoints.MapPost("/editmessage", async context =>
                {
                    MyDbContext _context = new MyDbContext();
                    var edit             = new EditMessage();

                    var dto = await context.Request.ReadFromJsonAsync <EditMessageDTO>();
                    var jwt = DecodeHeader.GetJwtToken(context.Request.Headers);

                    var result = await edit.Edit(dto, jwt.id, _context);
                    await context.Response.WriteAsJsonAsync(result);
                });
                endpoints.MapPost("/editroom", async context =>
                {
                    MyDbContext _context = new MyDbContext();
                    var edit             = new EditRoom();

                    var dto = await context.Request.ReadFromJsonAsync <EditRoomDTO>();
                    var jwt = DecodeHeader.GetJwtToken(context.Request.Headers);

                    if (jwt.admin == 0)
                    {
                        throw new Exception("You are not allowed to edit room details");
                    }

                    var result = await edit.Edit(dto, jwt.id, _context);
                    await context.Response.WriteAsJsonAsync(result);
                });
                endpoints.MapPost("/deletemessage", async context =>
                {
                    MyDbContext _context = new MyDbContext();
                    var delete           = new DeleteMessage();

                    var dto = await context.Request.ReadFromJsonAsync <DeleteMessageDTO>();
                    var jwt = DecodeHeader.GetJwtToken(context.Request.Headers);

                    var result = await delete.Delete(dto.MessageId, jwt.id, _context);
                    await context.Response.WriteAsJsonAsync(result);
                });
                endpoints.MapPost("/closeroom", async context =>
                {
                    MyDbContext _context = new MyDbContext();
                    var close            = new CloseRoom();

                    var dto = await context.Request.ReadFromJsonAsync <CloseOpenRoomDTO>();
                    var jwt = DecodeHeader.GetJwtToken(context.Request.Headers);

                    if (jwt.admin == 0)
                    {
                        throw new Exception("You are not allowed to close a room");
                    }

                    var result = await close.Close(dto.RoomId, jwt.id, _context);
                    await context.Response.WriteAsJsonAsync(result);
                });
                endpoints.MapPost("/openroom", async context =>
                {
                    MyDbContext _context = new MyDbContext();
                    var open             = new OpenRoom();

                    var dto = await context.Request.ReadFromJsonAsync <CloseOpenRoomDTO>();
                    var jwt = DecodeHeader.GetJwtToken(context.Request.Headers);

                    if (jwt.admin == 0)
                    {
                        throw new Exception("You are not allowed to open a room");
                    }

                    var result = await open.Open(dto.RoomId, jwt.id, _context);
                    await context.Response.WriteAsJsonAsync(result);
                });
                endpoints.MapPost("/star", async context =>
                {
                    MyDbContext _context = new MyDbContext();
                    var star             = new StarMessage();

                    var dto = await context.Request.ReadFromJsonAsync <StarMessageDTO>();
                    var jwt = DecodeHeader.GetJwtToken(context.Request.Headers);

                    await star.Star(dto.MessageId, jwt.id, _context);
                    await context.Response.WriteAsJsonAsync(StatusCodes.Status200OK);
                });
                endpoints.MapPost("/unstar", async context =>
                {
                    MyDbContext _context = new MyDbContext();
                    var star             = new UnStarMessage();

                    var dto = await context.Request.ReadFromJsonAsync <StarMessageDTO>();
                    var jwt = DecodeHeader.GetJwtToken(context.Request.Headers);

                    await star.UnStar(dto.MessageId, jwt.id, _context);
                    await context.Response.WriteAsJsonAsync(StatusCodes.Status200OK);
                });
            });
        }
Exemplo n.º 12
0
 /// <summary>
 /// Sends the specified message to a window or windows. The SendMessage function calls the window procedure for the specified window and does not return until the window procedure has processed the message.
 /// </summary>
 /// <param name="hWnd">A handle to the window whose window procedure will receive the message. If this parameter is HWND_BROADCAST ((HWND)0xffff), the message is sent to all top-level windows in the system, including disabled or invisible unowned windows, overlapped windows, and pop-up windows; but the message is not sent to child windows.</param>
 /// <param name="Msg">The message to be sent.</param>
 /// <param name="wParam">Additional message-specific information.</param>
 /// <param name="balloonTip">Additional message-specific information.</param>
 /// <returns>The return value specifies the result of the message processing; it depends on the message sent.</returns>
 public static IntPtr SendMessage(HandleRef hWnd, EditMessage Msg, int wParam, ref EDITBALLOONTIP balloonTip) => User32_Gdi.SendMessage(hWnd, Msg, wParam, ref balloonTip);
Exemplo n.º 13
0
 private void MenuItemEdit_Click(object sender, RoutedEventArgs e)
 {
     EditMessage?.Invoke(this, new EditMessageEventArgs(this));
 }
Exemplo n.º 14
0
 public static extern IntPtr SendMessage(HWND hWnd, EditMessage Msg, int wParam, ref TTHITTESTINFO hitTestInfo);
Exemplo n.º 15
0
 public static extern IntPtr SendMessage(HWND hWnd, EditMessage Msg, int wParam, ref TOOLINFO toolInfo);
Exemplo n.º 16
0
 public static extern IntPtr SendMessage(HWND hWnd, EditMessage Msg, int wParam, ref TTGETTITLE title);
Exemplo n.º 17
0
 public static extern int SendMessage(IntPtr hWnd, EditMessage msg, SCF wParam, ref CHARFORMAT2 fmt);
Exemplo n.º 18
0
 public static extern int SendMessage(IntPtr hWnd, EditMessage msg, ref SETTEXTEX wParam, byte[] lParam);
Exemplo n.º 19
0
 /// <summary>
 /// Sends the specified message to a window or windows. The SendMessage function calls the window procedure for the specified window and does not return until the window procedure has processed the message.
 /// </summary>
 /// <param name="hWnd">A handle to the window whose window procedure will receive the message. If this parameter is HWND_BROADCAST ((HWND)0xffff), the message is sent to all top-level windows in the system, including disabled or invisible unowned windows, overlapped windows, and pop-up windows; but the message is not sent to child windows.</param>
 /// <param name="Msg">The message to be sent.</param>
 /// <param name="wParam">Additional message-specific information.</param>
 /// <param name="title">Additional message-specific information.</param>
 /// <returns>The return value specifies the result of the message processing; it depends on the message sent.</returns>
 public static IntPtr SendMessage(HandleRef hWnd, EditMessage Msg, int wParam, ref TTGETTITLE title) => User32_Gdi.SendMessage(hWnd, Msg, wParam, ref title);
Exemplo n.º 20
0
 /// <summary>
 /// Sends the specified message to a window or windows. The SendMessage function calls the window procedure for the specified window and does not return until the window procedure has processed the message.
 /// </summary>
 /// <param name="hWnd">A handle to the window whose window procedure will receive the message. If this parameter is HWND_BROADCAST ((HWND)0xffff), the message is sent to all top-level windows in the system, including disabled or invisible unowned windows, overlapped windows, and pop-up windows; but the message is not sent to child windows.</param>
 /// <param name="Msg">The message to be sent.</param>
 /// <param name="wParam">Additional message-specific information.</param>
 /// <param name="toolInfo">Additional message-specific information.</param>
 /// <returns>The return value specifies the result of the message processing; it depends on the message sent.</returns>
 public static IntPtr SendMessage(HandleRef hWnd, EditMessage Msg, int wParam, ref TOOLINFO toolInfo) => User32_Gdi.SendMessage(hWnd, Msg, wParam, ref toolInfo);
Exemplo n.º 21
0
 /// <summary>
 /// Sends the specified message to a window or windows. The SendMessage function calls the window procedure for the specified window and does not return until the window procedure has processed the message.
 /// </summary>
 /// <param name="hWnd">A handle to the window whose window procedure will receive the message. If this parameter is HWND_BROADCAST ((HWND)0xffff), the message is sent to all top-level windows in the system, including disabled or invisible unowned windows, overlapped windows, and pop-up windows; but the message is not sent to child windows.</param>
 /// <param name="Msg">The message to be sent.</param>
 /// <param name="wParam">Additional message-specific information.</param>
 /// <param name="hitTestInfo">Additional message-specific information.</param>
 /// <returns>The return value specifies the result of the message processing; it depends on the message sent.</returns>
 public static IntPtr SendMessage(HandleRef hWnd, EditMessage Msg, int wParam, ref TTHITTESTINFO hitTestInfo) => User32_Gdi.SendMessage(hWnd, Msg, wParam, ref hitTestInfo);
Exemplo n.º 22
0
 public void NavigateToEditNote(EditMessage message)
 {
     navigationService.NavigateTo(Common.Navigation.Edit,message.Content);
 }
Exemplo n.º 23
0
        /// <inheritdoc />
        public virtual Task <Message> EditMessage(string channelId, string messageId, EditMessage editMessage)
        {
            var arguments = new object[] { channelId, messageId, editMessage };

            return((Task <Message>)methodImpls["EditMessage"](Client, arguments));
        }